Hi all,
I have a small issue with MQTT binding and incoming data transformation using JavaScript. Somewhere in the forum (can’t find the post anymore), I read that there are two valid formats for JavaScript. But for some reason, one (that works for other MQTT things), is triggered always, while the other only is every few minutes. Can anyone explain me, why? The RawPayload is only there to verify that I actually receive every payload published to the topic and it’s not a connection issue.
Thing mqtt:topic:Zigbee2Mqtt_Kueche_Hue_Color_Links "Hue Color Links (MQTT)" (mqtt:broker:broker) {
Channels:
Type color : color [
stateTopic="zigbee2mqtt/1.05-kueche/hue-color/links",
transformationPattern="JS(zigbee2MqttToColor.js)"
]
Type string : RawPayload [
stateTopic="zigbee2mqtt/1.05-kueche/hue-color/links"
]
}
With this content/format, the following code is executed always (I can see the log line)
(function(x) {
console.log("I am always here!");
[...]
})(input)
But with this format, the code is only executed every few minutes. No errors or else in the logs.
console.log("Sometimes, I'm here!");
[...]
Any Idea what might be the issue or how to debug?
Edit:
Platform: openHAB 5.1.0, OpenJDK Runtime Environment Zulu21.0.9