Temp based status leds not working (esp8266)

Hi. I am using an ESP8266 with temp sensor and two status leds (green & red). Green is active below 8 degrees, and red is active and flashing above 8 degrees.

I have the following code:

  - platform: dallas
    address: ***
    name: "unit_2"
    unit_of_measurement: "°C"
        - above: 8
            - light.turn_on: 
                id: "red_led_light_unit_2"
            - switch.turn_off: "green_led_switch_unit_2"
        - below: 8
            - light.turn_off:   
                id: "red_led_light_unit_2"
            - switch.turn_on: "green_led_switch_unit_2"

Sometimes it switches to the green led when below the threshold, and sometimes it doesn’t.

When I heat the probe by holding it in my hand and then placing it in cold water it always switches correctly.
However, when allowed to cool in a fridge, it fails to switch every now and again. I can see that the temperature in the fridge is indeed correct as I have a second probe showing the same temperature. The only difference then is the speed at which the probe cools down.

Any ideas as to what could be causing it?

You have update_interval: added to dallas: for example, 10s.
The default value for resetting Dallas values is I guess 60s
You have a Dallas resistor between data and + 4k7 ?
I would not give the value 8 for both states because it is calculated inclusive and automation sometimes probably does not know what to do if the values are the same

1 Like

Yes. I have the dallas, but with 1s update interval. Could that cause it?

What would happen if the limits are different? If I set for example above 8 but below 7. Then it would be one degree grey zone?

Ok interval I would raise higher. If that doesn’t help, I would put temperatures above 8.1 and below 8, for example

The gray zone will always be here. If you extend the interval, the temperature will drop or rise before the new data is read and that time is a gray zone

Ah ok, perhaps the solution is that simple. I’ll try it later today.

EDIT: The decrease update frequency seems to have done the trick. Marke the solution, thanks.