38 lines
842 B
YAML
38 lines
842 B
YAML
- 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
|
|
|