Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Assistant crashes when changing input sensor #71

Open
johannes1984 opened this issue Oct 17, 2024 · 10 comments
Open

Home Assistant crashes when changing input sensor #71

johannes1984 opened this issue Oct 17, 2024 · 10 comments

Comments

@johannes1984
Copy link

Hi,

I have the reproducable issue, that when I change the input sensor HA fully crashes. The only way to bring it back is to reboot the VM in Proxmox. Running HA 2024.10.2 and Daily Sensor v2024.10.1

I started the debug mode and then tried the change and got this:

-------------------------------------------------------------------
Daily Sensor
Version: v2024.10.1
If you have any issues with this you need to open an issue here:
https://github.com/jeroenterheerdt/HADailySensor/issues
-------------------------------------------------------------------

2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] auto_reset: True
2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] registered for time change.
2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] Updating Daily Sensor Temperatur_Innen_Max
2024-10-17 16:40:34.092 DEBUG (MainThread) [custom_components.daily] Finished fetching Temperatur_Innen_Max data in 0.000 seconds (success: True)
2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] auto_reset: True
2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] registered for time change.
2024-10-17 16:40:34.092 INFO (MainThread) [custom_components.daily] Updating Daily Sensor Temperatur Aussen Minimum
2024-10-17 16:40:34.093 DEBUG (MainThread) [custom_components.daily] Finished fetching Temperatur Aussen Minimum data in 0.000 seconds (success: True)
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] auto_reset: True
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] registered for time change.
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] Updating Daily Sensor Temperatur Aussen Maximum
2024-10-17 16:40:34.093 DEBUG (MainThread) [custom_components.daily] Finished fetching Temperatur Aussen Maximum data in 0.000 seconds (success: True)
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] auto_reset: True
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] registered for time change.
2024-10-17 16:40:34.093 INFO (MainThread) [custom_components.daily] Updating Daily Sensor  Temperatur_Innen_Min
2024-10-17 16:40:34.093 DEBUG (MainThread) [custom_components.daily] Finished fetching  Temperatur_Innen_Min data in 0.000 seconds (success: True)
2024-10-17 16:40:35.473 WARNING (MainThread) [homeassistant.components.fan] Platform xiaomi_miio_fan not ready yet: Unable to discover the device 192.168.2.110; Retrying in background in 30 seconds
2024-10-17 16:40:37.671 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.badezimmer_absolute_feuchtigkeit') | float - states('sensor.wohnung_absolute_feuchtigkeit') | float) | round(2) }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2348, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 632, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2729, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2351, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1905, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.badezimmer_absolute_feuchtigkeit') | float - states('sensor.wohnung_absolute_feuchtigkeit') | float) | round(2) }}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 749, in async_render_to_info
    render_info._result = self.async_render(  # noqa: SLF001
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 634, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.badezimmer_absolute_feuchtigkeit') | float - states('sensor.wohnung_absolute_feuchtigkeit') | float) | round(2) }}' but no default was specified
2024-10-17 16:40:37.672 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.badezimmer_absolute_feuchtigkeit') | float - states('sensor.wohnung_absolute_feuchtigkeit') | float) | round(2) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.badezimmer_absolute_feuchtigkeit') | float - states('sensor.wohnung_absolute_feuchtigkeit') | float) | round(2) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.badezimmer_differenz_absolute_feuchte'

@jeroenterheerdt
Copy link
Owner

jeroenterheerdt commented Oct 17, 2024

most likely the sensors don't provide a value at boot, that's why you are getting this issue. that should not be blocking HA though. You should handle this by adding a delay on update or handle it in your template. This does not have anything to do with HADailySensor AFAIK.

@johannes1984
Copy link
Author

When I tried to edit the daily sensor the first time, HA was running for days, so the value was definetly set.

@jeroenterheerdt
Copy link
Owner

what's the value the sensors provide and what does the template evaluate to in the Template UI?

@Xenomes
Copy link

Xenomes commented Oct 18, 2024

The same issue occurs here: when editing a daily sensor, changing the sensor input, and saving, Home Assistant goes offline. I have to reboot Docker to get it back online. Current version: v2024.10.2. Last known working version: v2024.9.1.

Did a bypass edit in the file: core.config_entries pro with backup only.

@johannes1984
Copy link
Author

what's the value the sensors provide and what does the template evaluate to in the Template UI?

grafik

sensor.master_wohnung_temperatur is a Helper, combining two sensors to one, using arithmetic mean

@Julz007
Copy link

Julz007 commented Oct 22, 2024

I have had similar issues. HA locks up after changing from max to min and max to mean. That's all I have tried so far.

Core: 2024.10.3
Supervisor: 2024.10.2
Operating System: 13.2
Frontend: 20241002.3

@fleshinachair
Copy link

just had the same thing happen to me, updating an existing sensor and my home assistant logfile went from nothing to 200MB in a matter of minutes!

@jonvelle
Copy link

jonvelle commented Oct 23, 2024

Crash home assistant just when I want configure and change unit kwh to wh

@Jajjaman
Copy link

Same problem here. As soon as I try to change anything HA crashes. Have to reboot in Proxmox and booting takes a long time as it is writing BIG log.

@jeroenterheerdt
Copy link
Owner

unfortunately I don't know how to fix this :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants