finity69x2 / nws_alerts

An updated version of the nws_alerts custom integration for Home Assistant
84 stars 29 forks source link

Sensor failing to load latest HA Version #75

Closed ryanupp closed 3 months ago

ryanupp commented 3 months ago

Hi,

After a recent HA update the sensor is failing to load and I'm seeing the following in my logs:

HA Versions: Core 2024.5.2 Supervisor 2024.05.1 Operating System 12.3 Frontend 20240501.1

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:356 integration: Sensor (documentation, issues) First occurred: 8:50:50 AM (1 occurrences) Last logged: 8:50:50 AM

Error while setting up nws_alerts platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/nws_alerts/sensor.py", line 57, in async_setup_platform config.entry_id = slugify(f"{config.get(CONF_ZONE_ID)}") ^^^^^^^^^^^^^^^ AttributeError: 'NodeDictClass' object has no attribute 'entry_id'

madsci1016 commented 3 months ago

Can confirm, you just beat me coming here to post the same thing. I use this to put my DIY powerwall into "storm mode" when severe weather is in the alert, so really would like to get this working again. @finity69x2 help us, you are our only hope!

madsci1016 commented 3 months ago

I'm super rusty at python, but i suspect we weren't suppose to be passing entry.id back to config like that, but using the async_add_entities callback instead, just based on reading some of the builtin integrations. But i do not know how to do that correctly.

finity69x2 commented 3 months ago

Posting back here to let @ryanupp to try to configure the sensor via the UI.

I tested it and it will still work via the UI but not yaml. TBH, I may have to just let the yaml config option die as it's getting way past my technical expertise to try to fix it.

ryanupp commented 3 months ago

@finity69x2 Thank you! Removing my config from yaml and setting up via UI worked perfectly. I feel a bit foolish for even opening this now, somehow I missed that setup via UI was even an option. Appreciate the help!

finity69x2 commented 3 months ago

No problem. Glad to help.