Hi,
If have a KNX switch in one of the rooms which I want to use to turn on/off several media devices at once.
These devices are:
- A Denon Receiver;
- A ChromeCast;
- An Epson projector (controlled via infrared (IRtrans);
Since my projector is controlled via infrared, I can not get a reliable status of the device. OpenHAB does not know if it is turned on or off. So my assumption is: if my Chromecast has status “playing” my projector is turned on (using HDMI-CEC, the Chromecast automatically turns on my projector).
I’m trying to turn that into a rule, but have not been successfull. This is the rule:
rule "Play/Pause Many devices"
when
Item KNX_EV_Ontspanningsruimte_DenonAVR_10_3_0 changed from ON to OFF
then
if (Denon_EV_Ontspanningsruimte_Power.state == ON) {
if (Chromecast_GV_Living.state.toString == "PLAY") {
sendCommand(IRtrans_EV_Ontspanningsruimte_Projector_PlayPause, OFF)
Thread::sleep(1000)
sendCommand(Chromecast_EV_Ontspanningsruimte, PAUSE)
Thread::sleep(1000)
sendCommand(IRtrans_EV_Ontspanningsruimte_Projector_Stop, ON)
Thread::sleep(1000)
sendCommand(IRtrans_EV_Ontspanningsruimte_Projector, ON)
Thread::sleep(1000)
sendCommand(IRtrans_EV_Ontspanningsruimte_Projector, ON)
Thread::sleep(1000)
sendCommand(Denon_EV_Ontspanningsruimte_Power, OFF)
} else {
sendCommand(Denon_EV_Ontspanningsruimte_Power, OFF)
}
} else {
/* Do Nothing */
}
end
Regardless of the actual status of the ChromeCast, the "Chromecast_GV_Living.state.toString == “PLAY” statement never seems to be TRUE.
Is there another way to check the status of my Chromecast (in a rule)?
PS: The “Thread::sleep(1000)” lines are added to allow me to “see” each command being executed in the room. They will be removed (or if needed: reduced in time) eventually.
[Edit]
Ignore this silly question. I just used the wrong item-name in my rule. The rule code is fine.
[/edit]