core: Eufy light switch control stops working

The problem

Eufy light switches initially work but after some time they are no longer controllable from Hassio, The Eufy application still works fine when this occurs. Resetting the switch fixes the issue for a little while but the issue eventually comes back and the switch has to be reset again. The log file is filling up with looping error messages (currently 951 occurrences).

Environment

  • Home Assistant Core release with the issue: 107.7
  • Last working Home Assistant Core release (if known): never
  • Operating environment (Home Assistant/Supervised/Docker/venv): Hass.io on Pi 3B
  • Integration causing this issue: Eufy
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/eufy/

Problem-relevant configuration.yaml


eufy:
  username: email@gmail.com
  password: !secret eufy_password
  devices:
    - address: 192.168.7.134
      access_token: CAB97F9490E7410B
      type: T1211
      name: Smart Switch
    - address: 192.168.7.133
      access_token: 4D4CB87620254F87
      type: T1211
      name: Smart Switch
    - address: 192.168.7.108
      access_token: 8B25953ED3C94FA8
      type: T1211
      name: Smart Switch
    - address: 192.168.7.110
      access_token: CCDBAC1E1DAB4DF1
      type: T1211
      name: Smart Switch

Traceback/Error logs


2020-04-03 08:43:01 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.main_lights fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/eufy/switch.py", line 34, in update
    self._switch.update()
  File "/usr/local/lib/python3.7/site-packages/lakeside/__init__.py", line 246, in update
    response = self.get_status()
  File "/usr/local/lib/python3.7/site-packages/lakeside/__init__.py", line 242, in get_status
    response = self.send_packet(packet, True)
  File "/usr/local/lib/python3.7/site-packages/lakeside/__init__.py", line 232, in send_packet
    return device.send_packet(self, packet, response)
  File "/usr/local/lib/python3.7/site-packages/lakeside/__init__.py", line 97, in send_packet
    length = struct.unpack("<H", decrypted_packet[0:2])[0]
struct.error: unpack requires a buffer of 2 bytes

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 12
  • Comments: 46 (2 by maintainers)

Most upvoted comments

Same issue here – and it appears to be common among all Eufy components. In my case, I’m using a Eufy bulb. There have been some fixes in the past to address this that have helped, but I’m still intermittently seeing this issue. There are two workarounds I’m currently aware of:

  1. Restart the Eufy device (bulb in my case)
  2. Restart HASS

Both seem to resolve the issue for days->weeks.

It does look like python-lakeview isn’t being maintained, but there were a few people who submitted PRs against it to add a guard against malformed devices. I wonder if that patch could make it more resilient. https://github.com/google/python-lakeside/pull/20

Seeing as the dependency isn’t maintained and the code is simple, it’d probably be better to copy it into home assistant and apply the patch to maintain it in the future.

Eufy still fails to activate upon network discovery or manual specification of devices in configuration.yaml

The link I posted a couple of months ago has the solution. There is a dependency issue that needs fixing in the container. Until this is done this plugin will not work properly.

In my environment it is still very much intermittent and it is fairly random whether the light will respond immediately, after a delay of several minutes, or fail to respond at all.

Is there any serious intention of actually fixing this problem? This issue has been open for over a year with loads of people affected by it but it seems no one can be bothered to put any effort into coding a fix.

This is still an issue in the latest version of HA.