Now and then I receive a corrupt temperature-value (from an arduino-mqtt - temperature component).
If the received value is not between -40 to 50 degrees celsius, I replace it with the value -1.
This is how the value_template looks like:
value_template:
{% if value_json.temperatur | float < 50 and value_json.temperatur | float > -40 %} {{ value_json.temperatur }} {% else %}-1.0{% endif %}
Is it possible to in stead of using -1, use latest value not considered corrupt?
(- I do not find how to refer to latest value displayed in my template-script…)