didn’t waste my time, I wouldn’t have tried any of this otherwise
1 Like
I guess for completeness Here is the automation I ultimately ended up using - which has almost nothing to do with the original stuff above:
- alias: TTS Announce My Alarm Needs Set for Dayshift
trigger:
- platform: time
at:
- '22:45:00'
- '23:00:00'
- '23:15:00'
condition:
- condition: template
value_template: >
{% set no_alarm_set = is_state('sensor.my_mobile_app_next_alarm', 'unavailable') %}
{% set next_work_days = is_state_attr('calendar.my_gmail_com', 'message', 'days') %}
{% set next_work_dd = is_state_attr('calendar.my_gmail_com', 'message', 'DD - support') %}
{% set within_work_window = ( as_timestamp( state_attr('calendar.my_gmail_com', 'start_time')) - as_timestamp(now()) < 86400 )
and ( as_timestamp( state_attr('calendar.my_gmail_com', 'end_time')) - as_timestamp(now()) > 43200 ) %}
{{ no_alarm_set and within_work_window and (next_work_days or next_work_dd) }}
action:
- service: notify.alexa_media
data:
target:
- media_player.computer_room_dot
- media_player.kitchen_dot
- media_player.master_bedroom_dot
data:
type: tts
message: "You have work tomorrow and your alarm isn't set"