OS: _what OS is used and which version_Ubuntu 20.04
Java Runtime Environment: _which java platform is used and what version_openJDK 11
openHAB version:3.0.0
Issue of the topic: Ligth switch that needs to publish a json string at on or off
So I have a Zigbee Blizwolf plugg, a Tasmota 9.2 Coordinator and what to control this by MQTT.
On the “on” action I need to publish a command and a jason string.
so basacly to publish “{“device”:“Plug1”,“send”:{“Power”:“On”}}” to /cmnd/ZBBridge/ZbSend
This did not work:
Thing:
Channells:
Type switch : Plug1 [stateTopic=“stat/ZBBridge/RESULT”, commandTopic=“cmnd/ZBBridge/ZbSend”, on="{“device”:“Plug1”,“send”:{“Power”:“On”}}", off="…"]
Hi, I have a similar problem with formatting which I hope someone can help me with.
Also trying to get a Sonoff Zigbee switch to activate but getting the following error in the Zigbee Bridge: stat/sonoffzbbridge/RESULT = {“Command”:“Unknown”}. I can get the device power status, but can’t get MQTT message to turn device on or off.
I can send the control the device directly from the Tasmota console using : cmnd/sonoffzbbridge/ZbSend {“Device”:“0xE5DE”,“Send”:{“Power”:0}}
My Channel looks like this in the GUI:
State Topic: tele/sonoffzbbridge/SENSOR
MQTT command topic: cmnd/sonoffzbbridge/ZbSend
Custom On/Open value: 1
Custom Off/Closed value: 0
Incoming Value Transformations: JSONPATH:$.ZbReceived.0xE5DE.Power
Outgoing Value Transformation: “{ "Device" : "0xE5DE" , "Send" :{ "Power " : %d}}”
Outgoing Value Format: %d
Openhab logs show the following: [WARN ] [t.generic.ChannelStateTransformation] - Transformation service “{ "DEVICE" for pattern "0xE5DE" , "Send" :{ "Power " : %d}}” not found!
I’ve also tried transformation %s and tried the formatting with and without spaces.
Ok, I’ve moved the line to Outgoing Value Format (which is the FormatBeforePublish).
After double checking everything again, I was getting {“ZbSend”:“Invalid JSON”}. Long story short, I got it working and would you believe it that there is a difference between " and “
Thanks for the assistance and great work.