Hi HA Community
I have an Automation that works but with one very annoying problem that only was introduced when I introduced a script to turn on my Alex to play a radio station. The annoying bit is that every time the automation is re-triggered Alex, stops playing for a second and then continues, as the script is saying go and play this station even though it was playing it!
The automation is quite simple, Turn on Kitchen lights when triggered by the Kitchen PIR sensor, and remain on until a delay expires and turn off. The ‘restart’ attribute is used to keep the light on if people are triggering the PIR.
The automation is as follows.
alias: Kitchen
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.kitchen_pir
from: "off"
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
condition: []
action:
- parallel:
- service: switch.turn_on
data: {}
target:
entity_id: switch.kitchen_lights
- service: script.alexavirginradio
data: {}
- delay:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.kitchen_lights
- service: media_player.media_stop
data: {}
target:
entity_id: media_player.christopher_s_echo
mode: restart
and the script is.
alexavirginradio:
sequence:
- service: media_player.volume_set
data:
entity_id: media_player.christopher_s_echo
volume_level: 0.1
- delay: 00:00:00
- data:
entity_id: media_player.christopher_s_echo
media_content_id: play virgin radio uk
media_content_type: custom
service: media_player.play_media
I have tried creating booleans and timers but could not get it to run the Alexa script once even if Kitchen PIR is re-triggered.
Any guidance please?