Hey there,
I want to turn off the Tunen via Alexa at a specific time. Further, the volume should fade in. At another specific time, the radio should turn off by selecting ’ ’ as Echo_ueberall_RadioStationId.
Here’s my rule:
var int value = 0
rule "rule 1"
when
Time cron "30 26 6 ? * MON,TUE,WED,THU,FRI *"
then
if(present.state == ON){
Echo_ueberall_Radio.sendCommand("ON")
Thread::sleep(1000)
Echo_ueberall_RadioStationId.sendCommand('s272334')
Thread::sleep(1000)
Echo_ueberall_Player.sendCommand('play')
while(value<=45){
sendCommand(Echo_Wohnzimmer_Volume_default, value)
sendCommand(Echo_Badezimmer_Volume_default, value)
sendCommand(Echo_Kueche_Volume_default, value)
sendCommand(Echo_Schlafzimmer_Volume_default, value)
Thread::sleep(1200)
value=value+3
}
value=0
}
end
rule "rule 2"
when
//Item dummy received command
Time cron "10 15 8 ? * MON,TUE,WED,THU,FRI *"
then
Echo_ueberall_RadioStationId.sendCommand('')
end
The strange is that the music goes on as declared an it goes off as declared, but when turning off it goes on again, so: 6:26:30 AM: rule 1 turns music on, 8:15:10 AM: rule 2 turns music off AND triggers rule 1, so the music starts again. I added a random item and wrote it in the rule 1 to see if the rule is triggerd and it is. The strange (or: As it should be): remove the comment out in rule 2 and control the rule with the item “dummy”, everything works find.
Where’s my thinking error ?