You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,11 +169,15 @@ To configure your ESP to integrate with MQTT, fill out the following settings:
169
169
170
170
#### More detail on `mqtt_topic_pattern`
171
171
172
-
`mqtt_topic_pattern` leverages single-level wildcards (documented [here](https://mosquitto.org/man/mqtt-7.html)). For example, specifying `milight/:device_id/:device_type/:group_id` will cause the ESP to subscribe to the topic `milight/+/+/+`. It will then interpret the second, third, and fourth tokens in topics it receives messages on as `:device_id`, `:device_type`, and `:group_id`, respectively.
172
+
`mqtt_topic_pattern` leverages single-level wildcards (documented [here](https://mosquitto.org/man/mqtt-7.html)). For example, specifying `milight/:device_id/:device_type/:group_id` will cause the ESP to subscribe to the topic `milight/+/+/+`. It will then interpret the second, third, and fourth tokens in topics it receives messages on as `:device_id`, `:device_type`, and `:group_id`, respectively. The following tokens are available:
173
+
174
+
1. `:device_id` - Device ID. Can be hexadecimal (e.g. `0x1234`) or decimal (e.g. `4660`).
175
+
1. `:device_type` - Remote type. `rgbw`, `fut089`, etc.
176
+
1. `:group_id` - Group. 0-4 for most remotes. The "All" group is group 0.
173
177
174
178
Messages should be JSON objects using exactly the same schema that the REST gateway uses for the `/gateways/:device_id/:device_type/:group_id` endpoint. Documented above in the _Bulb commands_ section.
175
179
176
-
##### Example:
180
+
#### Example:
177
181
178
182
If `mqtt_topic_pattern` is set to `milight/:device_id/:device_type/:group_id`, you could send the following message to it (the below example uses a ruby MQTT client):
179
183
@@ -188,7 +192,12 @@ This will instruct the ESP to send messages to RGB+CCT bulbs with device ID `0x1
188
192
189
193
#### Updates
190
194
191
-
To enable passive listening, make sure that `listen_repeats` is set to something larger than 0 (the default value of 3 is a good choice).
195
+
ESPMH is capable of providing two types of updates:
196
+
197
+
1. Delta: as packets are received, they are translated into the corresponding command (e.g., "set brightness to 50"). The translated command is sent as an update.
198
+
2. State: When an update is received, the corresponding command is applied to known group state, and the whole state for the group is transmitted.
199
+
200
+
##### Delta updates
192
201
193
202
To publish data from intercepted packets to an MQTT topic, configure MQTT server settings, and set the `mqtt_update_topic_pattern` to something of your choice. As with `mqtt_topic_pattern`, the tokens `:device_id`, `:device_type`, and `:group_id` will be substituted with the values from the relevant packet. `:device_id` will always be substituted with the hexadecimal value of the ID. You can also use `:hex_device_id`, or `:dec_device_id` if you prefer decimal.
194
203
@@ -200,10 +209,23 @@ As an example, if `mqtt_update_topic_pattern` is set to `milight/updates/:hex_de
**Make sure that `mqtt_topic_pattern`and `matt_update_topic_pattern` are different!** If they are they same you can put your ESP in a loop where its own updates trigger an infinite command loop.
228
+
**Make sure that `mqtt_topic_pattern`, `mqtt_state_topic_pattern`, and `matt_update_topic_pattern` are all different!** If they are they same you can put your ESP in a loop where its own updates trigger an infinite command loop.
0 commit comments