sebr / bhyve-home-assistant

Orbit BHyve custom component for Home Assistant
MIT License
252 stars 42 forks source link

BHyve is flooding my logs #190

Closed Pirol62 closed 1 year ago

Pirol62 commented 1 year ago

Describe the bug Hundrets of log entries

BHyve devices 1 device Orbit 21004 B-hyve Smart Hose Faucet Timer with Wi-Fi Hub. Device Diagnostics

Diagnostics could not been loaded

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:143
Integration: Orbit B-hyve (documentation)
First occurred: 21:11:43 (74 occurrences)
Last logged: 21:15:02

Unexpected error 503, message='Invalid response status', url=URL('wss://api.orbitbhyve.com/v1/events')

Please attach the Home Assistant diagnostics for the B-hyve device. Sensitive information is redacted when compiling the diagnostic data.

-->

Pirol62 commented 1 year ago

I looked into the logfile and found this:

2023-05-22 21:19:40.124 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/config/custom_components/bhyve/pybhyve/client.py", line 77, in _request
resp.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 503, message='Service Unavailable', url=URL('https://api.orbitbhyve.com/v1/devices?t=1684783179.9466968')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/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 85, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 246, in get
data = await info.config_entry_diagnostics(hass, config_entry)
File "/config/custom_components/bhyve/diagnostics.py", line 32, in async_get_config_entry_diagnostics
devices = await bhyve.devices
File "/config/custom_components/bhyve/pybhyve/client.py", line 193, in devices
await self._refresh_devices()
File "/config/custom_components/bhyve/pybhyve/client.py", line 89, in _refresh_devices
self._devices = await self._request(
File "/config/custom_components/bhyve/pybhyve/client.py", line 80, in _request
raise RequestError(f"Error requesting data from {url}: {err}") from err
custom_components.bhyve.pybhyve.errors.RequestError: Error requesting data from https://api.orbitbhyve.com/v1/devices: 503, message='Service Unavailable', url=URL('https://api.orbitbhyve.com/v1/devices?t=1684783179.9466968')
2023-05-22 21:19:45.185 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/config/custom_components/bhyve/pybhyve/client.py", line 77, in _request
resp.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 502, message='Bad Gateway', url=URL('https://api.orbitbhyve.com/v1/devices?t=1684783185.002888')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/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 85, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 246, in get
data = await info.config_entry_diagnostics(hass, config_entry)
File "/config/custom_components/bhyve/diagnostics.py", line 32, in async_get_config_entry_diagnostics
devices = await bhyve.devices
File "/config/custom_components/bhyve/pybhyve/client.py", line 193, in devices
await self._refresh_devices()
File "/config/custom_components/bhyve/pybhyve/client.py", line 89, in _refresh_devices
self._devices = await self._request(
File "/config/custom_components/bhyve/pybhyve/client.py", line 80, in _request
raise RequestError(f"Error requesting data from {url}: {err}") from err
custom_components.bhyve.pybhyve.errors.RequestError: Error requesting data from https://api.orbitbhyve.com/v1/devices: 502, message='Bad Gateway', url=URL('https://api.orbitbhyve.com/v1/devices?t=1684783185.002888')
zSprawl commented 1 year ago

This started happening to me as well today. I try to visit the url mentioned and it says bad request. I’m guessing they changed APIs? I know Sebr has been working on this addon recently so hopefully he’s on it.

Pirol62 commented 1 year ago

That's what I did as well. Even the app doesn't work and has no connect to the cloud. The contact to bHyve seems to be back meanwhile but I lost the battery sensor. There is somnething going wrong with this component.

TomAutoHome commented 1 year ago

MAY 22 B-HYVE APP CONNECTIVITY ISSUES We are currently aware of an app issue that either does not allow you to log in to your B-hyve app or shows all of your devices are disconnected. We are working diligently on a fix for this and will update the community page and this article when we have a fix for this. We appreciate your patience during this time and apologize for any inconvenience this may cause or has caused.

Updates can be found here.

Coincidentally, I have been installing B-Hyve custom component in more or less the same time, then experiencing above issues. My first thought was that's a component failure, and honestly started to little bit panic. Then, finally I restored my device and connected again (after few failures with mail failures, etc.). I started to search the reason my rain sensor does not actually work when triggered, and found this message on top of community support page.

Hopefully, this occurrences are gone as of now!

Pirol62 commented 1 year ago

@TomAutoHome Thanks for the info. I will pin this forum.

But as a request: If there are connection errors, wouldn't it make sense to reduce the number of logs? There is no need to have one entry every 30 seconds. Is it possible to reduce the logging in that case to one per 5 minutes or something similar?

Pirol62 commented 1 year ago

Issue seem to be solved.