renemarc/home-assistant-config

View on GitHub
automations/devices/aurora_select.yaml

Summary

Maintainability
Test Coverage
#
# Manually select a Nanoleaf Aurora built-in effect
#
# @subscribe input_select.aurora_effect
#
# @publish variable.aurora_effect
#
# @see /automations/devices/aurora_effect.yaml
#
- id: aurora_select
  alias: "Aurora SELECT"

  trigger:
    # When an effect has been selected.
    - platform: state
      entity_id: input_select.aurora_effect

    # When an item which was off or physically disconnected comes back online.
    - platform: state
      entity_id:
        - light.aurora
      from: 'off'

  condition:
    # If an actual effect is selected, not the default.
    - condition: template
      value_template: >-
        {{ not is_state('input_select.aurora_effect', 'Auto') }}

  action:
    # Update the Aurora effect variable.
    - service: variable.set_variable
      data:
        variable: aurora_effect
        value_template: >-
          {{ states('input_select.aurora_effect') }}