Skip to content

Instantly share code, notes, and snippets.

@dnuc
Last active January 17, 2019 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnuc/9816782b796c07e5139e95d39306006a to your computer and use it in GitHub Desktop.
Save dnuc/9816782b796c07e5139e95d39306006a to your computer and use it in GitHub Desktop.
# Sleeping sensor automations
- alias: 'Starte Skript für Nachtruhe'
initial_state: True
hide_entity: true
trigger:
platform: event
event_type: xiaomi_aqara.movement
event_data:
entity_id: binary_sensor.vibration_158d0002b15f8d
movement_type: vibrate
condition:
- condition: time
after: '22:30:00'
before: '06:00:00'
- condition: state
entity_id: binary_sensor.is_anybody_home
state: 'on'
- condition: state
entity_id: input_boolean.sleeping
state: 'off'
- condition: state
entity_id: script.sleep_sensor_turn_on
state: 'off'
action:
- service: script.turn_on
entity_id: script.sleep_sensor_turn_on
- alias: 'Deaktiviere Skript für Nachtruhe'
initial_state: True
hide_entity: true
trigger:
platform: state
entity_id: group.motion_not_bedroom
to: 'on'
condition:
- condition: state
entity_id: script.sleep_sensor_turn_on
state: 'on'
- condition: state
entity_id: input_boolean.sleeping
state: 'off'
action:
- service: script.turn_off
entity_id: script.sleep_sensor_turn_on
- alias: 'Nachruhe Morgens aus'
initial_state: True
hide_entity: true
trigger:
platform: state
entity_id: group.motion_not_bedroom
to: 'on'
condition:
- condition: time
after: '06:00:00'
before: '22:30:00'
- condition: state
entity_id: input_boolean.sleeping
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.sleeping
# SCRIPT
script:
sleep_sensor_turn_on:
alias: "Nachtruhe aktivieren"
sequence:
- delay:
minutes: 10
- service: input_boolean.turn_on
entity_id: input_boolean.sleeping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment