I use a template to apply offset. In the above case, I need to subtract 2.5 Celsius degrees.
I’m getting weird results because the value looks like this:
The weirdest part is that when I use template editor I get two results:
In the preview, you can see ORG - the original value (MQTT sensor), MOD is the value of my template sensor and NEW is the value template taken from my template sensor.
First of all, I get weird rounding. All I need is one decimal place, second is the wrong value.
In my template, I’m subtracting 2.5, but the MOD has 2.4 subtracted.
But the thing that troubles me so much is why there is a difference in the first place and why I get that weird rounding. Any ideas on that?
Maybe it’s a bug or it’s just the lack of knowledge.
MOD is the state of the template sensor and NEW is just the value_template of that template sensor.
In theory, they should have the same value.
The value_template is returning the correct value, but the state of the template sensor is wrong.
Not sure how they are evaluated, I don’t know the insides of HA.
Assuming ORG is returning 26.4, then MOD is returning 24 and NEW 23.9 (this is correct).
My point is that I have the same template, for value_template of fixed_sensor and as the third line in the template editor. So both values (second and third) should be the same.