renemarc/home-assistant-config

View on GitHub
automations/areas/bedroom_on.yaml

Summary

Maintainability
Test Coverage
#
# Turn on bedroom
#
# If low-power mode is enabled, the `bedroom_low` automation will be used
# instead.
#
# @subscribe input_boolean.low_mode
# @subscribe input_boolean.nap_mode
#
# @see /automations/areas/bedroom_low.yaml
#
- id: bedroom_on
  alias: "Bedroom 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'

  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'

  action:
    # Turn on bed underglow lights.
    - service: homeassistant.turn_on
      data:
        entity_id:
          - group.bed_lights
        transition: 5

    # Turn on binary devices.
    - service: homeassistant.turn_on
      entity_id:
        - light.bedside
        - light.nightstand