# ============================================================================= # Timer Finished Automations # ============================================================================= # These automations call the ESPHome device's timer_finished service when # the HA timer entity finishes. This triggers the alarm on the device. # # Import via automation: !include automations.yaml # Or copy individual automations into your existing automations.yaml # # IMPORTANT: The entity_id in the service call must match your ESPHome device's # name in Home Assistant. The format is: esphome._timer_finished # # Naming convention: # - Timer entity: timer. (e.g., timer.kitchen) # - ESPHome device: _voice_assistant (e.g., kitchen_voice_assistant) # - Service call: esphome._voice_assistant_timer_finished # # To add a new area: # 1. Copy one of the automation blocks below # 2. Change the alias and unique_id # 3. Update the trigger entity_id to your timer entity # 4. Update the service call to match your ESPHome device name # ============================================================================= # ----------------------------------------------------------------------------- # Kitchen Timer Finished # ----------------------------------------------------------------------------- - alias: "Timer: Kitchen Timer Finished" id: timer_kitchen_finished description: "Trigger alarm on kitchen voice assistant when timer finishes" mode: single trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.kitchen condition: [] action: - service: esphome.kitchen_voice_assistant_timer_finished data: {} # ----------------------------------------------------------------------------- # Bedroom Timer Finished # ----------------------------------------------------------------------------- - alias: "Timer: Bedroom Timer Finished" id: timer_bedroom_finished description: "Trigger alarm on bedroom voice assistant when timer finishes" mode: single trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.bedroom condition: [] action: - service: esphome.bedroom_voice_assistant_timer_finished data: {} # ----------------------------------------------------------------------------- # Playroom Timer Finished # ----------------------------------------------------------------------------- - alias: "Timer: Playroom Timer Finished" id: timer_playroom_finished description: "Trigger alarm on playroom voice assistant when timer finishes" mode: single trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.playroom condition: [] action: - service: esphome.playroom_voice_assistant_timer_finished data: {} # ============================================================================= # Optional: Timer Started/Cancelled Notifications # ============================================================================= # These automations notify the ESPHome device when timers start or are cancelled. # This enables faster display updates without waiting for sensor polling. # ============================================================================= # ----------------------------------------------------------------------------- # Kitchen Timer Started (Optional - for faster display update) # ----------------------------------------------------------------------------- - alias: "Timer: Kitchen Timer Started" id: timer_kitchen_started description: "Notify kitchen voice assistant when timer starts" mode: single trigger: - platform: state entity_id: timer.kitchen to: "active" condition: [] action: - service: esphome.kitchen_voice_assistant_timer_started data: duration: > {% set dur = state_attr('timer.kitchen', 'duration') %} {% if dur %} {% set parts = dur.split(':') %} {{ (parts[0] | int) * 3600 + (parts[1] | int) * 60 + (parts[2] | float | int) }} {% else %} 0 {% endif %} # ----------------------------------------------------------------------------- # Bedroom Timer Started (Optional) # ----------------------------------------------------------------------------- - alias: "Timer: Bedroom Timer Started" id: timer_bedroom_started description: "Notify bedroom voice assistant when timer starts" mode: single trigger: - platform: state entity_id: timer.bedroom to: "active" condition: [] action: - service: esphome.bedroom_voice_assistant_timer_started data: duration: > {% set dur = state_attr('timer.bedroom', 'duration') %} {% if dur %} {% set parts = dur.split(':') %} {{ (parts[0] | int) * 3600 + (parts[1] | int) * 60 + (parts[2] | float | int) }} {% else %} 0 {% endif %} # ----------------------------------------------------------------------------- # Playroom Timer Started (Optional) # ----------------------------------------------------------------------------- - alias: "Timer: Playroom Timer Started" id: timer_playroom_started description: "Notify playroom voice assistant when timer starts" mode: single trigger: - platform: state entity_id: timer.playroom to: "active" condition: [] action: - service: esphome.playroom_voice_assistant_timer_started data: duration: > {% set dur = state_attr('timer.playroom', 'duration') %} {% if dur %} {% set parts = dur.split(':') %} {{ (parts[0] | int) * 3600 + (parts[1] | int) * 60 + (parts[2] | float | int) }} {% else %} 0 {% endif %} # ----------------------------------------------------------------------------- # Timer Cancelled Notifications # ----------------------------------------------------------------------------- - alias: "Timer: Kitchen Timer Cancelled" id: timer_kitchen_cancelled description: "Notify kitchen voice assistant when timer is cancelled" mode: single trigger: - platform: state entity_id: timer.kitchen to: "idle" from: - "active" - "paused" condition: [] action: - service: esphome.kitchen_voice_assistant_timer_cancelled data: {} - alias: "Timer: Bedroom Timer Cancelled" id: timer_bedroom_cancelled description: "Notify bedroom voice assistant when timer is cancelled" mode: single trigger: - platform: state entity_id: timer.bedroom to: "idle" from: - "active" - "paused" condition: [] action: - service: esphome.bedroom_voice_assistant_timer_cancelled data: {} - alias: "Timer: Playroom Timer Cancelled" id: timer_playroom_cancelled description: "Notify playroom voice assistant when timer is cancelled" mode: single trigger: - platform: state entity_id: timer.playroom to: "idle" from: - "active" - "paused" condition: [] action: - service: esphome.playroom_voice_assistant_timer_cancelled data: {}