renemarc/home-assistant-config

View on GitHub
automations/areas/washroom_low.yaml

Summary

Maintainability
Test Coverage
#
# Set washroom to low-power state
#
# Only set low-power state if not currently in nap to night modes.
# The end result is currently very close to `washroom_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
#
# Todo: force dim lights.
#
- id: washroom_low_power
  alias: "Washroom 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 on some devices.
    - service: homeassistant.turn_on
      data:
        entity_id:
          - light.lavatory
          - light.shower
        transition: 5