mcclown / pyseneye

A module for interacting with Seneye range of aquarium and pond sensors
Apache License 2.0
8 stars 4 forks source link

Device can't be found after period of time. #4

Open mcclown opened 5 years ago

mcclown commented 5 years ago

This is tested with a client that is querying the SUD once every 30 mins. When it fails I'm seeing the error shown before.

Platform Hass.io 0.87.0 on Raspberry Pi

2019-03-07 22:39:57 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.seneye_nh3 fails Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state await self.async_device_update() File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update await self.async_update() File "/config/custom_components/sensor/seneye.py", line 148, in async_update await self._data.async_update() File "/config/custom_components/sensor/seneye.py", line 164, in _async_update device = SUDevice() File "/config/deps/lib/python3.6/site-packages/pyseneye/sud.py", line 527, in init if dev.is_kernel_driver_active(0): File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 1061, in is_kernel_driver_active self._ctx.managed_open() File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper return f(self, *args, **kwargs) File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 120, in managed_open self.handle = self.backend.open_device(self.dev) File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 786, in open_device return _DeviceHandle(dev) File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 643, in init _check(_lib.libusb_open(self.devid, byref(self.handle))) File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 19] No such device (it may have been disconnected)

mcclown commented 5 years ago

Uptime:

March 05 - 1:56 - March 7th 22:09 (about 68 hours) - Restart OS fixed it. March 07 - 23:21 - Mar 10th 22:05 (about 69.5 hours) - Restart OS fixed it

mcclown commented 5 years ago

Moved system to HASS OS with HA 0.93 and it's even more unstable now. It is only managing to get an hour or two of reads before falling over now. Still investigating.

I've tried simulating this on a Raspbian system and have had uptimes of a couple of weeks, with no issues. I suspect this is related to the Hass.io and HASS OS images/OSes.

joakimsk commented 3 years ago

I have seen this on a Raspbian system as well, I had the program running for around a week without problem, and then it stops talking to the seneye. I have not yet figured out why, but I restart the raspberry pi manually when this happens. I will try to investigate next time it happens.