Automation API

Communication

Normal communication with the device is done using MQTT through a broker. But controlling programs may need to figure out which infrared protocols the device supports. For this type of information the program can communicate directly with the device via HTTP.

MQTT

The MQTT message payload is a JSON object.

Events

topic/address
The device address that can be used to send HTTP requests. The device transmits this message when it connects to the MQTT broker. It has the retain flag set, so the broker will store the message and send it to any client that subscribes to the topic.
Parameters: url
Retained: yes
topic/receive
Report a received infrared signal. Depending on the selected receive mode (see below), different parameters are reported when an infrared signal is received.
basic
Report recognized IR signals. Only one report per key press is generated.
Parameters: family, device, function, (toggle, ...)
Retained: no
full
Similar to basic mode, except that every repetition of the signal is reported seperately. An additional boolean parameter "start" is set to true on the first transmission, and false on subsequent repetitions.
Parameters: family, device, function, start, (toggle, ...)
Retained: no
capture
An array of on- and off times of the received signal is reported.
Parameters: times
Retained: no
topic/define
An infrared family definition has been added or updated. A controlling program can use this as a trigger to update the list of families that it presents to a user. If details of the protocol are needed, those can be obtained via an HTTP call.
Parameters: family
Retained: no
topic/delete
An infrared family definition has been deleted. A controlling program can use this as a trigger to update the list of families that it presents to a user.
Parameters: family
Retained: no

Actions

actions/deviceid/transmit
Instruct the device to transmit one or more infrared signals. Different methods are chosen depending on the provided parameters.
  • If a family parameter is provided, the IRP definition for that family is used as the specification of the IR signal. If any parameters defining integer values for IRP variables are provided, the variables are initialized to the specified values. IRP variables names are a sequence of one or more uppercase letters and digits, starting with a letter. The F parameter must always be present. It specifies which function code(s) should be transmitted. The F parameter value may be specified as an integer, or an array of integers. An optional repeat parameter may be included to specify how many times the repeat part of the signal will be transmitted. Without this parameter, the minimum number of repeat counts is used (0 for *, 1 for +).
    Parameters: family, D, F, (repeat, interval, S, ...)
    Example: {"family":"RC5","D":0,"F":17,"repeat":3}
  • If a pronto parameter is specified, the signal defined by that pronto code is transmitted. The pronto parameter value may be specified as a string, an array of strings, or an array of integers. An optional repeat parameter may be included to specify how many times the repeat part of the signal will be transmitted. Without this parameter, the repeat part is transmitted once.
    Parameters: pronto, (repeat, interval)
    Example: {"pronto":["5000","0000","0000","0001","0000","0011"],"repeat":3}
When an interval parameter is specified, the device will make sure the specified amount of time (in ms) elapses after the infrared signal before the next infrared signal will be transmitted. This value defaults to 200ms. It is allowed for a message to only contain the interval parameter. In that case it defines a minimum amount of time since the last transmitted infrared signal. Note that repeating messages with just an interval parameter will not add up the values. The highest value determines the length of time between the infrared signals, as that will also have satisfied the interval for the lower values.
actions/deviceid/receive
Select the receive mode. Supported modes are:
disabled
The IR receiver is switched off.
basic
Report recognized received IR signals.
full
Report every repetition of recognized received IR signals.
capture
Report timing details for every received IR signal.
Parameters: mode
Example: {"mode":"basic"}
actions/deviceid/decode
Configure which IR families to consider for reporting received IR signals. The payload should be an array of up to eight objects, specifying at least a family, and optionally one or more variables of the IRP definition. Any variable that is provided will limit the reported signal to those that match the specified value.
Example: [{"family":"NEC1","D":4},{"family":"RC5"}]
actions/deviceid/define
Define the IRP string for an infrared protocol family. This is used to correct the definition for an existing infrared protocol family, or to add a new infrared protocol family.
Parameters: family, irp
Example: {"family":"RC5","irp":"{36k,msb,889}<1,-1|-1,1>(1,~F:1:6,T:1,D:5,F:6,^114m)+"}
actions/deviceid/upgrade
When the action parameter is specified with a value of "upgrade", the device checks for a firmware update and, if found, installs it.
Parameters: action
Example: {"action":"upgrade"}

HTML

http://address/irplist.txt
A list of all currently defined IR families and their IRP string. Each line in the returned document contains a family name, a tab, and the IRP string. The families are returned in an undetermined order.
http://address/family.irp
The IRP string for family. This call is normally used after a device reports via MQTT that a definition has been updated. See the topic/define MQTT event.