Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive Errors #12

Open
daconrad0 opened this issue Oct 29, 2020 · 8 comments
Open

Excessive Errors #12

daconrad0 opened this issue Oct 29, 2020 · 8 comments

Comments

@daconrad0
Copy link

I have installed the integration and it seems to be working. The issue is that device goes into power saving mode and then the errors in HA pile up. When not in power saving mode, it works great. See below

Logger: custom_components.dlink_hnap.binary_sensor
Source: custom_components/dlink_hnap/dlink.py:126
Integration: dlink_hnap (documentation, issues)
First occurred: October 28, 2020, 10:09:17 PM (12330 occurrences)
Last logged: 3:17:49 PM

failed to update water sensor
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.37', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/config/custom_components/dlink_hnap/dlink.py", line 116, in call
result = await self.soap().call(method, **kwargs)
File "/config/custom_components/dlink_hnap/dlink.py", line 253, in call
resp = await self.session.post(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.37:80 ssl:default [Connect call failed ('192.168.1.37', 80)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/dlink_hnap/binary_sensor.py", line 142, in async_update
water_detected = await self._sensor.water_detected()
File "/config/custom_components/dlink_hnap/dlink.py", line 206, in water_detected
await self._cache_soap_actions()
File "/config/custom_components/dlink_hnap/dlink.py", line 192, in _cache_soap_actions
resp = await self.client.soap_actions(self.module_id)
File "/config/custom_components/dlink_hnap/dlink.py", line 106, in soap_actions
return await self.call("GetModuleSOAPActions", ModuleID=module_id)
File "/config/custom_components/dlink_hnap/dlink.py", line 112, in call
await self.login()
File "/config/custom_components/dlink_hnap/dlink.py", line 57, in login
resp = await self.call(
File "/config/custom_components/dlink_hnap/dlink.py", line 120, in call
self._bad_response()
File "/config/custom_components/dlink_hnap/dlink.py", line 126, in _bad_response
raise Exception("got error response from device")
Exception: got error response from device

@daconrad0
Copy link
Author

I checked with DLink and there is not a way to prevent the sensor from going into power saver mode.

@postlund
Copy link
Owner

postlund commented Nov 1, 2020

Yeah, all errors will produce log output right now. Would be great to improve this by not repeating unnecessary errors. PRs are welcome!

@kintaroju
Copy link

hi @postlund, I've installed your plugin and so far it doesn't seem to pull the data as expected.

020-11-02 14:45:47 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating dlink_hnap binary_sensor took longer than the scheduled update interval 0:00:05 2020-11-02 14:45:52 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.basement_laundry is taking over 10 seconds 2020-11-02 14:45:52 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating dlink_hnap binary_sensor took longer than the scheduled update interval 0:00:05 2020-11-02 14:45:53 ERROR (MainThread) [custom_components.dlink_hnap.dlink] Got an error, resetting private key 2020-11-02 14:45:53 ERROR (MainThread) [custom_components.dlink_hnap.binary_sensor] failed to update water sensor Traceback (most recent call last): File "/config/custom_components/dlink_hnap/dlink.py", line 116, in call result = await self.soap().call(method, **kwargs) File "/config/custom_components/dlink_hnap/dlink.py", line 253, in call resp = await self.session.post( File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 504, in _request await resp.start(conn) File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 860, in start self._continue = None File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 596, in __exit__ raise asyncio.TimeoutError from None asyncio.exceptions.TimeoutError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/dlink_hnap/binary_sensor.py", line 142, in async_update water_detected = await self._sensor.water_detected() File "/config/custom_components/dlink_hnap/dlink.py", line 206, in water_detected await self._cache_soap_actions() File "/config/custom_components/dlink_hnap/dlink.py", line 192, in _cache_soap_actions resp = await self.client.soap_actions(self.module_id) File "/config/custom_components/dlink_hnap/dlink.py", line 106, in soap_actions return await self.call("GetModuleSOAPActions", ModuleID=module_id) File "/config/custom_components/dlink_hnap/dlink.py", line 112, in call await self.login() File "/config/custom_components/dlink_hnap/dlink.py", line 57, in login resp = await self.call( File "/config/custom_components/dlink_hnap/dlink.py", line 120, in call self._bad_response() File "/config/custom_components/dlink_hnap/dlink.py", line 126, in _bad_response raise Exception("got error response from device") Exception: got error response from device

I have the DCH-S160 (currently testing), and a DCH-S161 (currently disabled in HA).

I am wondering how long does the data poll to HA as I was putting a cup of water to the sensor to see if HA would change the binary state of the sensor, but unfortunately in the entity data it never shows any changes:

image

If you have ideas what could be wrong, that would be great.

@postlund
Copy link
Owner

postlund commented Nov 3, 2020

Since the request times out I would assume the IP address is not correct. Double verify that it is correct.

@Hyrules
Copy link

Hyrules commented Jan 27, 2021

Like daconrad0 says the problem is that the sensor goes into power save mode and does not stay connected to the wifi network. It will connect once in a while to report it's value. So that's why there are excessive errors. Catching those exceptions would be a start. It's normal to not get a response from the sensor if you go to it's ip address when in power save mode. The application mydlink will still give you the status of the sensor last time it reported. Reducing the error amount would also be a start. This behavior from the sensor is totally normal. It will only wake up if there is any reason for it to report a value. I might try myself at forking an PRing...

@kintaroju
Copy link

kintaroju commented Jan 27, 2021

Since the request times out I would assume the IP address is not correct. Double verify that it is correct.

I did check the setup, and the IPs are correct and the password to the device was setup correctly. I vaguely remember in December when i was troubleshooting the issue I believe the DCH-S161 uses a different protocol to communicate (device control protocol) vs the DCH-s160 (HNAP).

@bwohlgamuth
Copy link

Just installed the water leak sensor today and I’m getting the same error:
Got an error, resetting private key

And then my home assistant log getting just FILLED with errors until I disable the integration. Any ideas?

@RaddedMC
Copy link

Old thread but I'm having the same issue with my sensor

But one thing I'll try is having my Ubiquiti UniFi system (not yet installed but will be soon) detect when my water alarm (and smoke alarm from another brand) connect and send notifications that way, will notify if I can figure something out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants