Hi there!
I migrate from MQTT 1.x to MQTT 2.4.
After a lot of trouble using the new binding, i am able to send mqtt-messages.
Now i need to transform them to JSON-format. I am using the zigbee2mqtt-stick.
OK. I will show you my files:
mqtt.thing file (connection works fine)
Thing topic MQTT_Flur {
Channels:
.....
Type switch : MQTT_Status_Flur [ commandTopic="zigbee2mqtt/flurlicht_klein/set", on="ON", off="OFF", transformationPattern="JS:setZigbeeState.js"]
}
mqtt.items file
.....
Switch Status_Flur "Flurlicht" {channel="mqtt:topic:mosquitto:MQTT_Flur:MQTT_Status_Flur"}
setZigbeeState.js
(function(x){
var result = new Object();
result.state = x;
return JSON.stringify(result);
})(input)
The problem: via MQTTfx i get only ON or OFF; not the JSON-format.
Any idea? and Thx