I have marked the place with # further down.
alias: 'Light: TH takfot; <5 lux, sun -4°, 21.00 wd/22.00 we'
description: ''
trigger:
- id: light_level
platform: numeric_state
entity_id: sensor.baksida_motion_light_level
below: '5'
- id: sun_elevation
platform: numeric_state
entity_id: sun.sun
below: '-4.0'
attribute: elevation
- id: time_workday
platform: time
at: '21:00'
- id: time_weekend
platform: time
at: '22:00'
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: trigger
id: light_level
- condition: trigger
id: sun_elevation
- condition: and ################# HERE ####################
conditions:
- condition: numeric_state
entity_id: sun.sun
below: '-4.0'
attribute: elevation
- condition: numeric_state
entity_id: sensor.baksida_motion_light_level
below: '5'
sequence:
- service: light.turn_on
data:
brightness_pct: 50
target:
entity_id: light.th_takfot
- conditions:
- condition: trigger
id: time_workday
- condition: time
weekday:
- mon
- tue
- wed
- thu
- sun
sequence:
- service: light.turn_off
target:
entity_id: light.th_takfot
- conditions:
- condition: trigger
id: time_weekend
- condition: time
weekday:
- fri
- sat
sequence:
- service: light.turn_off
target:
entity_id: light.th_takfot
default: []
mode: restart