Motion-lys: input_number parametre for gang/daniel/kontor, fix badevaerelse timeout, kompakt lys view

This commit is contained in:
2026-04-25 19:17:56 +02:00
parent 56f21f79e1
commit 9cb7550f78
7 changed files with 208 additions and 263 deletions
+53 -91
View File
@@ -1,98 +1,60 @@
# - alias: 'Lys Daniel dag - arbejdsdag - sunrise'
# trigger:
# platform: time
# at: '06:00:00'
# condition:
# - condition: state
# entity_id: binary_sensor.arbejdsdag
# state: 'on'
# action:
# - service: script.sunrise
- id: daniel_motion_lys
alias: Daniel lys via bevaegelse
mode: restart
- alias: 'Lys Daniel dag - arbejdsdag'
trigger:
platform: state
trigger:
- platform: state
entity_id: binary_sensor.hue_motion_sensor_2_motion
to: 'on'
condition:
- condition: numeric_state
entity_id: sensor.hue_motion_sensor_2_illuminance
below: 90
- condition: state
entity_id: binary_sensor.arbejdsdag
state: 'on'
- condition: time
after: '06:30:00'
before: '19:30:00'
- condition: template
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
action:
- service: homeassistant.turn_on
target:
entity_id: light.daniels_vaerelse
data:
brightness_pct: 100
to: "on"
id: motion_on
- alias: 'Lys Daniel dag - ikke arbejdsdag'
trigger:
platform: state
- platform: state
entity_id: binary_sensor.hue_motion_sensor_2_motion
to: 'on'
condition:
- condition: numeric_state
entity_id: sensor.hue_motion_sensor_2_illuminance
below: 90
- condition: state
entity_id: binary_sensor.arbejdsdag
state: 'off'
- condition: time
after: '10:00:00'
before: '19:45:00'
- condition: template
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
action:
- service: homeassistant.turn_on
target:
entity_id: light.daniels_vaerelse
data:
brightness_pct: 100
# - alias: 'Lys Daniel aften'
# trigger:
# platform: state
# entity_id: binary_sensor.hue_motion_sensor_2_motion
# to: 'on'
# condition:
# - condition: numeric_state
# entity_id: sensor.hue_motion_sensor_2_illuminance
# below: 90
# - condition: time
# after: '20:00:01'
# before: '21:00:00'
# action:
# - service: homeassistant.turn_on
# target:
# entity_id: light.daniels_vaerelse
# data:
# brightness_pct: 50
to: "off"
id: motion_off
variables:
lux_limit: "{{ states('input_number.daniel_lux_threshold') | int }}"
brightness: "{{ states('input_number.daniel_brightness') | int }}"
timeout: "{{ states('input_number.daniel_timeout') | int }}"
- alias: 'Sluk lys i Daniel'
trigger:
platform: state
entity_id: binary_sensor.hue_motion_sensor_2_motion
to: 'off'
for:
minutes: 10
condition:
- condition: time
after: '05:00:00'
before: '22:00:00'
action:
- service: homeassistant.turn_off
data:
entity_id:
- light.daniels_vaerelse
action:
- choose:
# Motion on: taend lys hvis lux lavt og indenfor tidsvindue
- conditions:
- condition: trigger
id: motion_on
- condition: template
value_template: >
{{ states('sensor.hue_motion_sensor_2_illuminance') | int < lux_limit }}
- condition: template
value_template: >
{% set t = now().strftime('%H%M') | int %}
{% if is_state('binary_sensor.arbejdsdag', 'on') %}
{{ 630 <= t < 1930 }}
{% else %}
{{ 1000 <= t < 1945 }}
{% endif %}
- condition: template
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
sequence:
- service: light.turn_on
target:
entity_id: light.daniels_vaerelse
data:
brightness_pct: "{{ brightness }}"
# Motion off: vent timeout, sluk hvis stadig ingen bevaegelse
- conditions:
- condition: trigger
id: motion_off
sequence:
- delay:
minutes: "{{ timeout }}"
- condition: state
entity_id: binary_sensor.hue_motion_sensor_2_motion
state: "off"
- service: light.turn_off
target:
entity_id: light.daniels_vaerelse