renemarc/home-assistant-config

View on GitHub
automations/areas/kitchen_low.yaml

Summary

Maintainability
Test Coverage
#
# Set kitchen to low-power state
#
# Only set low-power state if not currently in nap or night modes.
#
# @subscribe input_boolean.low_mode
# @subscribe input_boolean.nap_mode
# @subscribe input_boolean.night_mode
#
- id: kitchen_low_power
  alias: "Kitchen LOW POWER"

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

    # 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 night mode is disabled.
    - condition: state
      entity_id: input_boolean.night_mode
      state: 'off'

  action:
    # Turn on some lights.
    - service: homeassistant.turn_on
      data:
        entity_id:
          - light.microwave
          - light.sink

    # Turn off some lights.
    - service: homeassistant.turn_off
      data:
        entity_id:
          - light.countertop
          - light.island