Last active
March 4, 2024 06:02
-
-
Save kai-zer-ru/0614092b42ddf57cba9d3ec2487b9319 to your computer and use it in GitHub Desktop.
switch_timer_motion_blueprint.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
blueprint: | |
name: Switch по датчику движения | |
description: Управляем Switch по датчику движения с задержкой | |
domain: automation | |
input: | |
motion_entity: | |
name: Датчик движения | |
selector: | |
entity: | |
domain: | |
- binary_sensor | |
device_class: | |
- motion | |
multiple: false | |
humidity_entity: | |
name: Датчик влажности | |
selector: | |
entity: | |
domain: | |
- sensor | |
device_class: | |
- humidity | |
multiple: false | |
switch_entity: | |
name: Switch | |
selector: | |
entity: | |
filter: | |
- domain: | |
- switch | |
multiple: false | |
timer_entity: | |
name: Таймер | |
selector: | |
entity: | |
filter: | |
- domain: | |
- timer | |
multiple: false | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
- platform: state | |
entity_id: !input motion_entity | |
to: "on" | |
from: "off" | |
id: move_on | |
- platform: state | |
entity_id: !input motion_entity | |
from: "on" | |
to: "off" | |
id: move_off | |
- platform: event | |
event_type: timer.finished | |
event_data: | |
entity_id: !input timer_entity | |
id: timer_v_off | |
- platform: state | |
entity_id: !input switch_entity | |
from: "on" | |
to: "off" | |
id: switch_off | |
- platform: state | |
entity_id: !input switch_entity | |
from: "off" | |
to: "on" | |
id: switch_on | |
- platform: numeric_state | |
entity_id: | |
- !input humidity_entity | |
# for: | |
# hours: 0 | |
# minutes: 2 | |
# seconds: 0 | |
attribute: humidity | |
above: 50 | |
id: humidity | |
action: | |
- choose: | |
- conditions: | |
- condition: trigger | |
id: | |
- humidity | |
sequence: | |
if: | |
- condition: state | |
entity_id: !input switch_entity | |
state: "off" | |
then: | |
- service: switch.turn_on | |
target: | |
entity_id: !input switch_entity | |
- conditions: | |
- condition: trigger | |
id: | |
- move_off | |
sequence: | |
- service: timer.cancel | |
target: | |
entity_id: !input timer_entity | |
- if: | |
- condition: state | |
entity_id: !input switch_entity | |
state: "on" | |
then: | |
- service: timer.start | |
target: | |
entity_id: !input timer_entity | |
- conditions: | |
- condition: trigger | |
id: | |
- move_on | |
sequence: | |
- if: | |
- condition: state | |
entity_id: !input switch_entity | |
state: "off" | |
then: | |
- service: switch.turn_on | |
target: | |
entity_id: !input switch_entity | |
- if: | |
- condition: state | |
entity_id: !input timer_entity | |
state: active | |
then: | |
- service: timer.cancel | |
target: | |
entity_id: !input timer_entity | |
- conditions: | |
- condition: trigger | |
id: | |
- timer_v_off | |
sequence: | |
- service: switch.turn_off | |
target: | |
entity_id: !input switch_entity | |
- conditions: | |
- condition: trigger | |
id: | |
- switch_off | |
sequence: | |
- service: timer.cancel | |
target: | |
entity_id: !input timer_entity | |
- conditions: | |
- condition: trigger | |
id: | |
- switch_on | |
sequence: | |
- if: | |
- condition: state | |
entity_id: !input motion_entity | |
state: "off" | |
then: | |
- service: timer.start | |
target: | |
entity_id: !input timer_entity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment