• open panel

- Reading/controlling via HTTP

http://ws.microbit.se:82/

e.g.

http://ws.microbit.se:82/relaycontrol/on/1

|000|OK|1|1|

http://ws.microbit.se:82/relaycontrol/off/1

|000|OK|0|1|


 

Version 1.20 and newer has improved and extended support for controlling the relays(including Nexa remote switches), getting the status of the digital inputs as well as reading temperatures from 1 wire sensors via HTTP GET URLs. Version 1.23 adds the possibility to read the state of the relays.

For controlling relays/Nexa remote switches/1-wire outputs:

Turn on all relays and Nexa remote switches:
http://[webswitch address]/relaycontrol/on/all

Turn on only one relay or Nexa remote switch using an index number:
http://[webswitch address]/relaycontrol/on/[a number]
[a number]: 1-5=built-in relays, 6-10=extension relays, 101-125=Nexa remote switches number 1-25, version 4.0-> 201-225=local 1-wire digital outputs,  version 4.31 HOME Denkovi 8 > 256-456

Turn on only one relay or Nexa remote switch using its name:
http://[webswitch address]/relaycontrol/on/[relay/Nexa name]
[relay/Nexa name] has to be URL encoded.

Turn off all relays and Nexa remote switches:
http://[webswitch address]/relaycontrol/off/all

Turn off only one relay or Nexa remote switch using an index number:
http://[webswitch address]/relaycontrol/off/[a number]
[a number]: 1-5=built-in relays, 6-10=extension relays, 101-125=Nexa remote switches number 1-25, version 4.0-> 201-225=local 1-wire digital outputs,  version 4.31 HOME Denkovi 8 > 256-456

Turn off only one relay or Nexa remote switch using its name:
http://[webswitch address]/relaycontrol/off/[relay/Nexa name]
[relay/Nexa name] has to be URL encoded.

New commands added in version 1.21:

Home:
Pulse a relay high(on) for a selectable duration in seconds:

http://[webswitch address]/relaycontrol/pulse/high/[relay/Nexa name/number]/[duration in secs]
See above for [relay/Nexa name/number]

Home:
Pulse a relay low(off) for a selectable duration in seconds:

http://[webswitch address]/relaycontrol/pulse/low/[relay/Nexa name]/[duration in secs]
See above for [relay/Nexa name/number]

New commands added in version 1.23:

Get current relay/Nexa state using its name:
http://[webswitch address]/relaystate/get/[relay/Nexa name]
[relay/Nexa name] has to be URL encoded.

Get current relay/Nexa state using an index number:
http://[webswitch address]/relaystate/get/[a number]
[a number]: 1-5=built-in relays, 6-10=extension relays, 101-125=Nexa remote switches number 1-25

New commands added in version 2.6:

Turn on two or more relays or Nexa remote switch using  index numbers:
http://[webswitch address]/relaycontrol/on/[a number]$[a number] etc
[a number]: 1-5=built-in relays, 6-10=extension relays, 101-125=Nexa remote switches number 1-25

Example: Turn on relays 2, 3, 5 and Nexa 1:
http://[webswitch address]/relaycontrol/on/2$3$5$101

Turn off two or more relays or Nexa remote switch using index numbers:
http://[webswitch address]/relaycontrol/off/[a number]$[a number] etc
[a number]: 1-5=built-in relays, 6-10=extension relays, 101-125=Nexa remote switches number 1-25

Example: Turn off relays 1 and 4:
http://[webswitch address]/relaycontrol/off/1$4

New command added in version 4.0:

Getting relay state by index, multiple relays:
http://[webswitch address]/relaystate/get2/[a number]$[a number] (and so on)

The answer will be something looking like:
1,0
2,0
5,1
for an url looking like this: http://[webswitch address]/relaystate/get2/1$2$5

New command added in version 4.41:

Ham/Home
http://[webswitch address]/relaycontrol/pulse/[relay]
relay=1-10

For reading digital inputs:

Input 1:
http://[webswitch address]/input/get/1

Input 2:
http://[webswitch address]/input/get/2

New commands added in version 4.0:

Local 1-wire inputs:
http://[webswitch address]/input/get2/[a number]
[a number]: 1-25=1-wire input number 1-25

Note that since it’s a dual input devices the answer will look like this:
|[3-digit status code]|[Message in text]|[value]
With [value] being formatted as A,B for input A and B, for ex. 1,0 means input A=1 and input B=0

For reading temperature sensors:

Reading by index:
http://[webswitch address]/temperature/get/[1-25]

Added in version 3.7:
Reading “temperatur.nu” temperature:
http://[webswitch address]/temperature/get/26

Reading by sensor name:
http://[webswitch address]/temperature/get/[sensor name]
[sensor name] has to be URL encoded.

Commands with a simple value reply(CSV), added in version 2.9
(might be used with for ex. www.cosm.com)

Reading by index:
http://[webswitch address]/temperature/get2/[1-25]

Added in version 3.2:
Reading by index, multiple sensors.
http://[webswitch address]/temperature/get2/[1-25$1-25$1-25] (and so on)

The answer will be something looking like:
2,24.4
3,21.4
4,23.8
for an url looking like this: http://[webswitch address]/temperature/get2/2$3$4

Reading by sensor name: 

http://[webswitch address]/temperature/get2/[sensor name]

[sensor name] has to be URL encoded.

Added in version 4.17:

Reading max temperature by index:
http://[webswitch address]/temperature/get/[1-25]/max

Reading min temperature by index:
http://[webswitch address]/temperature/get/[1-25]/min

Reading max temperature by sensor name:
http://[webswitch address]/temperature/get/[sensor name]/max
[sensor name] has to be URL encoded.

Reading min temperature by sensor name:
http://[webswitch address]/temperature/get/[sensor name]/min
[sensor name] has to be URL encoded.

Added in version 4.21:

Resetting max/min temperatures:
http://[webswitch address]/temperature/reset/now

Getting date/time for last reset of max/min temperatures:
http://[webswitch address]/temperature/reset/last
Example of reply:  |000|OK|2015-09-17 14:49|

For reading relative humidity sensors(added in version 2.6):

Reading by index:
http://[webswitch address]/rh/get/[1-25]

Reading by sensor name:
http://[webswitch address]/rh/get/[sensor name]
[sensor name] has to be URL encoded.

Commands with a simple value reply(CSV), added in version 2.9
(might be used with for ex. www.cosm.com)

Reading by index:

http://[webswitch address]/rh/get2/[1-25]

Reading by sensor name:
http://[webswitch address]/rh/get2/[sensor name]
[sensor name] has to be URL encoded.

Added in version 4.81

Reading by index:
http://[webswitch address]/rh/get/[30-32]

Getting/setting Car Heater override state(added in version 1.24):

Get the state of the car heaters:

http://[url]/carheaterstate/get

See below for the reply format.

Set the state of the car heaters:
http://[url]/carheatercontrol/set/override/[heater name]/[command]
[heater name]: name of the heater
[command]: disabled, off, on

http://[url]/carheatercontrol/set/override/[heater name]/[command]/[hour]/[minute]
[heater name]: name of the heater
[command]: today or tomorrow
[hour]: hour of departure time in format 0-23
[minute]: minute of departure time in format 0-59

Getting/setting ACP override state(added in version 2.9):

Get the state of the Auto Control Programs:
http://[url]/acpstate/get
See below for the reply format.

Set the state of an Auto Control Program Override:
http://[url]/acpcontrol/set/override/[ACP name]/[command]
[ACP name]: name of the Auto Control Program
[command]: disabled, off, on

http://[url]/acpcontrol/set/override/[ACP name]/[command]/[hour]/[minute]
[ACP name]: name of the Auto Control Program
[command]: off, on
[hour]: hour to turn on or off
[minute]: minute to turn on or off

New commands added in version 3.3:

Set the state of an Auto Control Program itself:
http://[url]/acpcontrol/set/program/[ACP name]/[command]
[ACP name]: name of the Auto Control Program
[command]: disabled, enabled

Get the state of the Auto Control Programs, including disabled programs
http://[url]/acpstate/get2
See below for the reply format.

 

Getting/setting rotator state:

New commands added in version 3.0:

Get current position in degrees:
http://[url]/rotatorcontrol/get

Reply format:
”|000|OK|[degree]”  ([degree]=0-359 or >= 360 if no valid readings are available)

Set current position in degrees:

http://[url]/rotatorcontrol/set/[degree]

Abort current operation:
http://[url]/rotatorcontrol/set/stop

Set current position using presets:
http://[url]/rotatorcontrol/set/preset/[1-8]

Set power relay on/off:

http://[url]/rotatorcontrol/set/power/on

http://[url]/rotatorcontrol/set/power/off

Set aux relay on/off:

http://[url]/rotatorcontrol/set/aux/on

http://[url]/rotatorcontrol/set/aux/off

New commands added in version 3.1:

Get rotator setup:
http://[url]/rotatorcontrol/get/setup
See below for the reply format.

Get current position, etc:
http://[url]/rotatorcontrol/get2

Reply format:
”|000|OK|[degree],[preset],[power relay],[Aux relay],[Page timeout],[Status message]”

[degree]=0-359 or >= 360 if no valid readings are available
[preset]=Active preset 1-8 or 255 if no active.
[power relay] = Power relay status: 0=Off, 1=On, 2=Not supported.
[Aux relay] = Aux relay status: 0=Off, 1=On, 2=Not supported.
[Page timeout] = Page time out: >0 = page active, 0 = page inactive
[Status message] = Latest status in text format.

Every field, except [Status message], contains only digits.

General format of replies:

General replies are done with Mime type “text/plain” via HTTP in the following format using | as field separator:

|[3-digit status code]|[Message in text]|[status/value]

”|000|OK|[status/value]”
“|100|Unknown command|[status/value]”
“|101|Unknown relay: [id]|[status/value]”
“|102|Unknown input: [id]|[status/value]”
”|103|Not a temperature sensor: [id]|[status/value]”
”|104|Invalid temperature sensor index: [index]|[status/value]”
”|105|Invalid temperature sensor name: [name]|[status/value]”
”|106|Unknown pulse command:[command]|[status/value]”
”|107|Invalid pulse length: [length]|[status/value]”
”|108|Pulsing already active: [relay]|[status/value]”
”|109|Unknown status: [relay]|[X]”
”|110|Unknown car heater: [name]||”
”|111|Invalid time: xx||”
”|112|Not a humidity sensor: [id]|[status/value]”
”|113|Invalid humidity sensor name: [name]|[status/value]”
”|114|Invalid Auto Control Program Override time|[status/value]”
”|115|Unknown Auto Control Program: [Program name]|X| ”
“|116|Invalid rotator preset index|X|”
“|117|Rotator power already on/off||”
“|118|Unknown rotator power command|X|”
“|119|Rotator aux relay already on||”
“|120|Rotator aux relay already off||
“|121|Unknown rotator aux relay command|X|”
“|122|Rotator aux relay command not supported||”
“|123|Invalid rotator set command|X| ”
“|124|Invalid rotator command|X|”

Format of CSV formatted replies:

Temperatures: A number in Celsius degrees, for ex: 23.3000
Relative humidity: An integer, for ex: 45

Format of reply for command /carheaterstate/get:

For xml formatted replies the Mime type “text/xml” is used.

<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<carheaters>

<carheater>
<name>[Name of first heater]</name>
<relay>[Used Relay]</relay>
<temperature>[Current temperature]</temperature>
<relaystate>[0=Off, 1=On, X=Unknown]</relaystate>   <!– Added in version 3.0 –>
<tempunit>Celsius/Fahrnheit</tempunit>  <!– Added in version 3.0 –>

<engagetime>
<hour>[Hour for engage time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for engage time in format 0-59 or 255 if N/A]</minute>
</engagetime>

<disengagetime>
<hour>[Hour for disengage time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for disengage time in format 0-59 or 255 if N/A]</minute>
</disengagetime>

<tomorrowsdeparturetime>
<hour>[Hour for tomorrow's departure time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for tomorrow's departure  time in format 0-59 or 255 if N/A]</minute>
</tomorrowsdeparturetime>

<override>
<mode>[Override mode, one of: disabled, on, off, today or tomorrow]</mode>
<hour>[Hour for override time if mode today or tomorrow in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for override time if mode today or tomorrow in format 0-59 or 255 if N/A]</minute>
</override>
</carheater>

<carheater>
<name>[Name of second heater]</name>
<relay>[Used Relay]</relay>
<temperature>[Current temperature]</temperature>

<engagetime>
<hour>[Hour for engage time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for engage time in format 0-59 or 255 if N/A]</minute>
</engagetime>

<disengagetime>
<hour>[Hour for disengage time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for disengage time in format 0-59 or 255 if N/A]</minute>
</disengagetime>

<tomorrowsdeparturetime>
<hour>[Hour for tomorrow's departure time in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for tomorrow's departure  time in format 0-59 or 255 if N/A]</minute>
</tomorrowsdeparturetime>

<override>
<mode>[Override mode, one of: disabled, on, off, today or tomorrow]</mode>
<hour>[Hour for override time if mode today or tomorrow in format 0-23 or 255 if N/A]</hour>
<minute>[Minute for override time if mode today or tomorrow in format 0-59 or 255 if N/A]</minute>
</override>
</carheater>

</carheaters>

An example:

<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<carheaters>

<carheater>
<name>Car Warm Up 1</name>
<relay>CH 1</relay>
<temperature>23.6875</temperature>

<engagetime>
<hour>255</hour>
<minute>255</minute>
</engagetime>

<disengagetime>
<hour>255</hour>
<minute>255</minute>
</disengagetime>

<tomorrowsdeparturetime>
<hour>8</hour>
<minute>7</minute>
</tomorrowsdeparturetime>

<override>
<mode>disabled</mode>
<hour>255</hour>
<minute>255</minute>
</override>
</carheater>

<carheater>
<name>Car Warm Up 2</name>
<relay>Nexa 6</relay>
<temperature>23.6875</temperature>

<engagetime>
<hour>8</hour>
<minute>20</minute>
</engagetime>

<disengagetime>
<hour>9</hour>
<minute>35</minute>
</disengagetime>

<tomorrowsdeparturetime>
<hour>9</hour>
<minute>5</minute>
</tomorrowsdeparturetime>

<override>
<mode>disabled</mode>
<hour>255</hour>
<minute>255</minute>
</override>
</carheater>

</carheaters>

Format of reply for command /acpstate/get:

For xml formatted replies the Mime type “text/xml” is used.

<?xml version=”1.0″ encoding=”ISO-8859-1″?>

<acp>
<programs>

<program>
<no>[Program number]</no>
<name>[Program name]</name>
<relayname>[Relay used by the program]</relayname>
<relaystate>[Current relay state]</relaystate>
<override>
<mode>[Override mode]</mode>
<time>[Omitted, override time]</time>
</override>
</program>

<program>
<no>[Program number]</no>
<name>[Program name]</name>
<relayname>[Relay used by the program]</relayname>
<relaystate>[Current relay state]</relaystate>
<override>
<mode>[Override mode]</mode>
<time>
<hour>[Override hour]</hour>
<min>[Override minute]</min>
</time>
</override>
</program>

</programs>
</acp>

An example:

<?xml version=”1.0″ encoding=”ISO-8859-1″?>

<acp>
<programs>

<program>
<no>1</no>
<name>Light control</name>
<relayname>light</relayname>
<relaystate>0</relaystate>
<override>
<mode>disabled</mode>
<time></time>
</override>
</program>

<program>
<no>2</no>
<name>Heat control</name>
<relayname>heat</relayname>
<relaystate>1</relaystate>
<override>
<mode>on</mode>
<time></time>
</override>
</program>

<program>
<no>3</no>
<name>Fan control</name>
<relayname>fan</relayname>
<relaystate>0</relaystate>
<override>
<mode>off</mode>
<time>
<hour>14</hour>
<min>10</min>
</time>
</override>
</program>

</programs>
</acp>

Format of reply for command /acpstate/get2:

The format is the same as for /acpstate/get with the addition of this field:

<state>[Program state]</state>

which is repeated for every program.

[Program state] = 0 = program is disabled.
[Program state] = 1 = program is enabled.

Format of reply for command /rotatorcontrol/get/setup:

For xml formatted replies the Mime type “text/xml” is used.

<?xml version=”1.0″ encoding=”ISO-8859-1″?>

<rotor>
<presets>
<pre>
<no>[Number}</no>
<text>[Text]</text>
<deg>[Degree]</deg>
<active>[Active]</active>
</pre>
</presets>
<aux>[Aux relay mode]</aux>
<pwr>[Power relay mode]</pwr>
<type>[Rotator type]</type>
</rotor>

There will be 0-8 <pre> tags. Presets without texts are skipped.
[Active] will be 0 or 1.
[Aux relay mode] will be 0,1 or 2. 0=Off, 1=On, 2=Not supported.
[Power relay mode] will be 0,1 or 2. 0=Off, 1=On, 2=Not supported.
[Rotator type] will be a number according to the following list:
0=Analogue.
1=Prosistel D.
2=Array switch.
3=Green Heron RT21.
4=DCU 1.
5=Yaesu GS232B.
6=Alfaspid RAK.

 

© 2011-2023 Microbit 2.0 AB

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close