home-assistant/core

No default set on float in File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2346, in forgiving_float_filter

Opened this issue · 0 comments

The problem

When a sensor returns a non-zero value such as unknovn errors appear in the log for helpers that a definite number of places after the decimal has been set.

Since 2021.10 default values should be set in templating. See this article for more information about setting defaults in templating.

In this case float needs to be changed to float(0) to set the default value to zero.

What version of Home Assistant Core has the issue?

core-2024.10.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

helpers

Link to integration documentation on our website

No response

Diagnostics information

home-assistant_alert_2024-10-23T17-56-10.426Z.log

Example YAML snippet

Not sure what snippet I could include. I know this happens when a sensor reports unknown, which sometimes happens on some MQTT sensors that I have.

Anything in the logs that might be useful for us?

In this case it looks like `float` needs to be changed to `float(0)` to set the default value to zero in the file "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2346, in forgiving_float_filter

Additional information

No response