82 lines
2.0 KiB
YAML
82 lines
2.0 KiB
YAML
- id: kontor_motion_lys
|
|
alias: Kontor lys via bevægelse
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
to: "on"
|
|
|
|
condition:
|
|
- condition: template
|
|
value_template: >
|
|
{{ states('sensor.kontor_belysningsstyrke') | int <
|
|
states('input_number.kontor_lux_threshold') | int }}
|
|
|
|
action:
|
|
- service: scene.turn_on
|
|
target:
|
|
entity_id: scene.kontor_klar
|
|
|
|
- id: kontor_motion_sluk_dag
|
|
alias: Sluk kontor lys efter 10 min uden bevægelse
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
to: "off"
|
|
|
|
condition:
|
|
- condition: time
|
|
after: "06:00:00"
|
|
before: "23:59:00"
|
|
|
|
action:
|
|
- wait_for_trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
to: "on"
|
|
timeout:
|
|
minutes: "{{ states('input_number.kontor_timeout_day') | int }}"
|
|
continue_on_timeout: true
|
|
- condition: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
state: "off"
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.strip
|
|
|
|
- id: kontor_motion_sluk_nat
|
|
alias: Sluk kontor lys efter 5 min uden bevægelse om natten
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
to: "off"
|
|
|
|
condition:
|
|
- condition: or
|
|
conditions:
|
|
- condition: time
|
|
before: "06:00:00"
|
|
- condition: time
|
|
after: "23:59:00"
|
|
|
|
action:
|
|
- wait_for_trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
to: "on"
|
|
timeout:
|
|
minutes: "{{ states('input_number.kontor_timeout_night') | int }}"
|
|
continue_on_timeout: true
|
|
- condition: state
|
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
|
state: "off"
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.strip
|
|
|