renemarc/home-assistant-config

View on GitHub
automations/devices/kitchen_lights_off.yaml

Summary

Maintainability
Test Coverage
#
# Turn off kitchen lights
#
# Turn off all kitchen lights when Flic button is single clicked.
#
- id: kitchen_lights_off
  alias: "Kitchen Lights OFF"

  trigger:
    # When kitchen Flic button is pressed once.
    - platform: event
      event_type: flic_click
      event_data:
        button_name: "flic_80e4da72e890"
        click_type: 'single'

  condition:
    # If any kitchen lights are on.
    - condition: state
      entity_id: group.kitchen_lights
      state: 'on'

  action:
    # Turn off all lights.
    - service: homeassistant.turn_off
      data:
        entity_id:
          - group.kitchen_lights