Refine kontor lighting automation
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
- alias: Kontor lys motion
|
- id: kontor_motion_lys
|
||||||
|
alias: Kontor lys via bevægelse
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
@@ -6,31 +7,71 @@
|
|||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
to: "on"
|
to: "on"
|
||||||
|
|
||||||
variables:
|
condition:
|
||||||
timeout: >
|
- condition: numeric_state
|
||||||
{% if now().hour >= 6 and now().hour < 22 %}
|
entity_id: sensor.kontor_belysningsstyrke
|
||||||
{{ states('input_number.kontor_timeout_day') | int }}
|
below: 60
|
||||||
{% else %}
|
|
||||||
{{ states('input_number.kontor_timeout_night') | int }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: scene.kontor_klar
|
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:
|
- wait_for_trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
to: "off"
|
to: "on"
|
||||||
|
timeout: "00:10:00"
|
||||||
- delay:
|
continue_on_timeout: true
|
||||||
minutes: "{{ timeout }}"
|
- 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: "00:05:00"
|
||||||
|
continue_on_timeout: true
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
state: "off"
|
state: "off"
|
||||||
|
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: light.strip
|
entity_id: light.strip
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
kontor_timeout_day:
|
|
||||||
name: Kontor lys timeout dag
|
|
||||||
min: 1
|
|
||||||
max: 60
|
|
||||||
step: 1
|
|
||||||
unit_of_measurement: min
|
|
||||||
initial: 15
|
|
||||||
|
|
||||||
kontor_timeout_night:
|
|
||||||
name: Kontor lys timeout nat
|
|
||||||
min: 1
|
|
||||||
max: 30
|
|
||||||
step: 1
|
|
||||||
unit_of_measurement: min
|
|
||||||
initial: 2
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user