Hello,
I’m trying to create an automation that turns on some lights based on Lux levels from a sensor. For some reason it isn’t working and I’m not sure why:
- id: '1618199875741'
alias: Light Control - Living Room - Adaptive
description: ''
trigger:
- platform: state
entity_id: sensor.livingroom_multisensor_illuminance
condition:
- condition: time
after: 08:00:00
before: '20:00:00'
action:
- service: light.turn_on
data_template:
entity_id: light.living_room_lights
transition: 10
brightness: |-
{% if states("sensor.livingroom_multisensor_illuminance") > "16" %}
0
{% elif states("sensor.livingroom_multisensor_illuminance") < "16" %}
10
{% elif states("sensor.livingroom_multisensor_illuminance") < "15.5" %}
20
{% elif states("sensor.livingroom_multisensor_illuminance") < "15" %}
30
{% elif states("sensor.livingroom_multisensor_illuminance") < "14.5" %}
40
{% elif states("sensor.livingroom_multisensor_illuminance") < "14" %}
50
{% elif states("sensor.livingroom_multisensor_illuminance") < "13.5" %}
60
{% elif states("sensor.livingroom_multisensor_illuminance") < "13" %}
70
{% elif states("sensor.livingroom_multisensor_illuminance") < "12.5" %}
80
{% elif states("sensor.livingroom_multisensor_illuminance") < "12" %}
90
{% elif states("sensor.livingroom_multisensor_illuminance") < "11.5" %}
100
{% elif states("sensor.livingroom_multisensor_illuminance") < "11" %}
110
{% elif states("sensor.livingroom_multisensor_illuminance") < "10.5" %}
120
{% elif states("sensor.livingroom_multisensor_illuminance") < "10" %}
130
{% elif states("sensor.livingroom_multisensor_illuminance") < "9.5" %}
140
{% elif states("sensor.livingroom_multisensor_illuminance") < "9" %}
150
{% elif states("sensor.livingroom_multisensor_illuminance") < "8.5" %}
160
{% elif states("sensor.livingroom_multisensor_illuminance") < "8" %}
170
{% elif states("sensor.livingroom_multisensor_illuminance") < "7.5" %}
180
{% endif %}
180
{% endif %}
mode: single
I’d appreciate some help figuring this out