home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.41k stars 30.65k forks source link

Ecowitt: broken after disabling then re-adding #129861

Open roens opened 5 hours ago

roens commented 5 hours ago

The problem

I needed to briefly take down my Ecowitt weather station (turns out a spider was blocking the rain sensor). And so as to not collect garbage data from the various sensors, I disabled the device in HA, assuming I would then be able to enable it afterward.

But after clearing the spider & cleaning things, I found the Ecowitt integration was no longer appearing in the list of active integrations, even if searched for in the active integrations view. So I then re-added the Ecowitt integration, which generated a new tokenized URL for my GW1200B to send metrics to.

I now have two Ecowitt devices. One has zero entities, and the other has the usual (for my setup) 27 entities. But none of those entities are receiving data from the Ecowitt gateway.

I might go to a forum for tips on working this out, but this situation seems like unexpected behavior with the Ecowitt integration. I could attempt deleting the ecowitt device that lacks any entities, but I'm not confident that will preserve the historical data HA has already collected from my weather station.

What version of Home Assistant Core has the issue?

core-2024.10.4

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

Ecowitt

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ecowitt

Diagnostics information

I've attempted to gather diagnostic data for the Ecowitt integration, and as my HA now has two, there are two opportunities for this data. However, both result in zero byte (empty) files downloaded from HA. When I turn off debug logging for Ecowitt, that produces a downloaded log file. The first time I tried this, it contains one stack trace attributed to Ecowitt, and is attached below.

I then tried this procedure again, restarting HA after enabling debug logging. This again resulted in two empty diagnostic data files. For this iteration of turning debug logging off, the resulting log file download contained zero mention of ecowitt.

home-assistant_ecowitt_2024-11-04T23-25-49.196Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

The only stack trace I found mentioning ecowitt (also contained within the log file attached in the "Diagnostics information" section above):

2024-11-03 21:58:20.511 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 299, in get
    data = await info.device_diagnostics(hass, config_entry, device)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/ecowitt/diagnostics.py", line 21, in async_get_device_diagnostics
    station = ecowitt.stations[station_id]
              ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'BF7D6A8828A04EF19E3C226B4CE1EA36'

Additional information

No response

home-assistant[bot] commented 5 hours ago

Hey there @pvizeli, mind taking a look at this issue as it has been labeled with an integration (ecowitt) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `ecowitt` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign ecowitt` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


ecowitt documentation ecowitt source (message by IssueLinks)