Play Radio on weekdays
Home Assistant Automation
This automation starts the Alexa in the Kitchen in the morning on weekdays when the kitchen is first entered.
It uses the last automation run time to see if it has been previously run on the current morning to prevent it being run again.
alias: Play Radio 2 in the Morning
description: ''
trigger:
- platform: state
entity_id: input_boolean.kitchen_motion
to: 'on'
condition:
- condition: time
after: '07:00:00'
before: '09:00:00'
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: template
value_template: >
{{ (as_timestamp(now()) -
as_timestamp(states.automation.play_radio_2_in_the_morning.attributes.last_triggered
| default(0)) | int > 7200)}}
action:
- service: media_player.play_media
data:
entity_id: media_player.flex_kitchen
media_content_id: radio 2
media_content_type: custom
mode: single