@klogg wrote:
I have two sensors for measuring outside light levels. One 100% reliable but not always accurate, the other not always reliable but very accurate.
I have automations switch to using the 100% reliable but less accurate sensor any time the other one isn’t available.
So, I decide if a room is dark based on the current sensor but every time HA restarts its state always goes to ‘on’. Why is that and can I stop it? Here is the sensor.
dark_hall: friendly_name: Dark in the hall entity_id: - sensor.smartweather_average_illuminance - sensor.brightness - input_number.hall_smartweather_average_illuminance_sensor_threshold - input_number.hall_brightness_sensor_threshold - input_select.sensor_for_darkness value_template: > {% set sensor_threshold = states('input_number.hall_' + states('input_select.sensor_for_darkness') + '_sensor_threshold') | int %} {% set sensor_used = states('input_select.sensor_for_darkness') %} {{ states('sensor.' + sensor_used) | int <= sensor_threshold }}
I would have expected it to remember its state from before the restart but it doesn’t. Is that because it is a template sensor?
The only way I can think of doing this is by changing my state triggers to include a
for
:- alias: Hall Lights On When It Gets Dark trigger: #=== If it is dark - platform: state entity_id: binary_sensor.dark_hall from: 'off' to: 'on' for: seconds: 30
Posts: 6
Participants: 2