Files
N22/include/automations/lys_gang.yaml
T
clausandCopilot bf4395c441 Gæstetilstand, lys/gardin-justeringer, varme-standardværdier og vanding
- Gæstetilstand: ny gaester.yaml, udvidet guest_mode og guest_automations_off;
  lys_stue, gardiner m.fl. respekterer input_boolean.gaester
- Varme: nye standardværdier (komfort stue/andreas/daniel, bryggers/køkken 23,
  nat-/væk-sænkning)
- Nye filer: garage_anne_evening.yaml, input/boolean/vanding.yaml
- Diverse justeringer af lys-, ferie- og vandingsautomationer samt dashboards
- HA-version og mealie.json opdateret

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-08 13:10:53 +01:00

73 lines
2.2 KiB
YAML

- id: gang_motion_lys
alias: Gang lys via bevægelse
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.gang_sensor_motion
to: "on"
id: motion_on
- platform: state
entity_id: binary_sensor.gang_sensor_motion
to: "off"
id: motion_off
variables:
lux_limit: "{{ states('input_number.gang_lux_threshold') | int }}"
is_dag: >
{% set t = now().strftime('%H%M') | int %}
{% set arbejdsdag = is_state('binary_sensor.arbejdsdag', 'on') %}
{% set start = 630 if arbejdsdag else 800 %}
{% if is_state('input_boolean.gaester', 'on') %}
{{ start <= t < 2300 }}
{% elif arbejdsdag %}
{{ 630 <= t < 2130 }}
{% else %}
{{ 800 <= t < 2200 }}
{% endif %}
action:
- choose:
# Motion on - dag: taend bright scene hvis lux er lavt nok
- conditions:
- condition: trigger
id: motion_on
- condition: template
value_template: "{{ is_dag }}"
- condition: template
value_template: >
{{ states('sensor.gang_sensor_illuminance') | int < lux_limit }}
sequence:
- service: scene.turn_on
target:
entity_id: scene.gang_bright
# Motion on - nat: taend daempet scene (ingen lux-check)
- conditions:
- condition: trigger
id: motion_on
- condition: template
value_template: "{{ not is_dag }}"
sequence:
- service: scene.turn_on
target:
entity_id: scene.gang_daempet_nat
# Motion off: vent timeout, sluk hvis stadig ingen bevaegelse
- conditions:
- condition: trigger
id: motion_off
sequence:
- delay:
minutes: >
{{ states('input_number.gang_timeout_day') | int if is_dag
else states('input_number.gang_timeout_night') | int }}
- condition: state
entity_id: binary_sensor.gang_sensor_motion
state: "off"
- service: light.turn_off
target:
entity_id: light.gang