Trying hard to learn rules stuff.Want to make Sonos controller turn on reciever when playing.
rule "Sonos plays"
when
Item sonos:CONNECT:RINCON_000E58AACE2201400:control == "Play"
then
marantz_power.sendCommand(ON)
else
marantz_power.sendCommand(OFF)
end
Due to LOG errors i have changed to this
rule “Sonos plays”
when
Item sonos:CONNECT:RINCON_000E58AACE2201400:control == "PLAY"
then
marantz_power.sendCommand(ON) AND
marantz_input.sendCommand(CD)
end
But still have error.
2020-03-08 15:39:51.486 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘hus.rules’ has errors, therefore ignoring it: [94,3]: no viable alternative at input ‘:’
rule "Sonos plays"
when
Item Sonos_stue_Controller received update // or use changed to PLAY
then
if(Sonos_stue_Controller.state == PLAY){
marantz_power.sendCommand(ON)
marantz_input.sendCommand("CD") // not sure about the CD part??
}
end
@BDE I see you have another post about rules. I recommend starting small with one or two items first. Then expand with more rules after you get a better understanding of how to write them.
Now it looks like this. No log errors ,but reciever doesnt turn on
when
Item Sonos_stue_Controller received update PLAY
then
if(Sonos_stue_Controller.state == PLAY){
marantz_power.sendCommand(ON)
marantz_input.sendCommand("CD")
}
end
2020-03-08 16:35:04.084 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PLAY to PAUSE
2020-03-08 16:35:05.520 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PAUSE to UNDEF
2020-03-08 16:35:07.098 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from UNDEF to PLAY
2020-03-08 16:35:20.750 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_currentartist changed from Isam B to Burhan G
2020-03-08 16:35:20.755 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_currentalbum changed from Lost For Words to Pas På Pigerne
2020-03-08 16:35:20.757 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_currenttitle changed from Life to Nathalia
2020-03-08 16:35:20.762 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PLAY to PAUSE
2020-03-08 16:35:21.011 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PAUSE to UNDEF
2020-03-08 16:35:21.772 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_currentalbumart changed from raw type (image/jpeg): 52024 bytes to raw type (image/jpeg): 73920 bytes
2020-03-08 16:35:23.712 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from UNDEF to PAUSE
2020-03-08 16:35:23.941 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PAUSE to UNDEF
2020-03-08 16:35:24.927 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from UNDEF to PLAY
2020-03-08 16:35:28.914 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PLAY to PAUSE
2020-03-08 16:35:29.237 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from PAUSE to UNDEF
2020-03-08 16:35:29.860 [vent.ItemStateChangedEvent] - sonos_CONNECT_RINCON_000E58AACE2201400_control changed from UNDEF to PLAY