renemarc/home-assistant-config

View on GitHub
automations/modes/nap_mode_start.yaml

Summary

Maintainability
Test Coverage
#
# When someone takes a nap
#
# Subscribers should shut off bedroom lights, lower potentially disruptive light
# sources elsewhere, and minimize noises without preventing someone else from
# being active.
#
# @publish input_boolean.nap_mode
#
# @see /automations/modes/night_mode_start.yaml
#
- id: nap_mode_start
  alias: "Nap Mode START"

  trigger:
    # When Minimote button 2 pressed once.
    - platform: event
      event_type: zwave.scene_activated
      event_data:
        entity_id: zwave.minimote
        scene_id: 3 # 3 = button #2 pressed once.

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

  condition:
    # If nap mode is not currently enabled.
    - condition: state
      entity_id: input_boolean.nap_mode
      state: 'off'

  action:
    # Enable nap mode.
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.nap_mode