Hello all,
I have a sensor ( made by me ) that reports temperature, humidity and pressure via mqtt.
( For whom interessed is an ESP8266 with a BME280 and few lines of arduino code ).
Problem, as well known and documented, is that the temperature reported by this sensor is sligthly higher than the real temp.
I can compensate that in firmware but I would like to learn if I can do this in configuration.yaml as it could be useful fo other needs.
|round(1) rounds a number to one decimal place. This will not work on states as they are strings. States are always strings. Only attributes can have other object types.
|float(0) attempts to convert a string to a floating point number. If it can’t convert the string to a number it replaces it with the specified default value, zero in this case…
You should always define a default value for filters. If you don’t and the filter is not supplied the correct object type on start-up then the template will fail to load.
due to what I’ve discovered ( here in forum ) be called “epsilon” error ( or something like this ).
Basically some times the value displayed was something like “348.6700000001” ( with lot of decimal instead of two ) and the "’%02f’ | format " fixed this.