Questions and Issues with Automation->Script Workflows

Context
My automations and scrips were a mess for a long time, I had some functionality happening fully in automations and other automations triggering scripts that had the functionality.
A few weeks ago I had the idea to consolidate my setup so that it was consistent. I used the VS-Code Addon to download the yml files for my automations, scenes and scripts and then put them in to Claude to restructure them.
This mostly worked, although a few are having issues, possibly due to missing devices in their flows, and so I’m not sure if I’ve over-complicated the whole thing; so I’m looking for a second opinion. I’m not sure if I’m bordering, or am actually in, the land of templating.

Goal
What I’m trying to do is have my:

  • automations be purely for triggers with no logic of what actions actually get performed
  • scripts be the logic of which checks need to be performed (although this may be better in the automation?) and be where the actions get performed
  • scenes be where I tell scripts which state a device should be in, like a blind being at 50% or a light being at 15%

I’m happy to provide screenshots or any other information if helpful.
I’ve included my configuration files below as seperate posts due to charcter limits.

Automations

- id: '1714342377591'
  alias: Lights - Teagans Room Toggle
  description: Toggle main lights in Teagan's room via remote button
  trigger:
  - device_id: 3ecd911876fb2cf8aa95db0746814782
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
  condition: []
  action:
  - parallel:
    - type: toggle
      device_id: 03f5d6473d444d3c4dd78e2ba603f837
      entity_id: f5de4d36cf23168388bf51322a0b558c
      domain: light
    - type: toggle
      device_id: 6846da173324c03a7a51fd9346506158
      entity_id: b7421efc4179d31d9961f1449a39e66c
      domain: light
  mode: single
- id: '1714342559021'
  alias: Lights - Teagans Desk Toggle (Offline Trigger)
  description: Toggle desk lamp when button goes offline
  trigger:
  - device_id: 622cc6dacbff26e47e48bf45f8e85b4b
    domain: zha
    platform: device
    type: device_offline
    subtype: device_offline
  condition: []
  action:
  - type: toggle
    device_id: cccc18e1fcf1697ff6bb981b5372c1db
    entity_id: f10764bbbf0ac2c060f4d4910b4377de
    domain: light
  mode: single
- id: '1714342638581'
  alias: Lights - Teagans Office Turn On
  description: Turn on lights in Teagan's office via remote button
  trigger:
  - device_id: cb044396d5b4d6b7f21b0a2ae8a90636
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
  condition: []
  action:
  - service: script.room_teagans_office_lights_on
    data: {}
  mode: single
- id: '1717020255136'
  alias: Lights - Teagans Office Turn Off
  description: Turn off lights in Teagan's office via remote button
  trigger:
  - device_id: cb044396d5b4d6b7f21b0a2ae8a90636
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
  condition: []
  action:
  - service: script.room_teagans_office_lights_off
    data: {}
  mode: single
- id: '1714674755943'
  alias: Lights - Kitchen Turn On
  description: Turn on kitchen lights via remote button
  triggers:
  - device_id: 7541e1b34e4234fb7896608ab13ed00b
    domain: zha
    type: remote_button_short_press
    subtype: turn_on
    trigger: device
  conditions: []
  actions:
  - service: script.room_kitchen_lights_on
    data: {}
  mode: single
- id: '1714675046652'
  alias: Lights - Kitchen Dim Main
  description: Dim kitchen main light via long press
  trigger:
  - device_id: 7541e1b34e4234fb7896608ab13ed00b
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: turn_on
  condition: []
  action:
  - service: light.turn_on
    target:
      entity_id: light.kitchen_snug_main_light
    data:
      brightness_step_pct: -25
  mode: single
- id: '1714675139840'
  alias: Lights - Kitchen Turn Off
  description: Turn off kitchen lights via remote double press
  triggers:
  - device_id: 7541e1b34e4234fb7896608ab13ed00b
    domain: zha
    type: remote_button_double_press
    subtype: turn_on
    trigger: device
  conditions: []
  actions:
  - data: {}
    action: script.room_kitchen_lights_off
  mode: single
- id: '1714676167897'
  alias: Lights - Living Room Toggle
  description: Toggle living room lights via remote button
  trigger:
  - device_id: 622cc6dacbff26e47e48bf45f8e85b4b
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
  condition: []
  action:
  - parallel:
    - type: toggle
      device_id: 4367ef5a4b671807dc23524973e03679
      entity_id: 87cbba1b42ac04bf1c95113beb548320
      domain: switch
    - type: toggle
      device_id: eba5ece3705b313cd52ea9d5b87751ae
      entity_id: 6b1c5aa99607ab5d5d853af9c4a7c15c
      domain: switch
  mode: single
- id: '1732570514425'
  alias: Lights - Hallway Manual On
  description: Turn on hallway lights via remote button
  triggers:
  - device_id: df7929a117cb7a17b356f62f6eb75927
    domain: zha
    type: remote_button_short_press
    subtype: open
    trigger: device
  conditions: []
  actions:
  - service: script.time_hallway_lights_by_time
    data: {}
  mode: single
- id: '1732570571176'
  alias: Lights - Hallway Manual Off
  description: Turn off hallway lights via remote button
  triggers:
  - device_id: df7929a117cb7a17b356f62f6eb75927
    domain: zha
    type: remote_button_short_press
    subtype: close
    trigger: device
  conditions: []
  actions:
  - service: script.room_hallway_lights_off
    data: {}
  mode: single
- id: '1716933899763'
  alias: Controls - Teagans Bedside Remote
  description: Handle all bedside remote button actions
  triggers:
  - device_id: 9395276e3dc027450d3951c1a2d13803
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
  - device_id: 9395276e3dc027450d3951c1a2d13803
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
  - device_id: 9395276e3dc027450d3951c1a2d13803
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: dim_up
  - device_id: 9395276e3dc027450d3951c1a2d13803
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: dim_down
  conditions: []
  actions:
  - service: script.controls_teagans_bedside_actions
    data:
      action: '{{ trigger.subtype }}'
  mode: single
- id: '1714346656025'
  alias: Routine - Morning Teagans Room Wakeup
  description: Morning routine to wake up Teagan's room
  trigger:
  - platform: time
    at: 07:45:00
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.morning_teagans_room_wakeup
  - service: media_player.play_media
    target:
      entity_id: media_player.teagan_s_room_speaker
    data:
      media_content_id: ''
      media_content_type: ''
    metadata: {}
  mode: single
- id: '1714512845583'
  alias: Routine - Morning Teagans Room Cleanup
  description: Morning routine to turn off lights and tidy up
  triggers:
  - at: 09:30:00
    trigger: time
  conditions: []
  actions:
  - service: script.room_teagans_room_off
    data: {}
  mode: single
- id: '1732570885216'
  alias: Routine - Evening Hallway Lights
  description: Turn on hallway lights at sunset
  triggers:
  - trigger: sun
    event: sunset
    offset: 0
  conditions: []
  actions:
  - service: script.time_hallway_lights_by_time
    data: {}
  mode: single
- id: '1732570968098'
  alias: Routine - Morning Hallway Lights
  description: Turn off hallway lights at sunrise
  triggers:
  - trigger: sun
    event: sunrise
    offset: 0
  conditions: []
  actions:
  - service: script.room_hallway_lights_off
    data: {}
  mode: single
- id: '1735056234539'
  alias: Routine - Evening Electric Blanket On
  description: Turn on electric blanket in the evening
  triggers:
  - trigger: time
    at: '22:00:00'
  conditions: []
  actions:
  - service: script.device_electric_blanket
    data:
      state: 'on'
  mode: single
- id: '1735056322538'
  alias: Routine - Night Electric Blanket Off
  description: Turn off electric blanket before midnight
  triggers:
  - trigger: time
    at: '23:55:00'
  conditions: []
  actions:
  - service: script.device_electric_blanket
    data:
      state: 'off'
  mode: single
- id: '1735237754387'
  alias: Routine - Night Speakers Mode
  description: Configure speakers for nighttime
  triggers:
  - trigger: time
    at: '23:00:00'
  conditions: []
  actions:
  - type: turn_off
    device_id: 56a70ae94c0b0899f38396f8e11c8f3e
    entity_id: 416f643f80279b7f4949a8680c968c07
    domain: switch
  - type: turn_on
    device_id: 56a70ae94c0b0899f38396f8e11c8f3e
    entity_id: a90d5047a98449e10a725fc6320ac68e
    domain: switch
  - type: turn_on
    device_id: fd5ea48bfa83cfd059784f9d034320ff
    entity_id: 24a4fca13a1c1ab033918a33a8c32b4e
    domain: switch
  mode: single
- id: '1735237826146'
  alias: Routine - Morning Speakers Mode
  description: Configure speakers for daytime
  triggers:
  - trigger: time
    at: 07:00:00
  conditions: []
  actions:
  - type: turn_on
    device_id: 56a70ae94c0b0899f38396f8e11c8f3e
    entity_id: 416f643f80279b7f4949a8680c968c07
    domain: switch
  - type: turn_off
    device_id: 56a70ae94c0b0899f38396f8e11c8f3e
    entity_id: a90d5047a98449e10a725fc6320ac68e
    domain: switch
  - type: turn_off
    device_id: fd5ea48bfa83cfd059784f9d034320ff
    entity_id: 24a4fca13a1c1ab033918a33a8c32b4e
    domain: switch
  mode: single
- id: '1733312391142'
  alias: Security - Driveway Camera Events
  description: Handle all security events from the driveway camera
  triggers:
  - trigger: state
    entity_id:
    - binary_sensor.reolink_duo_floodlight_wifi_motion
    to: 'on'
  - type: turned_on
    device_id: f77fc0a81aa5636d340269391d1ab9e2
    entity_id: 64ef6c34f6d7c824edddb37f9db4f99e
    domain: binary_sensor
    trigger: device
  conditions: []
  actions:
  - variables:
      event_type: "{% if trigger.entity_id == 'binary_sensor.reolink_duo_floodlight_wifi_motion'
        %}\n  motion\n{% else %}\n  person\n{% endif %}\n"
      notification_types: "{% if trigger.entity_id == 'binary_sensor.reolink_duo_floodlight_wifi_motion'
        %}\n  [\"audio\"]\n{% else %}\n  [\"audio\", \"display\", \"push\"]\n{% endif
        %}\n"
      volume_level: "{% if trigger.entity_id == 'binary_sensor.reolink_duo_floodlight_wifi_motion'
        %}\n  0.6\n{% else %}\n  0.8\n{% endif %}\n"
  - service: script.notify_security_event
    data:
      event_type: '{{ event_type }}'
      camera_name: Driveway
      camera_entity: camera.reolink_duo_floodlight_wifi_fluent
      notification_types: '{{ notification_types }}'
      volume_level: '{{ volume_level }}'
  mode: single
- id: '1744663291060'
  alias: Security - Driveway Motion Light
  description: Light activation on motion detection
  use_blueprint:
    path: homeassistant/motion_light.yaml
    input:
      motion_entity: binary_sensor.reolink_duo_floodlight_wifi_motion
      light_target:
        device_id: f77fc0a81aa5636d340269391d1ab9e2
      no_motion_wait: 3600
- id: '1734975416479'
  alias: Seasonal - Christmas Tree Toggle
  description: Toggle tree lights with remote button
  triggers:
  - device_id: 622cc6dacbff26e47e48bf45f8e85b4b
    domain: zha
    type: remote_button_short_press
    subtype: turn_on
    trigger: device
  conditions: []
  actions:
  - service: script.seasonal_trees_toggle
    data: {}
  mode: single
- id: '1734974554842'
  alias: Seasonal - Fairy Lights Auto On
  description: Turn on fairy lights at sunset and morning
  triggers:
  - trigger: sun
    event: sunset
    offset: '180'
  - trigger: time
    at: 06:30:00
  conditions: []
  actions:
  - service: script.seasonal_fairy_lights
    data:
      state: 'on'
  mode: single
- id: '1734974710778'
  alias: Seasonal - Fairy Lights Auto Off
  description: Turn off fairy lights at sunrise and midnight
  triggers:
  - trigger: sun
    event: sunrise
    offset: '-180'
  - trigger: time
    at: 00:00:00
  conditions: []
  actions:
  - service: script.seasonal_fairy_lights
    data:
      state: 'off'
  mode: single
- id: '1714347061873'
  alias: Maintenance - Low Battery Monitor
  description: Monitor and alert for low battery levels in devices
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor._battery
    below: 15
  condition:
  - condition: template
    value_template: "{% set entity_id = trigger.to_state.entity_id %} {% set exclude_terms
      = ['phone', 'mobile', 'smartphone', 'tablet'] %} {% set is_excluded = false
      %} {% for term in exclude_terms %}\n  {% if term in entity_id %}\n    {% set
      is_excluded = true %}\n  {% endif %}\n{% endfor %} {{ not is_excluded }}\n"
  action:
  - service: script.notify_battery_status
    data:
      entity_id: '{{ trigger.to_state.entity_id }}'
      device_name: '{{ state_attr(trigger.to_state.entity_id, ''friendly_name'') |
        default(trigger.to_state.name) }}'
      battery_level: '{{ trigger.to_state.state }}'
      notification_types:
      - persistent
      - push
      - audio
      target_speakers: media_player.kitchen_2
      volume_level: 0.6
  mode: single
- id: '1746782914867'
  alias: Night night - everything off
  description: ''
  triggers:
  - trigger: time
    at: 00:00:00
  - trigger: time
    at: 02:00:00
  conditions: []
  actions:
  - parallel:
    - type: turn_off
      device_id: 08b17623ec92e22a8db2fd14b9e96aa7
      entity_id: 6dadca7970d9387fe8cb47d09c4fdce2
      domain: switch
    - type: turn_off
      device_id: 31dde6194009eec668ffcf370a761473
      entity_id: 87907cd5733a923af2667630990de6f4
      domain: light
    - type: turn_off
      device_id: 17cf51afeb617d13c5b56c1a55406f66
      entity_id: c93721be28b9b5ccd7dd9510be583aa6
      domain: light
    - type: turn_off
      device_id: f5a2947a51f402ed11228ec290e75a8c
      entity_id: 792758750a5a888d7374d7b689317043
      domain: light
    - type: turn_off
      device_id: bdf5694415ce29b5ba5be3a4727896de
      entity_id: 71f524d180ee8d7bdf65ebcd09267689
      domain: light
    - type: turn_off
      device_id: db50928f4ea5438b0f3a28384d39b229
      entity_id: 330b619b5ce7d3d1d590e67c7b7aed92
      domain: light
  mode: single

Scripts

generic_room_lights_control:
  alias: Generic - Room Lights Control
  fields:
    room:
      description: Room name or area_id
      example: kitchen
    state:
      description: on or off
      example: 'on'
    entities:
      description: List of entity_ids to control
      example: '["light.kitchen_light1", "light.kitchen_light2"]'
  sequence:
  - service: light.turn_{{ state }}
    target:
      entity_id: '{{ entities }}'
  mode: single
  description: Reusable script to control lights in any room
  icon: mdi:home-automation
room_teagans_office_lights_on:
  alias: Room - Teagans Office Lights On
  sequence:
  - service: script.generic_room_lights_control
    data:
      room: teagans_office
      state: 'on'
      entities:
      - light.teagans_office_main_light
      - light.desk_lamp_light
      - switch.usb_lamp_switch
  mode: single
  description: Turn on all lights in Teagan's office
  icon: mdi:home-automation
room_teagans_office_lights_off:
  alias: Room - Teagans Office Lights Off
  sequence:
  - service: script.generic_room_lights_control
    data:
      room: teagans_office
      state: 'off'
      entities:
      - light.teagans_office_main_light
      - light.desk_lamp_light
      - switch.usb_lamp_switch
  mode: single
  description: Turn off all lights in Teagan's office
  icon: mdi:home-automation
room_kitchen_lights_on:
  alias: Room - Kitchen Lights On
  sequence:
  - data:
      room: kitchen
      state: 'on'
      entities:
      - light.snug_lamp_light
      - light.flower_switch
      - light.pink_thing_switch
    action: script.generic_room_lights_control
  mode: single
  description: Turn on all kitchen lights
  icon: mdi:home-automation
room_kitchen_lights_off:
  alias: Room - Kitchen Lights Off
  sequence:
  - data:
      room: kitchen
      state: 'off'
      entities:
      - light.snug_lamp_light
      - light.flower_switch
      - light.pink_thing_switch
    action: script.generic_room_lights_control
  mode: single
  description: Turn off all kitchen lights
  icon: mdi:home-automation
room_hallway_lights_off:
  alias: Room - Hallway Lights Off
  sequence:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      area_id: hallway
  description: Turn off all hallway lights
  icon: mdi:home-automation
room_teagans_room_off:
  alias: Room - Teagans Room Off
  sequence:
  - condition: or
    conditions:
    - condition: device
      type: is_on
      device_id: 03f5d6473d444d3c4dd78e2ba603f837
      entity_id: f5de4d36cf23168388bf51322a0b558c
      domain: light
    - condition: device
      type: is_on
      device_id: 771e45ac5d557c90e0b5f2406576fafe
      entity_id: 4cc33b241e563a4f29a1ae468d43ebc5
      domain: light
    - condition: device
      type: is_on
      device_id: 6846da173324c03a7a51fd9346506158
      entity_id: b7421efc4179d31d9961f1449a39e66c
      domain: light
  - device_id: b452edbedf8ddfbf96b4cec2f07b8f7f
    domain: cover
    entity_id: 99236efbeeb1fd181a29d3f292e5e790
    type: open
  - action: scene.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: scene.teagans_room_all_off_2
  mode: single
  description: Turn off all lights in Teagan's room and open blind
  icon: mdi:home-automation
utility_dry_clothes:
  alias: Utility - Dry Clothes Timer
  sequence:
  - type: turn_on
    device_id: 1f890ccf00dfc2247abb0b8932f6e250
    entity_id: 8f57c67716b27057733c9da0ba26c085
    domain: switch
  - delay:
      hours: 2
      minutes: 0
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 1f890ccf00dfc2247abb0b8932f6e250
    entity_id: 8f57c67716b27057733c9da0ba26c085
    domain: switch
  mode: single
  icon: mdi:tumble-dryer
device_electric_blanket:
  alias: Device - Electric Blanket Control
  fields:
    state:
      description: on or off
      example: 'on'
  sequence:
  - service: switch.turn_{{ state }}
    target:
      device_id: 4367ef5a4b671807dc23524973e03679
  mode: single
  description: Control electric blanket
  icon: mdi:power-socket
seasonal_fairy_lights:
  alias: Seasonal - Fairy Lights Control
  fields:
    state:
      description: on or off
      example: 'on'
  sequence:
  - service: light.turn_{{ state }}
    target:
      label_id: xmas
  description: Control fairy lights
  icon: mdi:string-lights
seasonal_trees_toggle:
  alias: Seasonal - Trees Toggle
  sequence:
  - condition: state
    entity_id: light.tree_one
    state: 'off'
    then:
    - service: light.turn_on
      target:
        label_id: tree_lights
    else:
    - service: light.turn_off
      target:
        label_id: tree_lights
  mode: single
  description: Toggle tree lights on or off
  icon: mdi:pine-tree
time_hallway_lights_by_time:
  alias: Time - Hallway Lights By Time
  sequence:
  - choose:
    - conditions:
      - condition: sun
        after: sunset
      - condition: time
        before: '22:00:00'
      sequence:
      - target:
          entity_id: scene.brightness_hallway_75
        action: scene.turn_on
        data: {}
    - conditions:
      - condition: sun
        after: sunset
      - condition: time
        after: '22:00:00'
      sequence:
      - target:
          entity_id: scene.brightness_hallway_25
        action: scene.turn_on
        data: {}
    - conditions:
      - condition: sun
        after: sunrise
        after_offset: '3600'
      sequence:
      - target:
          entity_id: scene.state_hallway_off
        action: scene.turn_on
        data: {}
    - conditions: []
      sequence:
      - target:
          entity_id: scene.brightness_hallway_75
        action: scene.turn_on
        data: {}
  description: Set hallway lights based on time of day
  icon: mdi:clock-outline
generic_room_brightness:
  alias: Utility - Room Brightness Set
  fields:
    room:
      description: Room name or area_id
      example: kitchen
    brightness:
      description: Brightness percentage
      example: '75'
  sequence:
  - service: light.turn_on
    target:
      area_id: '{{ room }}'
    data:
      brightness_pct: '{{ brightness }}'
  mode: single
  icon: mdi:function
generic_scene_activate:
  alias: Utility - Scene Activate
  fields:
    scene_name:
      description: Scene entity ID
      example: scene.morning_teagans_room_wakeup
  sequence:
  - service: scene.turn_on
    target:
      entity_id: '{{ scene_name }}'
  mode: single
  description: Activate any scene by name
  icon: mdi:function
controls_teagans_bedside_actions:
  alias: Controls - Teagans Bedside Actions
  fields:
    action:
      description: Button action
      example: turn_on
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ action == ''turn_on'' }}'
      sequence:
      - service: light.turn_on
        target:
          entity_id: light.bedside_lamp_light
    - conditions:
      - condition: template
        value_template: '{{ action == ''turn_off'' }}'
      sequence:
      - service: light.turn_off
        target:
          entity_id: light.bedside_lamp_light
    - conditions:
      - condition: template
        value_template: '{{ action == ''dim_up'' }}'
      sequence:
      - device_id: b452edbedf8ddfbf96b4cec2f07b8f7f
        domain: cover
        entity_id: 99236efbeeb1fd181a29d3f292e5e790
        type: open
    - conditions:
      - condition: template
        value_template: '{{ action == ''dim_down'' }}'
      sequence:
      - device_id: b452edbedf8ddfbf96b4cec2f07b8f7f
        domain: cover
        entity_id: 99236efbeeb1fd181a29d3f292e5e790
        type: close
  mode: single
  description: Handle all bedside button actions
  icon: mdi:remote
notify_audio:
  alias: Notify - Audio TTS
  description: Send an audio notification to speakers
  fields:
    message:
      description: Message to announce
      example: Motion detected in the driveway
    target_speakers:
      description: Media players to use
      example: media_player.kitchen_2
    language:
      description: TTS language to use
      example: en-AU
    voice:
      description: TTS voice to use
      example: NatashaNeural
    volume_level:
      description: Volume level for announcement (0.0-1.0)
      example: 0.7
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ volume_level is defined and volume_level != None }}'
      sequence:
      - service: media_player.volume_set
        target:
          entity_id: '{{ target_speakers }}'
        data:
          volume_level: '{{ volume_level }}'
  - service: media_player.play_media
    target:
      entity_id: '{{ target_speakers }}'
    data:
      media_content_id: 'media-source://tts/tts.home_assistant_cloud?message={{ message
        | urlencode }}&language={{ language | default(''en-AU'') }}&voice={{ voice
        | default(''NatashaNeural'') }}

        '
      media_content_type: provider
    metadata:
      title: '{{ message }}'
      thumbnail: https://brands.home-assistant.io/_/tts/logo.png
      media_class: app
      children_media_class:
      navigateIds:
      - {}
      - media_content_type: app
        media_content_id: media-source://tts
      - media_content_type: provider
        media_content_id: 'media-source://tts/tts.home_assistant_cloud?message={{
          message | urlencode }}&language={{ language | default(''en-AU'') }}&voice={{
          voice | default(''NatashaNeural'') }}

          '
  mode: single
  icon: mdi:volume-high
notify_display:
  alias: Notify - Display TTS and Media
  description: Send visual and audio notification to displays
  fields:
    message:
      description: Message to display and announce
      example: Person detected in the driveway
    target_displays:
      description: Display media players to use
      example: media_player.kitchen_display
    media_id:
      description: Optional media ID to display
      example: media-source://camera/camera.driveway
    media_type:
      description: Type of media to display
      example: application/vnd.apple.mpegurl
    media_title:
      description: Title for media display
      example: Driveway Camera Feed
    language:
      description: TTS language to use
      example: en-GB
    voice:
      description: TTS voice to use
      example: LibbyNeural
    volume_level:
      description: Volume level for announcement (0.0-1.0)
      example: 0.7
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ volume_level is defined and volume_level != None }}'
      sequence:
      - service: media_player.volume_set
        target:
          entity_id: '{{ target_displays }}'
        data:
          volume_level: '{{ volume_level }}'
  - service: media_player.play_media
    target:
      entity_id: '{{ target_displays }}'
    data:
      media_content_id: 'media-source://tts/cloud?message={{ message | urlencode }}&language={{
        language | default(''en-GB'') }}&voice={{ voice | default(''LibbyNeural'')
        }}

        '
      media_content_type: provider
    metadata:
      title: '{{ message }}'
      thumbnail: https://brands.home-assistant.io/_/cloud/logo.png
      media_class: app
      children_media_class:
      navigateIds:
      - {}
      - media_content_type: app
        media_content_id: media-source://tts
      - media_content_type: provider
        media_content_id: 'media-source://tts/cloud?message={{ message | urlencode
          }}&language={{ language | default(''en-GB'') }}&voice={{ voice | default(''LibbyNeural'')
          }}

          '
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ media_id is defined and media_id != '''' }}'
      sequence:
      - service: media_player.play_media
        target:
          entity_id: '{{ target_displays }}'
        data:
          media_content_id: '{{ media_id }}'
          media_content_type: '{{ media_type }}'
        metadata:
          title: '{{ media_title }}'
          thumbnail: /api/camera_proxy/{{ media_id | regex_replace('media-source://camera/camera\\.',
            '') }}
          media_class: video
          children_media_class:
          navigateIds:
          - {}
          - media_content_type: app
            media_content_id: '{{ media_id | regex_replace(''/camera\..*$'', '''')
              }}'
  mode: single
  icon: mdi:monitor-speaker
notify_push:
  alias: Notify - Push Notification
  description: Send push notifications to mobile devices
  fields:
    message:
      description: Message to send
      example: Motion detected in the driveway
    title:
      description: Notification title
      example: Security Alert
    priority:
      description: Notification priority
      example: high
  sequence:
  - service: notify.mobile_app_all_devices
    data:
      message: '{{ message }}'
      title: '{{ title | default(''Home Assistant Alert'') }}'
      data:
        priority: '{{ priority | default(''normal'') }}'
        channel: Security Alerts
        ttl: 0
        tag: security_alert
  mode: single
  icon: mdi:cellphone-message
notify_generic:
  alias: Notify - Generic System
  description: Unified notification system to handle multiple notification methods
  fields:
    notification_types:
      description: List of notification types to send (audio, push, display, etc.)
      example: '["audio", "push"]'
    message:
      description: Main notification message
      example: Motion detected in the driveway
    audio_message:
      description: Optional specific message for audio notifications (uses message
        if empty)
      example: ''
    display_message:
      description: Optional specific message for display notifications (uses message
        if empty)
      example: ''
    push_message:
      description: Optional specific message for push notifications (uses message
        if empty)
      example: ''
    title:
      description: Title for push and persistent notifications
      example: Security Alert
    media_id:
      description: Optional media ID to display (camera feed, etc.)
      example: media-source://camera/camera.driveway
    media_type:
      description: Type of media to display
      example: application/vnd.apple.mpegurl
    media_title:
      description: Title for media display
      example: Driveway Camera Feed
    target_speakers:
      description: Media players for audio notifications
      example: media_player.kitchen_2
    target_displays:
      description: Media players for visual notifications
      example: media_player.kitchen_display
    priority:
      description: Notification priority (high, normal, low)
      example: high
    language:
      description: TTS language to use
      example: en-AU
    voice:
      description: TTS voice to use
      example: NatashaNeural
    volume_level:
      description: Volume level for announcements (0.0-1.0)
      example: 0.7
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ ''audio'' in notification_types }}'
      sequence:
      - service: script.notify_audio
        data:
          message: '{{ audio_message if (audio_message is defined and audio_message
            != '''') else message }}'
          target_speakers: '{{ target_speakers }}'
          language: '{{ language | default(''en-AU'') }}'
          voice: '{{ voice | default(''NatashaNeural'') }}'
          volume_level: '{{ volume_level | default(None) }}'
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ ''display'' in notification_types }}'
      sequence:
      - service: script.notify_display
        data:
          message: '{{ display_message if (display_message is defined and display_message
            != '''') else message }}'
          target_displays: '{{ target_displays }}'
          media_id: '{{ media_id | default('''') }}'
          media_type: '{{ media_type | default('''') }}'
          media_title: '{{ media_title | default('''') }}'
          language: '{{ language | default(''en-GB'') }}'
          voice: '{{ voice | default(''LibbyNeural'') }}'
          volume_level: '{{ volume_level | default(None) }}'
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ ''push'' in notification_types }}'
      sequence:
      - service: script.notify_push
        data:
          message: '{{ push_message if (push_message is defined and push_message !=
            '''') else message }}'
          title: '{{ title | default(''Home Assistant Alert'') }}'
          priority: '{{ priority | default(''normal'') }}'
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ ''persistent'' in notification_types }}'
      sequence:
      - service: persistent_notification.create
        data:
          message: '{{ message }}'
          title: '{{ title | default(''Home Assistant Alert'') }}'
  mode: parallel
  icon: mdi:bell-ring
notify_security_event:
  alias: Notify - Security Event
  description: Notify about security events from cameras
  fields:
    event_type:
      description: Type of security event (motion, person, vehicle, etc.)
      example: person
    camera_name:
      description: Name of camera that detected the event
      example: Driveway
    camera_entity:
      description: Camera entity ID for display
      example: camera.reolink_duo_floodlight_wifi_fluent
    notification_types:
      description: Types of notifications to send
      example: '["audio", "display"]'
    volume_level:
      description: Volume level for audio notifications (0.0-1.0)
      example: 0.8
  sequence:
  - variables:
      base_message: '{{ event_type | title }} detected on {{ camera_name }} camera'
      audio_message: "{% if event_type == 'motion' %}\n  Motion detected on the {{
        camera_name }} camera\n{% elif event_type == 'person' %}\n  Alert! A person
        has been detected on the {{ camera_name }} camera\n{% elif event_type == 'vehicle'
        %}\n  Alert! A vehicle has been detected on the {{ camera_name }} camera\n{%
        else %}\n  {{ event_type | title }} detected on the {{ camera_name }} camera\n{%
        endif %}\n"
      priority: "{% if event_type == 'motion' %}\n  normal\n{% elif event_type ==
        'person' %}\n  high\n{% elif event_type == 'vehicle' %}\n  high\n{% else %}\n
        \ normal\n{% endif %}\n"
  - service: script.notify_generic
    data:
      notification_types: '{{ notification_types }}'
      message: '{{ base_message }}'
      audio_message: '{{ audio_message }}'
      display_message: '{{ base_message }}'
      push_message: 'Security: {{ base_message }}'
      title: Security Alert - {{ camera_name }}
      target_speakers: media_player.kitchen_2
      target_displays: media_player.kitchen_display
      media_id: '{% if camera_entity %}media-source://camera/{{ camera_entity }}{%
        endif %}'
      media_type: application/vnd.apple.mpegurl
      media_title: '{{ camera_name }} Camera'
      priority: '{{ priority }}'
      volume_level: '{{ volume_level | default(None) }}'
  mode: single
  icon: mdi:cctv
notify_battery_status:
  alias: Notify - Battery Status
  description: Notify about low battery levels in devices
  fields:
    entity_id:
      description: Entity ID of the battery sensor
      example: sensor.office_button_battery
    device_name:
      description: Friendly name of the device
      example: Office Smart Button
    battery_level:
      description: Current battery level
      example: 5
    notification_types:
      description: Types of notifications to send
      example: '["push", "persistent"]'
    target_speakers:
      description: Media player for audio notifications
      example: media_player.kitchen_2
    volume_level:
      description: Volume level for announcement
      example: 0.6
  sequence:
  - service: script.notify_generic
    data:
      notification_types: '{{ notification_types | default([''push'', ''persistent''])
        }}'
      message: 'Low battery alert: {{ device_name }} is at {{ battery_level }}%'
      audio_message: Warning, {{ device_name }} battery is low at {{ battery_level
        }} percent. Please replace batteries soon.
      push_message: "\U0001F50B Low Battery: {{ device_name }} ({{ battery_level }}%)"
      title: Low Battery Alert
      priority: high
      target_speakers: '{{ target_speakers | default(''media_player.kitchen_2'') }}'
      volume_level: '{{ volume_level | default(0.6) }}'
  mode: single
  icon: mdi:battery-alert

Scenes

- id: '1733158178280'
  name: Morning - Teagans Room Wakeup
  entities:
    light.teagans_room_main_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 128
      friendly_name: Teagans Room Main
      supported_features: 44
      state: 'off'
    light.bedside_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 191
      friendly_name: Bedside Lamp Light
      supported_features: 44
      state: 'off'
    light.clothes_rail_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect: 'off'
      color_mode: color_temp
      brightness: 254
      color_temp_kelvin: 6535
      color_temp: 153
      hs_color:
      - 54.768
      - 1.6
      rgb_color:
      - 255
      - 255
      - 251
      xy_color:
      - 0.325
      - 0.333
      off_with_transition: false
      off_brightness:
      friendly_name: Clothes Rail Light
      supported_features: 44
      state: 'on'
  metadata: {}
  icon: mdi:weather-sunny
- id: '1733163015395'
  name: Morning - Teagans Room Winddown
  entities:
    cover.teagans_blind_cover:
      current_position: 100
      target_lift_position: 100
      target_tilt_position:
      device_class: blind
      friendly_name: Teagans Blind Cover
      supported_features: 15
      state: open
    light.teagans_room_main_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 128
      friendly_name: Teagans Room Main Light
      supported_features: 44
      state: 'off'
    light.bedside_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 191
      friendly_name: Bedside Lamp Light
      supported_features: 44
      state: 'off'
    light.clothes_rail_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 254
      friendly_name: Clothes Rail Light
      supported_features: 44
      state: 'off'
  metadata: {}
  icon: mdi:weather-sunny
- id: '1717020358442'
  name: Evening - Teagans Office Study
  entities:
    light.teagans_office_main_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      friendly_name: Teagans Office Main Light
      supported_features: 44
      state: unavailable
    light.desk_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect: 'off'
      color_mode: color_temp
      brightness: 254
      color_temp_kelvin: 2732
      color_temp: 366
      hs_color:
      - 28.327
      - 64.71
      rgb_color:
      - 255
      - 168
      - 90
      xy_color:
      - 0.522
      - 0.387
      off_with_transition: false
      off_brightness:
      friendly_name: Desk Lamp Light
      supported_features: 44
      state: 'on'
    switch.usb_lamp_switch:
      friendly_name: USB Lamp Switch
      state: 'on'
  metadata: {}
  icon: mdi:weather-night
- id: '1733158380070'
  name: Evening - Teagans Room Bedtime
  entities:
    light.teagans_room_main_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect: 'off'
      color_mode: color_temp
      brightness: 94
      color_temp_kelvin: 2000
      color_temp: 500
      hs_color:
      - 30.601
      - 94.547
      rgb_color:
      - 255
      - 136
      - 13
      xy_color:
      - 0.599
      - 0.382
      off_with_transition: false
      off_brightness:
      friendly_name: Teagans Room Main Light
      supported_features: 44
      state: 'on'
    light.bedside_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      friendly_name: Bedside Lamp Light
      supported_features: 44
      effect: 'off'
      color_mode: color_temp
      brightness: 128
      color_temp_kelvin: 2000
      color_temp: 500
      hs_color:
      - 30.601
      - 94.547
      rgb_color:
      - 255
      - 136
      - 13
      xy_color:
      - 0.599
      - 0.382
      off_with_transition: false
      off_brightness:
      state: 'on'
    cover.teagans_blind_cover:
      current_position: 0
      target_lift_position: 0
      target_tilt_position:
      device_class: blind
      friendly_name: Teagans Blind Cover
      supported_features: 15
      state: closed
  metadata: {}
  icon: mdi:weather-night
- id: '1733158528666'
  name: Evening - Kitchen Relaxation
  entities:
    light.snug_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect: 'off'
      color_mode: color_temp
      brightness: 254
      color_temp_kelvin: 2732
      color_temp: 366
      hs_color:
      - 28.327
      - 64.71
      rgb_color:
      - 255
      - 167
      - 89
      xy_color:
      - 0.524
      - 0.387
      off_with_transition: false
      off_brightness:
      friendly_name: Snug Lamp Light
      supported_features: 44
      state: 'on'
    light.flower_lamp:
      supported_color_modes:
      - onoff
      color_mode: onoff
      friendly_name: Flower Lamp
      supported_features: 0
      state: 'on'
  metadata: {}
  icon: mdi:weather-night
- id: '1744663291061'
  name: State - Teagans Room Off
  entities:
    light.teagans_room_main_light:
      state: 'off'
    light.bedside_lamp_light:
      state: 'off'
    light.clothes_rail_light:
      state: 'off'
  metadata: {}
  icon: mdi:power
- id: '1744663291062'
  name: State - Kitchen All On
  entities:
    light.kitchen_snug_main_light:
      state: 'on'
      brightness: 254
    light.snug_lamp_light:
      state: 'on'
      brightness: 254
    light.flower_lamp:
      state: 'on'
  metadata: {}
  icon: mdi:power
- id: '1744663291063'
  name: State - Teagans Office Off
  entities:
    light.teagans_office_main_light:
      state: 'off'
    light.desk_lamp_light:
      state: 'off'
    switch.usb_lamp_switch:
      state: 'off'
  metadata: {}
  icon: mdi:power
- id: '1733179488254'
  name: State - Kitchen Off
  entities:
    light.snug_lamp_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 254
      friendly_name: Snug Lamp Light
      supported_features: 44
      state: 'off'
    light.kitchen_snug_main_light:
      min_color_temp_kelvin: 2000
      max_color_temp_kelvin: 6535
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - 'off'
      - colorloop
      supported_color_modes:
      - color_temp
      - xy
      effect:
      color_mode:
      brightness:
      color_temp_kelvin:
      color_temp:
      hs_color:
      rgb_color:
      xy_color:
      off_with_transition: false
      off_brightness: 3
      friendly_name: Kitchen Snug Main Light
      supported_features: 44
      state: 'off'
  metadata: {}
  icon: mdi:power
- id: '1733163302645'
  name: State - Hallway Off
  entities:
    light.hallway_downstairs_light:
      supported_color_modes:
      - brightness
      color_mode:
      brightness:
      off_with_transition: false
      off_brightness: 191
      friendly_name: Hallway Downstairs Light
      supported_features: 40
      state: 'off'
    light.hallway_upstairs_light:
      supported_color_modes:
      - brightness
      color_mode:
      brightness:
      off_with_transition: false
      off_brightness: 191
      friendly_name: Hallway Upstairs Light
      supported_features: 40
      state: 'off'
  metadata: {}
  icon: mdi:power
- id: '1733157617199'
  name: Brightness - Hallway 25%
  entities:
    light.hallway_downstairs_light:
      supported_color_modes:
      - brightness
      color_mode: brightness
      brightness: 64
      off_with_transition: false
      off_brightness:
      friendly_name: Hallway Downstairs Light
      supported_features: 40
      state: 'on'
    light.hallway_upstairs_light:
      supported_color_modes:
      - brightness
      color_mode: brightness
      brightness: 64
      off_with_transition: false
      off_brightness:
      friendly_name: Hallway Upstairs Light
      supported_features: 40
      state: 'on'
  metadata: {}
  icon: mdi:brightness-6
- id: '1733157759439'
  name: Brightness - Hallway 75%
  entities:
    light.hallway_downstairs_light:
      supported_color_modes:
      - brightness
      color_mode: brightness
      brightness: 191
      off_with_transition: false
      off_brightness:
      friendly_name: Hallway Downstairs Light
      supported_features: 40
      state: 'on'
    light.hallway_upstairs_light:
      supported_color_modes:
      - brightness
      color_mode: brightness
      brightness: 191
      off_with_transition: false
      off_brightness:
      friendly_name: Hallway Upstairs Light
      supported_features: 40
      state: 'on'
  metadata: {}
  icon: mdi:brightness-6
- id: '1733262789423'
  name: Cover - Teagans Blind Open
  entities:
    cover.teagans_blind_cover:
      current_position: 100
      target_lift_position: 100
      target_tilt_position:
      device_class: blind
      friendly_name: Teagans Blind Cover
      supported_features: 15
      state: open
  metadata: {}
  icon: mdi:window-shutter
- id: '1733262963571'
  name: Cover - Teagans Blind Close
  entities:
    cover.teagans_blind_cover:
      current_position: 0
      target_lift_position: 0
      target_tilt_position:
      device_class: blind
      friendly_name: Teagans Blind Cover
      supported_features: 15
      state: closed
  metadata: {}
  icon: mdi:window-shutter
- id: '1744663291064'
  name: Utility - Electric Blanket On
  entities:
    switch.electric_blanket:
      state: 'on'
  metadata: {}
  icon: mdi:radiator
- id: '1744663291065'
  name: Utility - Electric Blanket Off
  entities:
    switch.electric_blanket:
      state: 'off'
  metadata: {}
  icon: mdi:radiator
- id: '1733522920448'
  name: Utility - Dryer Off
  entities:
    switch.chinese_dryer:
      friendly_name: Chinese Dryer
      state: 'off'
  icon: mdi:tumble-dryer
  metadata: {}
- id: '1733522960772'
  name: Utility - Dryer On
  entities:
    switch.chinese_dryer:
      friendly_name: Chinese Dryer
      state: 'on'
  icon: mdi:tumble-dryer
  metadata: {}