I have this binary sensor template for my lights.
It turns on when the sun elevation is low and my 2 light sensors are below 40.
I turn off the lights if sensor turns off for some time, but the issue with this is when the lux value is just around 40. The lights have a tendency to turn on/off and that can be annoying.
I would like the sensor template to turn on when the lux value is 40, but turn off when the value is higher (maybe 60?) but unsure how to integrate it into the template.
Does anyone know how to do this?
- platform: template
sensors:
tillad_automatisk_lys:
friendly_name: 'Tillad automatisk lys'
icon_template: 'mdi:brightness-auto'
value_template: >-
{{ (states.sun.sun.attributes.elevation|float < 2)
or (states.sensor.stue_lys.state|float(40) < 40)
or (states.sensor.spisebord_lys.state|float(40) < 40) }}