renemarc/home-assistant-config

View on GitHub
automations/areas/washroom_on.yaml

Summary

Maintainability
Test Coverage
#
# Turn on washroom
#
# If low-power mode is enabled, the `washroom_low` automation will be used
# instead.
#
# @subscribe input_boolean.low_mode
# @subscribe input_boolean.nap_mode
# @subscribe input_boolean.night_mode
#
# @see /automations/areas/washroom_low.yaml
#
- id: washroom_on
  alias: "Washroom ON"

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

    # 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 disabled.
    - condition: state
      entity_id: input_boolean.low_mode
      state: 'off'

    # 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 all devices.
    - service: homeassistant.turn_on
      data:
        entity_id:
          - group.washroom_lights
        transition: 5