lys kontor
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
- alias: Kontor lys motion
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||
to: "on"
|
||||
|
||||
variables:
|
||||
timeout: >
|
||||
{% if now().hour >= 6 and now().hour < 22 %}
|
||||
{{ states('input_number.kontor_timeout_day') | int }}
|
||||
{% else %}
|
||||
{{ states('input_number.kontor_timeout_night') | int }}
|
||||
{% endif %}
|
||||
|
||||
action:
|
||||
- service: scene.turn_on
|
||||
target:
|
||||
entity_id: scene.kontor_klar
|
||||
|
||||
- wait_for_trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||
to: "off"
|
||||
|
||||
- delay:
|
||||
minutes: "{{ timeout }}"
|
||||
|
||||
- condition: state
|
||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||
state: "off"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: light.strip
|
||||
|
||||
Reference in New Issue
Block a user