Hi,
I have a problem with MQTT Binding since i have updated from 2.4 stable to 2.5.0.M5:
Foreword:
I’m using it for communicating with my vacuum cleaner inspired by this post:
Everything worked fine on OH 2.4 stable. Now I updated to 2.5.0.M5 and the solution stopped working correctly.
What I have:
OH 2.5.0.M5 running on a Windows machine
Things file:
Bridge mqtt:broker:roomba "Roomba" @ "Cleaner" [ clientID="MyClientId", host="192.168.178.44", port=8883, secure=true,
username="MyClientId", password="MyPassword",
certificatepin=true, publickeypin=true ]
{
Thing topic state "Roomba state" @ "Cleaner" {
Channels:
Type string : wifistat "WiFi" [ stateTopic="wifistat" ]
Type string : shadow "Status" [ stateTopic="$aws/things/3162831022440790/shadow/#" ]
}
}
Items:
String RoombaWifistatJSON "Roomba WiFi [%s]" { channel="mqtt:topic:roomba:state:wifistat" }
String RoombaShadowJSON "Roomba State [%s]" { channel="mqtt:topic:roomba:state:shadow" }
String RoombaBinPresent "Bin present [%s]" (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
String RoombaBinFull "Bin full [%s]" <cistern> (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
Switch RoombaDocked "Roomba docked [%s]" <switch> (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
Switch RoombaDock "Dock Roomba [%s]" <switch> (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
Switch RoombaClean "Roomba StartStop [%s]" <switch> (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
String RoombaCleaningPhase "Roomba cleaning phase [MAP(CleaningPhase_DE.map):%s]" (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
Dimmer RoombaBatLevel "Roomba BatLevel [%d]" <dimmer> (G_Roomba, G_RrEvCh, G_RrEvMin, G_JdEvCh)
And in the rules file for outgoing commands
val RoombaActions = getActions("mqtt", "mqtt:broker:roomba")
// Commands: "start", "stop", "pause", "resume", "dock"
val GetCommandJSON = [ String command |
String::format("{\"command\":\"%s\",\"time\":%d,\"initiator\":\"localApp\"}", command, now.millis / 1000)
]
rule "RoombaDockReceivedCommand"
when
Item RoombaDock received command ON
then
RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("dock"))
end
There are also rules for incoming info, but i don’t list it here, because everything seems to be fine with that.
Now the problem:
The way from my vacuum cleaner to OpenHAB works as expected. Data (JSON String) is delivered to item RoombaShadowJSON
or RoombaWifistatJSON
and processed in my “incoming” rules.
But when I set an item for outgoing commands like RoombaDock
it is processed in my “outgoing” rule correctly but the command publishMQTT
fails.
In the logs:
2019-12-05 13:51:38.563 [WARN] [nhab.binding.mqtt.action.MQTTActions] - MQTT publish to cmd failed!
Now I have no idea what’s the cause.
Already done:
- Restarted OH
- Uninstalled and reinstalled MQTT Binding
- Edited *.items, *.rules and *.things files in order to be reinitialized
- cleared tmp and Cache Folders
Is there a way to better debug this? I set log Level to [DEBUG] for mqtt. But there is no more info in openhab.log.