mcclown / home-assistant-custom-components

Custom components for Home-Assistant
Apache License 2.0
18 stars 7 forks source link

Seneye USB timeouts #1

Open mcclown opened 5 years ago

mcclown commented 5 years ago

In some cases this error is thrown. I've updated the code to open and close the USB device in the update statement, which works fine when the device is only reading every 30 mins but is overkill for when light readings are implemented. Leaving here for tracking, for when that change is introduced.

usb.core.USBError: [Errno 19] No such device (it may have been disconnected) 2019-02-25 11:16:13 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.seneye_temperature 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 144, in async_update await self._data.async_update() File "/config/custom_components/sensor/seneye.py", line 161, in _async_update resp = self._device.action(Action.SENSOR_READING) File "/config/deps/lib/python3.6/site-packages/pyseneye/sud.py", line 584, in action self._write(cdef.cmd_str) File "/config/deps/lib/python3.6/site-packages/pyseneye/sud.py", line 557, in _write return self._instance.write(self._ep_out, msg) File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 948, in write self.get_timeout(timeout) File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 842, in intr_write timeout) File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 920, in write _check(retval) 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

I think the issue is in the underlying implementation, so I'm opening the issue there. https://github.com/mcclown/pyseneye/issues/4