alias: Alarma !
description: ""
trigger:
- platform: template
value_template: |-
automation:
trigger:
platform: time
at:
- "07:00:00"
condition:
- condition: time
weekday:
- sat
- sun
- platform: template
value_template: |-
automation:
trigger:
platform: time
at:
- "06:20:00"
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
condition:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.alarma
state: "on"
action:
- service: media_player.play_media
target:
entity_id: media_player.tv_office
data:
media_content_id: media-source://radio_browser/70d48cfd-eedd-400a-8b7a-881e7015fc3f
media_content_type: audio/aac
metadata:
title: Radio Zu
thumbnail: https://radiozu.ro/favicon-96x96.png
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://radio_browser
- media_content_type: music
media_content_id: media-source://radio_browser/country/RO
mode: single
Either use the UI automation editor or read the documentation on how to write triggers in YAML:
What needs fixing?
The trigger yaml in the original post is vastly incorrect.
alias: Alarma
description: ""
trigger:
- platform: time
at: "07:00:00"
variables:
is_day: "{{ now().isoweekday() in [6, 7] }}"
- platform: time
at: "06:20:00"
variables:
is_day: "{{ now().isoweekday() <= 5 }}"
condition:
- "{{ is_state('input_boolean.alarma', 'on') }}"
- "{{ is_day }}"
action:
- service: media_player.play_media
target:
entity_id: media_player.tv_office
data:
media_content_id: media-source://radio_browser/70d48cfd-eedd-400a-8b7a-881e7015fc3f
media_content_type: audio/aac
metadata:
title: Radio Zu
thumbnail: https://radiozu.ro/favicon-96x96.png
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://radio_browser
- media_content_type: music
media_content_id: media-source://radio_browser/country/RO
mode: single
1 Like
Sorry we posted at more or less the same time, I was asking the OP who didn’t tell us