abasel
(Andre)
1
I have the below which broadcasts a message when a phone rings. How do I change it so that it repeats the message as long as the phone rings?
alias: Ringing Phone - Fred
description: ""
triggers:
- trigger: state
entity_id:
- sensor.sm_g780f_phone_state
to: ringing
conditions: []
actions:
- action: notify.alexa_media
metadata: {}
data:
target: media_player.room1_dot,media_player.room2_dot
message: Fred, your phone is ringing
mode: single
abasel
(Andre)
2
Using ChatGPT I got the below which works (plus added some other bits). The solution was a WHILE loop.
alias: Ringing Phone - Fred
description: ""
triggers:
- entity_id:
- sensor.sensor.sm_g780f_phone_state_2
to: ringing
trigger: state
conditions:
- condition: zone
entity_id: person.Fred
zone: zone.myzone
actions:
- data:
volume_level: 1
target:
entity_id:
- media_player.kitchen_dot
- media_player.office_dot
action: media_player.volume_set
- repeat:
while:
- condition: state
entity_id: sensor.sm_g780f_phone_state
state: ringing
sequence:
- data:
target:
- media_player.kitchen_dot
- media_player.office_dot
message: Peter, your phone is ringing
action: notify.alexa_media
- delay: 5
- data:
volume_level: 0.46
target:
entity_id:
- media_player.kitchen_dot
- media_player.office_dot
action: media_player.volume_set
mode: single