Dávám ho sem na testování, zatím nezkoušen proto dejte vědět jak to funguje díky.
Kód: Vybrat vše
blueprint:
name: Přepínání světel podle pohybu
description: >
Zapíná a vypíná světlo na základě detekovaného pohybu, ale pouze pokud jsou splněna určitá kritéria poskytovaná snímačem osvětlení nebo binárním senzorem.
Také umožňuje deaktivovat světla založená na pohybu pohybu. To může být užitečné například v případě, že je někdo v posteli nebo hraje film.
domain: automation
input:
motion_sensor:
name: Senzor pohybu
description: Tento senzor bude synchronizován se světlem.
selector:
entity:
domain: binary_sensor
device_class: motion
no_motion_wait:
name: Čekací doba
description: Čas čekání, až bude světlo vypnuto.
default: 10
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
illuminance_sensor:
name: Senzor osvětlení
description: "Senzor, který rozhoduje o tom, zda mají být světla zapnuta na základě intenzity osvětlení."
default:
selector:
entity:
domain: sensor
illuminance_threshold:
name: Prahová hodnota osvětlení
description: "Definuje prahovou hodnotu osvětlení, pod kterou by se světla měla rozsvítit."
default: 0
selector:
number:
min: 0
max: 100000
unit_of_measurement: lux
binary_sensor_entity:
name: Binární senzor
description: "Binární senzor, který rozhoduje, zda mají být světla zapnuta - stav zapnuto je rozsvícení světel."
default:
selector:
entity:
domain: binary_sensor
disabled_entity_id:
name: Zakázat režim
description: "Binární senzor, který rozhoduje, zda by světla neměla reagovat - stav zapnuto, nezapíná světla."
default:
selector:
entity:
domain: binary_sensor
target_light:
name: Světla
description: "Světla pro synchronizaci."
selector:
target:
entity:
domain: light
target_switch:
name: Spínače
description: "Spínače pro synchronizaci."
selector:
target:
entity:
domain: switch
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input motion_sensor
to: 'on'
variables:
illuminance_sensor: !input illuminance_sensor
illuminance_threshold: !input illuminance_threshold
binary_sensor_entity: !input binary_sensor_entity
disabled_entity_id: !input disabled_entity_id
condition:
- "{{ disabled_entity_id == None or is_state(disabled_entity_id, 'off') }}"
- "{{ trigger.to_state.state == 'on' }}"
- condition: or
conditions:
- "{{ binary_sensor_entity != None and is_state(binary_sensor_entity, 'on' ) }}"
- "{{ illuminance_sensor != None and states(illuminance_sensor)|int < illuminance_threshold|int }}"
action:
- service: light.turn_on
target: !input target_light
- service: switch.turn_on
target: !input target_switch
- wait_for_trigger:
platform: state
entity_id: !input motion_sensor
from: 'on'
to: 'off'
- delay: !input no_motion_wait
- service: light.turn_off
target: !input target_light
- service: switch.turn_off
target: !input target_switch