HADailySensor icon indicating copy to clipboard operation
HADailySensor copied to clipboard

HA Crash

Open Tntdruid opened this issue 1 year ago • 4 comments

When i edit any of the daily sesnsor Ha crash every time, is that a new bug?

Tntdruid avatar Oct 24 '24 08:10 Tntdruid

160 mb log file whit this:

ValueError: Config entry Min Jord Fugt (01J44W1PMAWH6FN2W4YF1T9BFX) for daily.sensor has already been setup! 2024-10-24 10:47:12.387 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Min Jord Fugt for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 131, in async_setup_entry return await hass.data[DATA_COMPONENT].async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 183, in async_setup_entry raise ValueError( ValueError: Config entry Min Jord Fugt (01J44W1PMAWH6FN2W4YF1T9BFX) for daily.sensor has already been setup!

Tntdruid avatar Oct 24 '24 08:10 Tntdruid

Same problem here.

Jajjaman avatar Oct 27 '24 12:10 Jajjaman

I am afraid I don't know how to fix this :(

jeroenterheerdt avatar Oct 29 '24 02:10 jeroenterheerdt

If i delete and recreated it works.

Tntdruid avatar Oct 29 '24 06:10 Tntdruid

Same here with a simple rename operation....

ValueError: Config entry Gázfogyasztás (Wh) (01JCB26PYRGZB6HEGR104M08JQ) for daily.sensor has already been setup! 2024-11-16 09:22:37.953 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Gázfogyasztás (Wh) for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 133, in async_setup_entry return await hass.data[DATA_COMPONENT].async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 186, in async_setup_entry raise ValueError( ValueError: Config entry Gázfogyasztás (Wh) (01JCB26PYRGZB6HEGR104M08JQ) for daily.sensor has already been setup! 2024-11-16 09:22:37.957 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Gázfogyasztás (Wh) for sensor

Vladx71 avatar Nov 16 '24 08:11 Vladx71

I have the same issue

OlofBailey avatar Jan 02 '25 10:01 OlofBailey

Same issue (v 2024.10.1). Core 2025.1.2 Supervisor 2024.12.3 Operating System 14.1 Frontend 20250109.0

Workaround: delete and recreate the sensor

Reinqusito avatar Jan 13 '25 15:01 Reinqusito

Yup HA restarts when you exit the sensor or name

stovedoctor avatar Jan 27 '25 17:01 stovedoctor

Same here, simply tried to rename a sensor...

lievendf avatar Feb 14 '25 08:02 lievendf

same issue if you try to edit and save it crashes i updated interval and ha will die

qvqn avatar Mar 01 '25 06:03 qvqn

same here, I got a heart attack when changing from 1800 to 60 seconds and everything was crashed. It took HA 5-10 min to come back again. This is no usable and I dont know if I remember in months/years to NOT change an entry instead of recreating it. This should be solved. I lil bit lost trust in this AddOn :-(

schr3cke avatar Mar 06 '25 08:03 schr3cke

I am afraid I don't know how to fix this :(

I’ve created a pull request to add support for dynamic configuration updates in the DailySensor integration.

The goal is to avoid Home Assistant crashes when editing existing sensors via the UI. Instead of throwing a ValueError on duplicate setup, the sensor now updates its configuration dynamically using a new async_update_config() method.

Let me know what you think.

lullatscho avatar Apr 06 '25 20:04 lullatscho

Awesome! Is there any chance you can make a PR?

jeroenterheerdt avatar Apr 06 '25 23:04 jeroenterheerdt

Awesome! Is there any chance you can make a PR?

PR is available for review by you

lullatscho avatar Apr 07 '25 12:04 lullatscho

Awesome! Is there any chance you can make a PR?

PR is available for review by you

thanks, but as mentioned in the PR this does not resolve anything, at least not on my machine. What are you seeing?

jeroenterheerdt avatar Apr 08 '25 02:04 jeroenterheerdt

Awesome! Is there any chance you can make a PR?

PR is available for review by you

thanks, but as mentioned in the PR this does not resolve anything, at least not on my machine. What are you seeing?

Hey,

I'm really sorry for submitting a pull request without thoroughly testing it first. I know it ended up causing issues and extra work on your end. I'll make sure to be more careful with testing in the future. Thanks a lot for your patience and all the hard work you put into the project.

I just wanted to let you know that I've submitted a new pull request. In this version, Home Assistant no longer crashes when changing the interval, and you can now update the interval for existing sensors on the fly. The adjustment of operation and unit is possible but will only take effect after a restart of HA.

Maybe you can test it.

lullatscho avatar Apr 09 '25 13:04 lullatscho

Thanks, I'll test it. I think we should also add support for updates to unit of measurement and other config options.

jeroenterheerdt avatar Apr 09 '25 17:04 jeroenterheerdt