This problem only appeared since I upgraded to core-2021.12.9. I have since also upgraded to core-2021.12.10 - problem still there.
THE PROBLEM
I have two real sensors (Outside/Inside Temp), MQTT based.
I have a calculated sensor which is the difference between the two (Difference = Inside - Outside)
The calculated input is ‘glitching’ and behaving as if [Outside] is zero occasionally - even though it never is.
And because I use an Automation based on [Difference], the automation is triggering incorrectly.
DETAILS
Shown below are the raw MQTT values over a recent short interval, as seen at the MQTT broker. As can be seen - the raw data shows no cases of ‘zero’ at any time.
Shown below is the calculated difference over the same period.
Notice that the Difference glitches occasionally to approx +26C which happens to be the INDOOR temp. This implies the Difference Calculation is [Indoor-0], instead of [Indoor-Outdoor]
YAML
- sensor:
- name: "Diff temperature"
unique_id: diff_temp
unit_of_measurement: "°C"
state: >
{% set indoor = states('sensor.indoor_temperature') | float %}
{% set outdoor = states('sensor.outdoor_temperature') | float %}
{{ (indoor - outdoor) | round(1, default=0) }}
NOTE
The YAML has round(1, default=0)
but the Default = 0 is NOT the problem … as if the default case was triggered, then Difference would glitch to zero … not the INDOOR temp.
Ideas???