mirror of https://github.com/arendst/Tasmota.git
Add FullTopic
parent
351c30a0e1
commit
5c11cad093
|
@ -211,6 +211,9 @@ ButtonTopic | | Show current MQTT button topic
|
|||
ButtonTopic | 0 | off | Disable use of MQTT button topic
|
||||
ButtonTopic | 1 | Set MQTT button topic to Topic
|
||||
ButtonTopic | <topic> | Set MQTT button topic (32 chars max)
|
||||
FullTopic | | Show current MQTT fulltopic string
|
||||
FullTopic | 1 | Reset MQTT fulltopic to user_config.h (MQTT_FULLTOPIC) and restart
|
||||
FullTopic | <fulltopic> | Set MQTT fulltopic (100 chars max) using optional %topic% and %prefix% and restart
|
||||
GroupTopic | | Show current MQTT group topic
|
||||
GroupTopic | 1 | Reset MQTT group topic to user_config.h (MQTT_GRPTOPIC) and restart
|
||||
GroupTopic | <grouptopic> | Set MQTT group topic (32 chars max) and restart
|
||||
|
|
|
@ -23,3 +23,18 @@ Sonoff responds to the following MQTT commands using MQTT Topic for ```cmnd/sono
|
|||
While most MQTT commands will result in a message in JSON format the power status feedback will always be returned like ```stat/sonoff/POWER ON``` too.
|
||||
|
||||
Telemetry data will be sent by prefix ```tele``` like ```tele/sonoff/SENSOR {"Time":"2017-02-16T10:13:52", "DS18B20":{"Temperature":20.6}}```
|
||||
|
||||
## MQTT Topic definition
|
||||
Until version 5.0.5 the MQTT topic was defined rigidly by using the commands ``Prefix<x>`` and ``Topic`` resulting in a command topic string like ``cmnd/sonoff/Power``.
|
||||
|
||||
Starting with version 5.0.5 the MQTT topic is more flexible using command ``FullTopic`` and tokens to be placed within the user definable string up to 100 characters in size. The provided tokens are:
|
||||
- %prefix% to be dynamically substituted by one of three prefixes as defined by commands ``Prefix1``, ``Prefix2`` and ``Prefix3``.
|
||||
- %topic% to be dynamically substituted by one of the five topics as defined by commands ``Topic``, ``GroupTopic``, ``ButtonTopic``, ``SwitchTopic`` and ``MqttClient``.
|
||||
|
||||
Using the tokens the following example topics can be made:
|
||||
- ``FullTopic %prefix%/%topic%/`` being the legacy situation up to version 5.0.5
|
||||
- ``FullTopic tasmota/%topic%/%prefix%/``
|
||||
- ``FullTopic tasmota/bedroom/%topic%/%prefix%/``
|
||||
- ``FullTopic penthouse/bedroom1/bathroom2/%topic%/%prefix%/``
|
||||
|
||||
To solve possible MQTT topic loops I strongly suggest to use the %prefix% token in all of your FullTopics. It may work without %prefix% as I implemented some validation by forcing the use of a prefix in commands send to the device but status and telemetry do not need a prefix. Just play with it and report strange problems I might solve in the future.
|
Loading…
Reference in New Issue