# Description:
#   Activate a scene using an input_select
#
# Written for:
#   @eugenelai
#
# Components:
#   automation
#   input_select
#   scene
#
# License:
#   MIT
#
# Author:
#   Dale Higgs <@dale3h>

automation:
  - alias: Select a Scene
    trigger:
      # Trigger when the input_select changes
      - platform: state
        entity_id: input_select.scene_selector
    condition:
      # Do not trigger if "None" is selected
      - platform: template
        value_template: "{{ states('input_select.scene_selector') != 'None' }}"
    action:
      # Turn the selected scene on
      - service: scene.turn_on
        data_template:
          entity_id: "scene.{{ states('input_select.scene_selector')|lower|replace(' ', '_') }}"
      # Uncomment these lines to set the input_select back to "None"
      # - service: input_select.select_option
      #   data:
      #     option: 'None'

input_select:
  scene_selector:
    name: Scene Selector
    initial: 'None'
    options:
      - 'None'
      - 'Morning'
      - 'Afternoon'
      - 'Evening'
      - 'Night'

scene:
  - name: Morning
    entities:
      light.living_room:
        state: on
        brightness: 192

  - name: Afternoon
    entities:
      light.living_room:
        state: on
        brightness: 255

  - name: Evening
    entities:
      light.living_room:
        state: on
        brightness: 128

  - name: Night
    entities:
      light.living_room: off

Add scene selector for @eugenelai
Add scene selector for @eugenelai
