Subscribe/Unsubscribe

Michael Ingraham 2019-07-11 14:55:43 -04:00
parent 59339fa07e
commit 02b712e36d
1 changed files with 4 additions and 2 deletions

@ -203,10 +203,12 @@ StateText1|`<value>` = set `OFF` state text (10 chars max)<a id="StateText2"></a
StateText2|`<value>` = set `ON` state text (10 chars max)<a id="StateText3"></a>
StateText3|`<value>` = set `TOGGLE` state text (10 chars max)<a id="StateText4"></a>
StateText4|`<value>` = set `HOLD` state text (10 chars max)<a id="SwitchRetain"></a>
SwitchRetain|`0` = disable use of MQTT retain flag *(default)*<BR>`1` = enable MQTT retain flag on switch press<a id="SwitchTopic"></a>
SwitchRetain|`0` = disable use of MQTT retain flag *(default)*<BR>`1` = enable MQTT retain flag on switch press<a id="Subscribe"></a>
Subscribe|List all topics currently subscribed<BR>`<eventName>, <mqttTopic> [, <key>]`<BR>The `<key>` parameter is optional. It is specified to parse a key/value pair from a JSON payload in the MQTT message. In order to parse a value from a multi-level JSON pair, you can use one dot (`.`) syntax to split the key into sections.<BR><BR>Subscribes to an MQTT topic and assigns an [`Event`](#event) name to it. You must compile your own binary with `#define SUPPORT_MQTT_EVENT` in your `user_config_override.h` file.<BR><BR>**Examples:**<li>`Subscribe BkLight, stat/%topic%/POWER`<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Rule1 ON Event#BkLight=ON DO <command>ENDON`</li><li>`Subscribe DnTemp, stat/%topic%/SENSOR, DS18B20.Temperature`<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where the MQTT message payload is `{"Time":"2017-02-16T10:13:52", "DS18B20":{"Temperature":20.6}}`<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`Rule1 ON Event#DnTemp>=21 DO <command> ENDON`</li><a id="SwitchTopic"></a>
SwitchTopic|`<value>` = set MQTT switch topic (32 chars max)<BR>`0` = disable use of MQTT switch topic<BR>`1` = set MQTT switch topic to device `%topic%`<BR>`2` = reset MQTT switch topic to firmware default (`MQTT_SWITCH_TOPIC`) _(default = `0`)_<BR>[Read more](Buttons-and-switches) about this<a id="TelePeriod"></a>
TelePeriod|`0` = disable telemetry messages<BR>`1` = reset telemetry period to firmware default (`TELE_PERIOD`)<BR>`10..3600` = set telemetry period in seconds *(default = `300`)*<a id="Topic"></a>
Topic|`1` = reset MQTT topic to firmware default (`MQTT_TOPIC`) and restart<BR>`<value>` = set MQTT topic (32 chars max) **and** `ButtonTopic` and restart
Topic|`1` = reset MQTT topic to firmware default (`MQTT_TOPIC`) and restart<BR>`<value>` = set MQTT topic (32 chars max) **and** `ButtonTopic` and restart<a id="Unsubscribe"></a>
Unsubscribe|Unsubscribe from all topics currently subscribed using the [`Subscribe`](#subscribe) command<BR>`<eventName>` = unsubscribe from a specific MQTT topic<BR><BR>You must compile your own binary with `#define SUPPORT_MQTT_EVENT` in your `user_config_override.h` file.
See also | [`SetOption2`](#setoption2) - Add units to status messages<BR>[`SetOption4`](#setoption4) - Return MQTT response as RESULT or %COMMAND% topic<BR>[`SetOption10`](#setoption10) - Main topic change behaviour
### [Rules](Rules)