Hey everyone, just need some advice here. I pulled some code from
AlexaCuckoo/Alexa_Cuckoo_Clock.yaml at bc87b7629280d62a5d869f96f5f4dc8e889cfbce · Didgeridrew/AlexaCuckoo · GitHub in order to get this working with Alexa Media, but I’m running into what feels like endless errors and the final section is what’s killing it.
Here’s the original code:
#automations.yaml
- alias: Alexa - Notify - Cuckoo Clock
trigger:
- platform: time_pattern
minutes: '30'
- platform: time_pattern
minutes: '0'
condition:
- condition: time
after: '08:59:00'
before: '20:31:00'
- condition: or
conditions:
- condition: state
entity_id: group.family
state: home
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
action:
- choose:
- conditions: >-
{% set ns = namespace(volumes = []) %}
{% for s in ['media_player.living_room_dot', 'media_player.basement_dot'] %}
{% set x = is_state_attr(s, 'volume_level', 0.3) %}
{% set ns.volumes = ns.volumes + ['{}'.format(x)] %}
{% endfor %}
{{ 'False' in ns.volumes }}"
sequence:
- service: media_player.volume_set
data:
entity_id:
- media_player.living_room_dot
- media_player.basement_dot
volume_level: 0.3
- delay: 3
- service: notify.alexa_media
data:
message: '{{cuckoos}}'
target:
- media_player.basement_dot
- media_player.living_room_dot
data:
type: tts
mode: restart
variables:
cuckoos: >-
{% if now().strftime(\"%M\")|int == 30 %}
{{"<audio src='https://***YOUR_IP_HERE***/local/mp3/config-sounds-cuckoo-clock-01.mp3'/>\"}}
{% else %}
{{"<audio src='https://***YOUR_IP_HERE***/local/mp3/config-sounds-cuckoo-clock-\" + now().strftime(\"%I\") + \".mp3'/>\"}}
{% endif %}"
Here’s my altered version so far:
automation:
- alias: Alexa - Notify - Cuckoo Clock
trigger:
- platform: time_pattern
minutes: '30'
- platform: time_pattern
minutes: '0'
condition:
- condition: time
after: '08:59:00'
before: '20:31:00'
action:
- choose:
- conditions: >-
{% set ns = namespace(volumes = []) %}
{% for s in ['media_player.living_room_show', 'media_player.kitchen_flex'] %}
{% set x = is_state_attr(s, 'volume_level', 0.3) %}
{% set ns.volumes = ns.volumes + ['{}'.format(x)] %}
{% endfor %}
{{ 'False' in ns.volumes }}"
sequence:
- service: media_player.volume_set
data:
entity_id:
- media_player.living_room_show
- media_player.kitchen_flex
volume_level: 0.3
- delay: 3
- service: notify.alexa_media
data:
message: '{{cuckoos}}'
target:
- media_player.kitchen_flex
- media_player.living_room_show
data:
type: tts
mode: restart
variables:
cuckoos: >-
{% if now().strftime("%M")|int == 30 %}
{{ "<audio src='https://HAInstance/local/mp3/config-sounds-cuckoo-clock-01.mp3'/>\" }}
{% else %}
{{ "<audio src='https://HA Instance/local/mp3/config-sounds-cuckoo-clock-\ + now().strftime("%I") + \.mp3'/>\" }}
{% endif %}"
And the log error plauguing me:
There are 12 audio files it calls from (from 1 chime to 12), if it helps make sense of it.
Any help would be greatly appreciated