google / python-lakeside

Apache License 2.0
46 stars 18 forks source link

Errors in Eufy setup with home-assistant #2

Open jmutnick opened 6 years ago

jmutnick commented 6 years ago

Getting this error on Home Assistant startup. I have verified my credentials are correct.

2018-04-28 08:03:16 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform eufy Traceback (most recent call last): File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for return fut.result() File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/eufy.py", line 20, in setup_platform add_devices([EufySwitch(discovery_info)], True) File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/eufy.py", line 37, in init self._switch.connect() File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 201, in connect return device.connect(self) File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 56, in connect self.update() File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 218, in update response = self.get_status() File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 214, in get_status response = self.send_packet(packet, True) File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 204, in send_packet return device.send_packet(self, packet, response) File "/home/pi/homeassistant/lib/python3.5/site-packages/lakeside/init.py", line 74, in send_packet length = struct.unpack("<H", decrypted_packet[0:2])[0] struct.error: unpack requires a bytes object of length 2

mjg59 commented 6 years ago

What sort of device is this?

Desterly commented 6 years ago

EDITED:

I'm was getting the same issue In my case it's a T1202 switch and the send_packet() method called from get_status() is returning 0 bytes in the response, which fails with the above error on struct.unpack (decrypted data also 0).

I ended up unplugging the device, plugging it back in and then it reported correctly.

Apparently if the device goes into an unknown state it will sometimes still connect via wifi but can't control the device state.

jmutnick commented 6 years ago

I got mine working. It was a missing dependancy. I used pip3 to attempt to install everything in the import statements and it started working fine. Sorry for the false alarm.

fiservedpi commented 5 years ago

I'm having the same issue on HAssio 0.86.4 with eufy component can you tell me the fix ?

Sat Feb 02 2019 11:36:34 GMT-0500 (Eastern Standard Time)

Error while setting up platform eufy
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
fiservedpi commented 5 years ago

Here is my log from a fresh install of HA 0.87.1 on UnRaid with only the eufy component added https://pastebin.com/3ttqkVsS

DoctorOctagonapus commented 2 years ago

OK I've created a custom version of the HA Eufy integration with all the unmet dependencies I've found added into the manifest.json for use in HassOS. It works miles better than the official HA integration (read: it actually works at all), but becomes increasingly unreliable the longer HA is running. I can't tell if I've missed something or the problem really is with Lakeside and we're stuck with it until this gets updated.

https://github.com/DoctorOctagonapus/HA-Eufy-Integration/blob/main/manifest.json

dehnert commented 2 years ago

Here is my log from a fresh install of HA 0.87.1 on UnRaid with only the eufy component added https://pastebin.com/3ttqkVsS

This log looks like the same issue as #23 ?