I looked on he forum, this sould have workt but it doesnt ,also tried “or” instead of “||”
An idea?
rule “SonosMB_on”
when
Item SonosConnectMasterBedroom_State changed to PLAYING
then
BEDROOMAVReceiverHC_Zone1_Power.sendCommand(ON)
BEDROOMAVReceiverHC_Zone1_InputSource.sendCommand(“01”)
BEDROOMAVReceiverHC_Zone1_Volume.sendCommand(-10)
end
rule “SonosMB_off”
when
Item SonosConnectMasterBedroom_State changed to STOPPED || PAUSED_PLAYBACK
then
BEDROOMAVReceiverHC_Zone1_InputSource.sendCommand(“05”)
BEDROOMAVReceiverHC_Zone1_Volume.sendCommand(-40)
end
rule "Basement Light On"
when
Item basement_motion_1 changed from OFF to ON or Item basement_motion_2 changed from OFF to ON
then
basement_light.sendCommand(ON)
// start or reset Timer
Ba
rule “SonosMB_off”
when
Item SonosConnectMasterBedroom_State changed to STOPPED OR
Item SonosConnectMasterBedroom_State changed to PAUSED_PLAYBACK
then
BEDROOMAVReceiverHC_Zone1_InputSource.sendCommand(“05”)
BEDROOMAVReceiverHC_Zone1_Volume.sendCommand(-40)
end
It doesn’t work
2019-10-22 20:52:14.726 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘SonosMB3.rules’ has errors, therefore ignoring it: [12,82]: no viable alternative at input ‘{’
[16,5]: extraneous input ‘}’ expecting ‘end’
Unlikely. Because of the way the interpreter works, the very first run of a rule after loading/editing takes a little longer.
If you have concerns about the rule, add a timer
rule "SonosMB"
when
Item SonosConnectMasterBedroom_State changed
then
val long mstart = now.millis
switch (SonosConnectMasterBedroom_State.state.toString) {
case "PLAYING" : {
BEDROOMAVReceiverHC_Zone1_Power.sendCommand(ON)
BEDROOMAVReceiverHC_Zone1_InputSource.sendCommand("01")
BEDROOMAVReceiverHC_Zone1_Volume.sendCommand(-10)
}
case "STOPPED", case "PAUSED_PLAYBACK" : {
BEDROOMAVReceiverHC_Zone1_InputSource.sendCommand("05")
BEDROOMAVReceiverHC_Zone1_Volume.sendCommand(-40)
}
}
val long mstop = now.millis
logInfo("SonosMB", "The Rule took " + (mstop - mstart) + " ms to run")
end
Probably more revealing is keeping an eye on your events.log - when did OH see the trigger condition, when are the commands sent?