Hallo zusammen,
ich lese den HueMotion Sensor aus um damit bei Bewegungserkennung den Radio über einen Amazon Echo zu starten.
Dazu habe ich eine Rule erstellt, welche bei Bewegung das Radio startet.. das funktioniert auch ohne Probleme.
Hier die Rule:
Nun habe ich lediglich noch das Problem, dass die Musik sofort wieder ausgeschalten wird sobald der HueMotion Sensor keine Bewegung mehr erfasst.
Ich frage den Sensor alle 5 Sekunden ab damit die Musik beim Betreten des Raumes sofort angeht...
Ich dachte da an eine rule mit einer Schleife bzw. einer Verzögerung...?
Hier mein Ansatz:
Ich möchte das Radio erst auschalten wenn innerhalb einer Minute keine Bewegung mehr erfasst wird.
Vielen dank
ich lese den HueMotion Sensor aus um damit bei Bewegungserkennung den Radio über einen Amazon Echo zu starten.
Dazu habe ich eine Rule erstellt, welche bei Bewegung das Radio startet.. das funktioniert auch ohne Probleme.
Hier die Rule:
Code:
[COLOR=#c586c0]rule[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"Start the radio once I enter the bathroom"[/COLOR] [COLOR=#c586c0]when[/COLOR] [COLOR=#569cd6]Item[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#4ec9b0]HueMotion[/COLOR][COLOR=#d4d4d4] changed to [/COLOR][COLOR=#b5cea8]ON[/COLOR] [COLOR=#c586c0]then[/COLOR] [COLOR=#608b4e]// if (EchoDot_RadioStationId.state.toString != '[/COLOR][COLOR=#ce9178]s0000[/COLOR][COLOR=#608b4e]') {[/COLOR] [COLOR=#d4d4d4] [/COLOR][COLOR=#c586c0]if[/COLOR][COLOR=#d4d4d4] ([/COLOR][COLOR=#4ec9b0]EchoDot_Player[/COLOR][COLOR=#d4d4d4].[/COLOR][COLOR=#d4d4d4]state[/COLOR][COLOR=#d4d4d4].[/COLOR][COLOR=#d4d4d4]toString [/COLOR][COLOR=#d4d4d4]!=[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]'PLAY'[/COLOR][COLOR=#d4d4d4]) {[/COLOR] [COLOR=#4ec9b0]EchoDot_RadioStationId[/COLOR][COLOR=#d4d4d4].[/COLOR][COLOR=#d4d4d4]sendCommand([/COLOR][COLOR=#ce9178]'s0000'[/COLOR][COLOR=#d4d4d4])[/COLOR] [COLOR=#d4d4d4] }[/COLOR] [COLOR=#c586c0]end[/COLOR]
Ich frage den Sensor alle 5 Sekunden ab damit die Musik beim Betreten des Raumes sofort angeht...

Ich dachte da an eine rule mit einer Schleife bzw. einer Verzögerung...?
Hier mein Ansatz:
Code:
[COLOR=#c586c0]rule[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"Stop the radio once i leave the bathroom"[/COLOR] [COLOR=#c586c0]when[/COLOR] [COLOR=#d4d4d4] [/COLOR][COLOR=#569cd6]Item[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#4ec9b0]HueMotion[/COLOR][COLOR=#d4d4d4] changed to [/COLOR][COLOR=#b5cea8]OFF[/COLOR] [COLOR=#c586c0]then[/COLOR] [COLOR=#d4d4d4] [/COLOR][COLOR=#4ec9b0]Thread[/COLOR][COLOR=#c586c0]::[/COLOR][COLOR=#d4d4d4]sleep([/COLOR][COLOR=#b5cea8]60000[/COLOR][COLOR=#d4d4d4]) [/COLOR][COLOR=#608b4e]// Warte ein Minute[/COLOR] [COLOR=#d4d4d4] [/COLOR][COLOR=#c586c0]if[/COLOR][COLOR=#d4d4d4] ([/COLOR][COLOR=#4ec9b0]HueMotion[/COLOR][COLOR=#d4d4d4].[/COLOR][COLOR=#d4d4d4]state[/COLOR][COLOR=#d4d4d4]==[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#b5cea8]OFF[/COLOR][COLOR=#d4d4d4]) {[/COLOR] [COLOR=#d4d4d4] [/COLOR][COLOR=#4ec9b0]EchoDot_Player[/COLOR][COLOR=#d4d4d4].[/COLOR][COLOR=#d4d4d4]sendCommand([/COLOR][COLOR=#ce9178]'PAUSE'[/COLOR][COLOR=#d4d4d4])[/COLOR] [COLOR=#d4d4d4] }[/COLOR] [COLOR=#c586c0]end[/COLOR]
Ich möchte das Radio erst auschalten wenn innerhalb einer Minute keine Bewegung mehr erfasst wird.
Vielen dank
Kommentar