renemarc/home-assistant-config

View on GitHub
automations/areas/ceiling_low.yaml

Summary

Maintainability
Test Coverage
#
# Set ceiling wash lights to low-power state
#
# Only set low-power state if not currently in nap or night modes.
# The end result is currently very close to `ceiling_off` but this automation
# is kept separate to allow for any eventual evolution.
#
# @subscribe input_boolean.low_mode
# @subscribe input_boolean.nap_mode
# @subscribe input_boolean.night_mode
#
- id: ceiling_low_power
  alias: "Ceiling LOW POWER"

  trigger:
    # When low-power mode is enabled.
    - platform: state
      entity_id: input_boolean.low_mode
      to: 'on'

    # When nap mode is disabled.
    - platform: state
      entity_id: input_boolean.nap_mode
      to: 'off'

    # When night mode is disabled.
    - platform: state
      entity_id: input_boolean.night_mode
      to: 'off'

  condition:
    # If low-power mode is enabled.
    - condition: state
      entity_id: input_boolean.low_mode
      state: 'on'

    # If nap mode is disabled.
    - condition: state
      entity_id: input_boolean.nap_mode
      state: 'off'

    # If night mode is disabled.
    - condition: state
      entity_id: input_boolean.night_mode
      state: 'off'

  action:
    # Turn off ceiling wash lights.
    - service: homeassistant.turn_off
      data:
        entity_id:
          - group.ceiling_lights
        transition: 5