finity69x2 / nws_alerts

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

NWS creating multiple sensors, which then become unavailable. Especially happening on restarts #22

Closed rpitera closed 2 years ago

rpitera commented 3 years ago

Using NWS Alerts 2.1 on a HA OS install which is running in a VirtualBox hosted on a Win10 Pro dedicated PC.

System Health

version core-2021.8.8
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.6
os_name Linux
os_version 5.10.53
arch x86_64
timezone America/New_York
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4761 Installed Version | 1.14.0 Stage | running Available Repositories | 879 Installed Repositories | 66
AccuWeather can_reach_server | ok -- | -- remaining_requests | 14
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | September 16, 2021, 8:00 PM relayer_connected | true remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 6.2 -- | -- update_channel | stable supervisor_version | supervisor-2021.06.8 docker_version | 20.10.6 disk_total | 30.8 GB disk_used | 19.1 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (9.1.3), ADB - Android Debug Bridge (0.8.0), ESPHome (2021.8.0), Visual Studio Code (3.6.2), Let's Encrypt (4.11.0), Node-RED (10.0.0), Home Assistant Google Drive Backup (0.104.3), MariaDB (2.4.0), Check Home Assistant configuration (3.8.0), Glances (0.13.0), Vaultwarden (Bitwarden) (0.13.0), Portainer (2.0.0), Tautulli (2.3.0), phpMyAdmin (0.5.0), php-nginx Docker Image (latest), rest980 Docker Image (20200205), ioBroker (0.8.0), eufy_security_addon (0.3.3)
Lovelace dashboards | 2 -- | -- resources | 50 views | 28 mode | storage

For a few weeks now, I've been seeing multiple NWS Alert sensors showing up which seem to work for a short time, then become unavailable. These sensors are named the same as my primary sensor, with a number appended to the end. It's wasn't a major issue to me as the primary valid sensor is still working, so I was just deleting the unavailable ones, thinking that it might just be a small bug that would get cleared up in a new version. It seemed to happen most often when I restarted HA or rebooted the host VBox, though I've seen it happen while HA was up and stable as well.

I tried reinstalling (via HACS) as well as uninstalling/installing (again via HACS) to see if that would fix it but no go. I upped the integration's logging level to debug, but all I see is the standard messages that show the regular updates of data. Never had this issue with the integration in the past and while it's getting a little annoying to keep deleting the unavailable/invalid sensors, my main concern is there is some bug that I should report instead of just ignoring it.

Not finding anything of value in the debug logs of the integration, can you suggest other components I should be debugging or other procedure I can add to add some value to my issue? Like I said, I'm not seeing anything in the logs ATM besides standard update messages but I'll rerun the debug logs again and post them if you think it might help.

Thanks! NWS Alerts is important to me and it's always been solid up to now. Even rolling back didn't seem to help, but I'll gladly do it again if you need the data. (Maybe I didn't roll back far enough?)

afxefx commented 3 years ago

Same issue here. I thought it may have been due to the preexisting sensor from my 1.9.1 install so I uninstalled nws_alerts, rebooted HA, reinstalled nws_alerts and rebooted. All was fine for a day or so but then after a reboot the issue returned with a new sensor and the old being unavailable. I was able to roll back(uninstall/reboot/install 1.9.1/reboot) to 1.9.1 in the interim.

majorsl commented 3 years ago

Adding an unhelpful "same here". I'll probably roll back in the interim.

finity69x2 commented 2 years ago

I'm using v2.1 as well and I'm not seeing this. Restarted HA many times.

So I'm not sure how to fix it. can anyone give any additional info?

are you using the config UI or are you using yaml to configure the sensor?

rpitera commented 2 years ago

I'm not seeing this behavior anymore; it seemed to have stopped sometime during the last few HA updates so it must have been tied to something that got updated in Core. I was using the config UI, BTW.

I'm good with closing this as long as @afxefx and @majorsl aren't seeing it anymore either - once they check in, if they're good too we can check it off as a core anomaly and close this.

afxefx commented 2 years ago

I just uninstalled and updated again and will see if the issue persists. If we could leave this open for a day or so to give me time to report back and perform a few subsequent reboots to see if the issue returns that would be greatly appreciated.

majorsl commented 2 years ago

I just fixed mine as well. I'll reboot at some point over the weekend and see what happens.

rpitera commented 2 years ago

No problem - that's why I indicated I'd wait until I heard back from you guys; I wanted to make sure it wasn't just working for me.

afxefx commented 2 years ago

Must have been something related to core, as previously mentioned, since I've rebooted quite a few times and no duplicate sensors so I'm ok with closing this.

rpitera commented 2 years ago

OK, closing this one. @majorsl if you're still having the issue, feel free to reopen with any additional info.

KutonnoZer0 commented 2 years ago

@rpitera I have the same issue, I reinstall but the issue didn't go away, I'm running home assistant on the Home assistant blue.

Version core-2021.9.7 supervisor-2021.09.0

Operating System Home Assistant OS 6.4

rpitera commented 2 years ago

@KutonnoZer0 - I'll reopen this issue then, but I'll leave it up to you to continue it as I no longer have the issue. I'd suggest running nws_alerts in debug and posting your logs here so @finity69x2 can see if there's anything of note in them. Cheers and good luck!

KutonnoZer0 commented 2 years ago

thanks, I will

KutonnoZer0 commented 2 years ago

Well, it fixed himself

rpitera commented 2 years ago

OK, then I'll close it again - thanks and glad to hear it's working for you!

hawkeye217 commented 2 years ago

I have the same thing still happening on 2.1 (even after reinstalling and uninstalling/reinstalling). Whenever I restart HA, a new entity is created (sensor.nws_alerts_2) and the original (sensor.nws_alerts) is unavailable. I can remove the first one and rename the second one and then my automations/Lovelace cards work correctly again.

It's just annoying to have to do this on every restart of HA.

The only related error message I see in my HA logs is for one of my template sensors created from one of the nws_alerts sensor.

I don't know enough about how sensor entities are created at startup, but I wonder if the template sensor or any of my automations referencing the sensor has something to do with it?

rpitera commented 2 years ago

@hawkeye217 - Please give some details of your setup; what version of HA, how is it installed, etc.

hawkeye217 commented 2 years ago

@hawkeye217 - Please give some details of your setup; what version of HA, how is it installed, etc.

System Health

version core-2021.8.6
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.9.6
os_name Linux
os_version 5.4.0-86-generic
arch x86_64
timezone America/Chicago
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4770 Installed Version | 1.15.2 Stage | running Available Repositories | 888 Installed Repositories | 15
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Lovelace dashboards | 3 -- | -- resources | 12 views | 21 mode | storage
rpitera commented 2 years ago

Whatever caused me to open this issue seemed to have gone away when I updated to 2021.9.x and I'm not seeing any more sensors created since, so I am assuming for the time that the issue was in the Core. If there isn't another issue that is keeping you from updating, that would be my first suggestion and it seems to have worked for the others as well.

hawkeye217 commented 2 years ago

Just updated to HA 2021.9.7. Same issue :(

hawkeye217 commented 2 years ago

I'm using YAML to configure the sensor, if that detail helps to debug.

rpitera commented 2 years ago

OK, I'll reopen this for you and then you can close it when it's resolved.

finity69x2 commented 2 years ago

My previous version of HA was 2021.8.3. configured the integration via the UI and I had no issues.

I'm now running 2021.9.7 and my UI configured sensor is working fine.

I also just created a yaml configured sensor and it's showing the same behavior as what you are seeing.

I'll get it looked at.

firstof9 commented 2 years ago

The weird part is when I do the tests for this, no errors pop up.

firstof9 commented 2 years ago

I'm using YAML to configure the sensor, if that detail helps to debug.

Do you only have 1 YAML sensor setup? or a YAML+UI configured sensor?

hawkeye217 commented 2 years ago

My configuration.yaml has the following:

  - platform: nws_alerts
    zone_id: 'TXC439,TXZ119'
firstof9 commented 2 years ago

Ok let me hammer at this a bit

firstof9 commented 2 years ago

I think I have it solved in the latest PR #25

finity69x2 commented 2 years ago

in coordination with @firstof9 he hopefully got it all worked out now.

drafted a new release available in HACS soon.

hawkeye217 commented 2 years ago

Thanks! I'll test it and report back. Appreciate the quick turn-around!

hawkeye217 commented 2 years ago

Just installed the new version with HACS, after a 2nd restart (to obtain the new sensor ID), all is good! Thanks!

@rpitera. feel free to close this now.