I need to fire a rule, check witch button is pressed and do something.
I tried with this rule:
rule "Cassa Bose Volume Handling"
when
Item BOSESOUNDDOCK_VOL received command
then
logInfo("CassaBOSE",BOSESOUNDDOCK_VOL.state.toString )
//BOSESOUNDDOCK_VOL.postUpdate("nd")
end
I see in the logs, that sometime, is not sent the button i pressed, but the last one, and I have to press 2 time the command to send the one I want. It happen also enabling the postUpdate, that reset the status.
Is it possible to avoid this?
You are receiving a command in your rule, so to find out what the command was, you would instead use
logInfo("CassaBOSE",receivedCommand.toString)
Unless the default autoupdate is suppressed, at some point after the command was sent the state of the item would be updated. But when triggering a rule on received command, use the predefined receivedCommand to see what it was.