Commands via MQTT or HTTP API must be formatted as JSON-strings in the format {"PATH":"COMMAND"} .
The http api is reachable under http://IP_OF_YOUR_DEVICE/api and accepts commands via POST
Example: curl -X "POST" http://192.168.1.12/api -d '{"act_ctl":"list"}'
Available commands are:
system: System related commands
-update: Do firmware update
-revert: Revert a firmware update
-status: Get the device port's status
power: Power measurement commands
-power: Read power meter
state_PORTNAME: Output related commands
-on - Activate a port, i.e. {"state_OUT1":"on"}
-tim - Activate a port and set a timer, i.e. {"state_OUT1":"tim","tim_val_OUT1":"90"}
-off - Deactivate a port.
-pwm - Set ports PWM value between 0 and 255, i.e. {"state_RED":"pwm","pwm_val_RED":"123"}
-without parameter - get ports status, i.e. i.e. {"state_OUT1":""}
profile: Activate a profile
-profile - Activate a profile, i.e. {"profile":"pr_mainlight_on"}
-without parameter - Get active profile i.e. {"profile":""}
pr_ctl: Extended profile control
-list - Get a list of available profiles, i.e. {"pr_ctl":"list"}
-add - Generates a new profile inherit current port status, i.e. {"prt_ctl":"add","new_profile":"pr_TEST"}
-del -Removes an existing profile, i.e. {"pr_ctl":"del","profile":"pr_TEST"}
-edt - Rewrites an existing profile inherit current port status, , i.e. {"pr_ctl":"edt","profile":"pr_TEST"}
act_ctl: Planned actions control
-list - Get a list of active planned actions, i.e. {"act_ctl":"list"}
-add - adds a new planned action.
Add requires following parameters:
entry ("0"), event_active ("yes"/"no"), target ("portname" / "profile name"), recur ("once","year","month","week","day"),
recurrence-specific parameters,hour("0"-"23"),min("0"-"59"),use_suntime("0"-"2"),act_num("numeric unique ID").
Recurrence-specific parameters are:
once: month("1"-"12"),day("1"-"31")
year: month("1"-"12"),day("1"-"31")
month: day("1"-"31")
week: wday("0"-"8"),
day: none
use_suntime means:
"0": use given timestamp
"1": use sunrise time
"2": use sunset time
Example:{"act_ctl":"add","entry":"0","event_active":"yes","target":"pr_mainlight_off","recur":"once","month":"3","day":"7","hour":"22",""min":"50","use_suntime","0","act_num":"1234567"}
-edt - edits a planned action, if one with given act_num is found. Otherwise create a new one.
rgb: Set a colour
-RGB_Colour - Set RGB Colour code, e.g. #FFFFFF for white or #00FF00 for green. Only available on lamps.
Number of colour channels can vary between 3 ( #AABBCC), 4 (#AABBCCDD) and 5 (#AABBCCDDEE) depending on device capabilities.
Example: {"rgb":"#AA00FF"}
-without parameter - Request current colour, i.e. {"rgb":""}
The device will respond the command if it was successfull on the configured response topic.
The response will be send with retain flag to broker to allow clients to get an updated overview on connect.
A response will always be in the format
{"STATION":"Station name","Path":"Command","RESP":"OK"}
e.g. {"STATION":"Schaltsteckdose","state_OUT1":"on","RESP":"OK"}
In case of a failure, i.e. unknown command the response is "fail",
e.g. {"station":"TOISWITCH_DEVICE","resp":"fail"}
If a command isn't responded, it wasn't received or couldn't be executed, i.e. the port or profile mentioned was not found.
Port and profile names are case-sensitive.
Once in a minute every device sends a detailed status report, including port status, colour, active profile, wlan strength and supply voltage (vcc).
If the supply voltage is low, it will also add "vcc_state":"low" to the end of the MQTT status message.