Last active
February 29, 2024 06:06
-
-
Save kai-zer-ru/2d01b6d13b3e49c77f4d599ef2e23e2c to your computer and use it in GitHub Desktop.
light_timer_motion_automation.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: light_timer_motion_automation | |
description: "" | |
trigger: | |
- platform: state | |
entity_id: binary_sensor.datchik_dvizheniia_v_spalne_occupancy | |
to: 'on' | |
from: 'off' | |
id: move_on | |
- platform: state | |
entity_id: binary_sensor.datchik_dvizheniia_v_spalne_occupancy | |
from: 'on' | |
to: 'off' | |
id: move_off | |
- platform: event | |
event_type: timer.finished | |
event_data: | |
entity_id: timer.timer_svet_v_spane | |
id: timer_v_off | |
- platform: state | |
entity_id: | |
- light.vykliuchatel_v_spalne | |
from: "on" | |
to: "off" | |
id: light_off | |
- platform: state | |
entity_id: | |
- light.vykliuchatel_v_spalne | |
from: "off" | |
to: "on" | |
id: light_on | |
action: | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: | |
- move_off | |
sequence: | |
- service: timer.cancel | |
target: | |
entity_id: timer.timer_svet_v_spane | |
- if: | |
- condition: state | |
entity_id: light.vykliuchatel_v_spalne | |
state: "on" | |
then: | |
- service: timer.start | |
target: | |
entity_id: timer.timer_svet_v_spane | |
- conditions: | |
- condition: trigger | |
id: | |
- move_on | |
sequence: | |
- if: | |
- condition: state | |
entity_id: light.vykliuchatel_v_spalne | |
state: 'off' | |
then: | |
- service: light.turn_on | |
target: | |
entity_id: light.vykliuchatel_v_spalne | |
- if: | |
- condition: state | |
entity_id: timer.timer_svet_v_spane | |
state: active | |
then: | |
- service: timer.cancel | |
target: | |
entity_id: timer.timer_svet_v_spane | |
- conditions: | |
- condition: trigger | |
id: | |
- timer_v_off | |
sequence: | |
- service: light.turn_off | |
target: | |
entity_id: light.vykliuchatel_v_spalne | |
- conditions: | |
- condition: trigger | |
id: | |
- light_off | |
sequence: | |
- service: timer.cancel | |
target: | |
entity_id: timer.timer_svet_v_spane | |
- conditions: | |
- condition: trigger | |
id: | |
- light_on | |
sequence: | |
- if: | |
- condition: state | |
entity_id: binary_sensor.datchik_dvizheniia_v_spalne_occupancy | |
state: "off" | |
then: | |
- service: timer.start | |
target: | |
entity_id: timer.timer_svet_v_spane | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timer_svet_v_spane: | |
restore: true | |
duration: '00:30:00' | |
name: Таймер света в спальне |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment