I think I might know the problem.
Your Zigbee2mqtt sent this:
{"action":"single_left","battery":100,"device_temperature":29,"linkquality":165,"power_outage_count":164,"voltage":3005}
But your Openhab Thing config expected this:
Type string : action [ stateTopic="zigbee2mqtt/schakelaar_50/action" ]
I have two suggestions for you:
- Change Zigbee2mqtt config output: attribute:
advanced:
output: attribute
That should solve the problem.
- This is something I only learned muuuuuch too late in the game.
Change your Things config to addpostCommand=true
just for theaction
one, like this:
Type string : action [ stateTopic="zigbee2mqtt/schakelaar_50/action", postCommand=true ]
And in your rule, you should trigger on received command
rule "xxx"
when
Item schakelaar_50action received command
then
....
end
For years I didn’t know this trick - well because I hadn’t read the docs properly, and I used “updated”, then “changed” and had to resort to trickery to fight a behaviour where when something reloaded (e.g. the .things file refreshed), my item would get an update even though the actual button wasn’t pressed. The postCommand
solved that issue.
Oh one more:
Have a look at JSScripting and JRuby for your scripting.