Well, the stress level was just a wild guess. And disabling the workaround rule for the Event Bus behaviour should have reduced the load anyway.
The mqtt1 Binding is using the default setting for the async parameter (which is true). So I’m afraid that won’t help much
I’ve just played around to maybe identify a the reason but so far without success… it seems to be mainly tied to the Action (i.e. usage in rules) though.
The mqtt2 action is a new rule engine action. Support for those kinds of actions within scripts and DSL rules was also just released before OH 2.4. The culprit could as well be in the framework. @Kai how robust (and efficient?) is the getActions API for DSL rules (parallel threads maybe even?) if we are talking about say 10 calls per second?
Im trying the above to trigger a command when a value comes in on the specified topic. When using the UI to configure the corresponding channel there is an attribute called “Is command” with the explanation: “If the received MQTT value should not only update the state of linked items, but command them, enable this option.” This is exactly what I need, but I don’t know how to set it in my mqtt.things file, eg. the above command=true on the channel doesn’t have any effect.
Does anyone know the right attribute to set on the channel?
Write rules in plain python! No! Rules must be written in an obscure non standard not language with little documentation and difficult debugging support.
If rules were easy, then anyone could do it, and what would all the people answering the “why does my rule not work” questions do then?
I’ll give it a shot with a workaround.
There’s a simple node.js based HTTP to MQTT bridge (https://github.com/petkov/http_to_mqtt). I’ll replace the MQTT Action calls with HTTP POSTs to the bridge’s URL. Let’s see if this might improve things.
After upgrading 2.4 and switching to MQTT 2 I’m facing similar issues as bern77. I used mqtt event-bus before and recreated it with the following rule:
rule “Publish item changes”
when
Member of gTemperature changed
then
var state = “”
if (triggeringItem.state != null) {
state = triggeringItem.state.toString
val actions = getActions(“mqtt”,“mqtt:broker:myBroker”)
actions.publishMQTT("/myserver/"+triggeringItem.name+"/state",state)
logInfo(“log”, "publish: " + triggeringItem.name + " " + state)
}
end
while the rule works as intended it won’t last 24 hours before I the get same error as bern77. After restarting OpenHAB it works again as it should. There are only 20 messages max per minute so the load is minimal.
Curious to see if others had more success with the new Mqtt binding action.
Hello,
i have the following problem after migrating to mqtt Binding v2:
The State of a Switch (ON/OFF) is shown in the Sitemap, even though i didn’t specify it.
Here is my .thing:
Thing topic sonoff2 "MQTT Sonoff 2" {
Channels:
Type number : mqttSonoff2RSSI "Empfangsstärke" [ stateTopic="tele/sonoff2/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
Type string : mqttSonoff2Time "Time" [ stateTopic="tele/sonoff2/STATE", transformationPattern="JSONPATH:$.Time" ]
Type switch : mqttSonoff2LWT "LWT"[ stateTopic="tele/sonoff2/LWT", on="Online", off="Offline" ]
Type switch : mqttSonoff2Switch1 "Media" [ stateTopic="tele/sonoff2/STATE", transformationPattern="JSONPATH:$.POWER1",
commandTopic="cmnd/sonoff2/POWER1", on="ON", off="OFF" ]
Type switch : mqttSonoff2Switch2 "XBox" [ stateTopic="tele/sonoff2/STATE", transformationPattern="JSONPATH:$.POWER2",
commandTopic="cmnd/sonoff2/POWER2", on="ON", off="OFF" ]
}
I’m sorry, I still do not understand it:
I have both versions (v1 and v2) of the MQTT binding installed in parallel (although not recommended):
and the item of MQTT v1 works the way I want, item from MQTT v2 returns a different result for the same sitemap syntax?