I try to create a rule to pause and play a sonos device using wireless switch.
I’m using the same rule for turning on and off lights, and that is working OK.
Shouldn’t this work?
rule "SonosToalett"
when
Item E1_Toalett_Bryter_Venstre_Contact changed
then
if (E1_Toalett_Bryter_Venstre_Contact.state == OPEN) {
sendCommand(E1_Toalett_Media_Sonos_Control,PLAY)
}
if (E1_Toalett_Bryter_Venstre_Contact.state == CLOSED) {
sendCommand(E1_Toalett_Media_Sonos_Control,PAUSE)
}
end
For the Player item there should also be an entry in the log, like this: 2017-01-03 18:59:48.223 [ItemStateChangedEvent ] - LVPanasonicAll30Control changed from PLAY to PAUSE
What happens if you insert a log as the first line of the rule? Like this: logWarn("SonosToalett.rule", "SonosToalett rule has been triggered")
Are your items defined in a *.items file or directly via PaperUI?
Do you maybe have two rules with the same name? This also causes trouble in my experience.
Seems like the rule is not called if even the logWarn is not displayed in the logs. Then again, the rule works if you trigger a light… what happens if you trigger a light and put the logWarn into the first line?
I guess you know there are two log files, the openhab.log and the events.log. Make sure to check the openhab.log for the manually inserted log statements.