lys
This commit is contained in:
@@ -1,94 +1,67 @@
|
|||||||
# - alias: 'Lys Andreas dag - arbejdsdag - sunrise'
|
- alias: Andreas lys motion
|
||||||
# trigger:
|
mode: restart
|
||||||
# platform: time
|
|
||||||
# at: '06:00:00'
|
|
||||||
# condition:
|
|
||||||
# - condition: state
|
|
||||||
# entity_id: binary_sensor.arbejdsdag
|
|
||||||
# state: 'on'
|
|
||||||
# action:
|
|
||||||
# - service: script.sunrise
|
|
||||||
|
|
||||||
|
trigger:
|
||||||
- alias: 'Lys Andreas dag - arbejdsdag'
|
- platform: state
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
||||||
to: 'on'
|
to: "on"
|
||||||
condition:
|
id: motion_on
|
||||||
- condition: numeric_state
|
|
||||||
entity_id: sensor.hue_motion_sensor_2_illuminance_2
|
|
||||||
below: 90
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'on'
|
|
||||||
- condition: time
|
|
||||||
after: '06:30:00'
|
|
||||||
before: '19:45:00'
|
|
||||||
action:
|
|
||||||
- service: homeassistant.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: light.andreas_vaerelse
|
|
||||||
data:
|
|
||||||
brightness_pct: 100
|
|
||||||
|
|
||||||
- alias: 'Lys Andreas dag - ikke arbejdsdag'
|
- platform: state
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
||||||
to: 'on'
|
to: "off"
|
||||||
condition:
|
id: motion_off
|
||||||
- condition: numeric_state
|
|
||||||
entity_id: sensor.hue_motion_sensor_2_illuminance_2
|
|
||||||
below: 90
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'off'
|
|
||||||
- condition: time
|
|
||||||
after: '10:00:00'
|
|
||||||
before: '20:30:00'
|
|
||||||
action:
|
|
||||||
- service: homeassistant.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: light.andreas_vaerelse
|
|
||||||
data:
|
|
||||||
brightness_pct: 100
|
|
||||||
|
|
||||||
# - alias: 'Lys Andreas aften'
|
variables:
|
||||||
# trigger:
|
lux_limit: "{{ states('input_number.andreas_lux_threshold') | int }}"
|
||||||
# platform: state
|
brightness: "{{ states('input_number.andreas_brightness') | int }}"
|
||||||
# entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
timeout: "{{ states('input_number.andreas_timeout') | int }}"
|
||||||
# to: 'on'
|
|
||||||
# condition:
|
|
||||||
# - condition: numeric_state
|
|
||||||
# entity_id: sensor.hue_motion_sensor_2_illuminance_2
|
|
||||||
# below: 90
|
|
||||||
# - condition: time
|
|
||||||
# after: '20:00:01'
|
|
||||||
# before: '21:00:00'
|
|
||||||
# action:
|
|
||||||
# - service: homeassistant.turn_on
|
|
||||||
# target:
|
|
||||||
# entity_id: light.andreas_vaerelse
|
|
||||||
# data:
|
|
||||||
# brightness_pct: 50
|
|
||||||
|
|
||||||
|
action:
|
||||||
|
|
||||||
|
- choose:
|
||||||
|
|
||||||
- alias: 'Sluk lys i Andreas'
|
# Motion detected
|
||||||
trigger:
|
- conditions:
|
||||||
platform: state
|
- condition: trigger
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
id: motion_on
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 10
|
|
||||||
condition:
|
|
||||||
- condition: time
|
|
||||||
after: '05:00:00'
|
|
||||||
before: '20:00:00'
|
|
||||||
action:
|
|
||||||
- service: homeassistant.turn_off
|
|
||||||
data:
|
|
||||||
entity_id:
|
|
||||||
- light.andreas_vaerelse
|
|
||||||
|
|
||||||
|
# ⚠️ Skift numeric_state til template condition
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{{ states('sensor.hue_motion_sensor_2_illuminance_2') | int < lux_limit }}
|
||||||
|
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if is_state('binary_sensor.arbejdsdag','on') %}
|
||||||
|
{{ 630 <= t <= 1945 }}
|
||||||
|
{% else %}
|
||||||
|
{{ 1000 <= t <= 2030 }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
sequence:
|
||||||
|
|
||||||
|
- service: light.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: light.andreas_vaerelse
|
||||||
|
data:
|
||||||
|
brightness_pct: "{{ brightness }}"
|
||||||
|
|
||||||
|
# Motion stopped
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: motion_off
|
||||||
|
|
||||||
|
sequence:
|
||||||
|
|
||||||
|
- delay:
|
||||||
|
minutes: "{{ timeout }}"
|
||||||
|
|
||||||
|
- condition: state
|
||||||
|
entity_id: binary_sensor.hue_motion_sensor_2_motion_2
|
||||||
|
state: "off"
|
||||||
|
|
||||||
|
- service: light.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: light.andreas_vaerelse
|
||||||
|
|||||||
Reference in New Issue
Block a user