- id: andreas_arrival_lights_pro alias: Andreas hjem - udelys (pro) description: Tænder udelys ved hjemkomst i mørke/tusmørke og slukker igen efter 10 min mode: restart trigger: - platform: state entity_id: person.andreas_schusler_dethlefsen from: "not_home" to: "home" for: "00:00:15" condition: # Andreas skal have været væk lidt tid - condition: state entity_id: person.andreas_schusler_dethlefsen state: "home" # Lux skal være lav - condition: numeric_state entity_id: sensor.indkorsel_sensor_illuminance below: 120 # Solen skal være lav (backup hvis lux sensor er upålidelig) - condition: numeric_state entity_id: sun.sun attribute: elevation below: 4 action: - variables: lights: > {% set base = ['light.indkorsel_2', 'light.garage'] %} {% if now().isocalendar()[1] >= 42 or now().isocalendar()[1] <= 8 %} {{ (base + ['light.extended_color_light_1']) | list }} {% else %} {{ base }} {% endif %} lights_to_turn_on: > {{ lights | select('is_state','off') | list }} - choose: - conditions: "{{ lights_to_turn_on | length > 0 }}" sequence: - service: light.turn_on target: entity_id: "{{ lights_to_turn_on }}" - delay: "00:10:00" - service: light.turn_off target: entity_id: "{{ lights_to_turn_on }}"