sorry for such a easy question however i am new to this.
is there away to change the MQTT : Payload from sending 1 and 0 to ON and OFF
if so how would i go about it?
Thank you
MQTT : Payload
Moderators: grovkillen, Stuntteam, TD-er
Re: MQTT : Payload
Hi, yes, you can do it by rules and Publish command, you can send anything you need to your broker :)
Or, if you're using openHAB and need this format of message there, you can change it by transformation map.
Or, if you're using openHAB and need this format of message there, you can change it by transformation map.
Please excuse my English, thanks!
Re: MQTT : Payload
would you be able to tell me what i would need to add to the rules to do this. i am using openHAB but dont know how to change it by transformation map.
many thanks
many thanks
Re: MQTT : Payload
Hi, can you describe your situation or give us your current rules configuration?
For example, you're using PIR sensor and you need to send state to broker .. You have defined PIR as device and need to record it's state.
By default, you can use function in Device setting, Data Acquisition > Send to Controller to send payload, but you can't influence this payload. In this case you need to handle it in openHAB, using transformation map. Some good expamation is here: https://github.com/openhab/openhab1-add ... ansforming . You have to define small map file and use it in OH item definition (0=OFF, 1=ON).
But maybe better solution is send 'correct' payload already from ESP :]. It's easy, at first uncheck Send to Controller checkbox in Device. Then create rule:
Hope it helps :]
For example, you're using PIR sensor and you need to send state to broker .. You have defined PIR as device and need to record it's state.
By default, you can use function in Device setting, Data Acquisition > Send to Controller to send payload, but you can't influence this payload. In this case you need to handle it in openHAB, using transformation map. Some good expamation is here: https://github.com/openhab/openhab1-add ... ansforming . You have to define small map file and use it in OH item definition (0=OFF, 1=ON).
But maybe better solution is send 'correct' payload already from ESP :]. It's easy, at first uncheck Send to Controller checkbox in Device. Then create rule:
Code: Select all
On PIR#Switch do
If [PIR#Switch]=1
Publish %sysname%/<PIRtopic>,ON
Else
Publish %sysname%/<PIRtopic>,OFF
Endif
Endon
Please excuse my English, thanks!
Who is online
Users browsing this forum: No registered users and 39 guests