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

Eufy light switch control stops working #33605

Closed
gblachstein opened this issue Apr 3, 2020 · 46 comments
Closed

Eufy light switch control stops working #33605

gblachstein opened this issue Apr 3, 2020 · 46 comments

Comments

@gblachstein
Copy link

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

@dereitz
Copy link

dereitz commented Apr 9, 2020

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.

@nanowireUK
Copy link

nanowireUK commented Apr 11, 2020

New HA user here with fresh Hass.io set up starting at ~107.5. Eufy integration config is just the username and password. Having exactly the same issue as described.

Bulbs have DHCP static IPs on same network as HA. I’m rarely getting more than a day of it working before having to restart HA. Bulbs stay controllable through Eufy app at all times.

@akcamperdude
Copy link

Same issues here. Eufy integration is almost unusable currently.

@DoctorOctagonapus
Copy link

I've got three T1012s set up the same way with local access tokens and mine are at times really sluggish and occasionally failing to update at all. I don't currently have any stacktraces in my logs, but I've had over 1000 "Updating eufy light took longer than the scheduled interval" messages over the course of two days. My lights have good days and bad days but it could be anything up to a couple of minutes before they respond to controls from Hass. The Eufyhome app is always lightning fast and like OP restarting Hass or power cycling the bulb will fix the issue for a time.

@dclobato
Copy link
Contributor

I have eleven T102 light bulbs that were working fine on 0.89... I updated to 0.113.0 and they are barely working, as described above. My log id full of "Updating eufy light took longer than the scheduled update interval 0:00:30".

Afaik, there were no updates on lakeside component, so there were no changes on how HA handles Eufy lights. Am I right?

If I restart HA, they work fine for hours/days and, suddenly, start to ignore commands from the HA, but keep working on eufy app...

@eh8
Copy link

eh8 commented Aug 28, 2020

Auto-discovery doesn't work with T1012 smart bulbs, both on my trusted LAN and segregated IoT VLAN.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 26, 2021
@DoctorOctagonapus
Copy link

I can confirm this is still an issue on the latest version. Sometimes it works, sometimes it times out.

@jloutsenhizer
Copy link
Contributor

+1 this is still happening to me on `2021.1.4, light bulbs continue to be fully responsive via google home even with homeassistant is failing to control them.

@gblachstein
Copy link
Author

This is still an issue with core-2021.1.5.

@github-actions github-actions bot removed the stale label Jan 26, 2021
@dereitz
Copy link

dereitz commented Jan 26, 2021

Agreed, this is still an intermittent issue.

@nanowireUK
Copy link

As others have said, it is still an issue but my impression is that it has become less frequent over the last 6 months.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 30, 2021
@gblachstein
Copy link
Author

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

@dereitz
Copy link

dereitz commented Apr 30, 2021

Agreed, this is still an intermittent issue. It's just one of those things I've learned to workaround though... :(

@github-actions github-actions bot removed the stale label Apr 30, 2021
@DoctorOctagonapus
Copy link

DoctorOctagonapus commented Apr 30, 2021

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.

@DoctorOctagonapus
Copy link

DoctorOctagonapus commented May 25, 2021

OK I tried switching the config to add my e-mail address and Eufy password in case that made it any better. I thought it seemed more stable at first but it is still a problem. To give you an idea, here is a log entry. Over the course of 19 hours this broken integration has failed to do its job over nine hundred times. The app works perfectly, as does my Google Home, which is linked directly to EufyHome, rather than pulling the lights from HA.

Logger: homeassistant.components.light
Source: helpers/entity_platform.py:657
Integration: Light (documentation, issues)
First occurred: 24 May 2021, 22:14:07 (938 occurrences)
Last logged: 17:33:11

Updating eufy light took longer than the scheduled update interval 0:00:30

@DoctorOctagonapus
Copy link

Someone (not a dev) did some digging and found this dependency issue, which may be causing the problem. google/python-lakeside#2

@github-actions
Copy link

github-actions bot commented Sep 3, 2021

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 3, 2021
@eh8
Copy link

eh8 commented Sep 3, 2021

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

@DoctorOctagonapus
Copy link

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.

@github-actions github-actions bot removed the stale label Sep 3, 2021
@DoctorOctagonapus
Copy link

Since it looks like no one's planning on fixing this any time, does anyone on here know anything about Python who could shed some light on how to fix it ourselves? If we can work out a fix we can just fork the thing and use it as a custom integration or something.

From the python-lakeside issue I linked before: "I used pip3 to attempt to install everything in the import statements and it started working fine." Well obviously there's no pip3 here so does that mean it's set somewhere else?

Here are all the import statements I've found in https://github.com/google/python-lakeside.

setup.py:

import re
from setuptools import setup, find_packages
import sys
import warnings

I also found this in setup.py, which might be relevant

install_requires=[
        "protobuf",
        "pycryptodome",
        "requests",
    ]

init.py

from Crypto.Cipher import AES
import random
import requests
import socket
import struct
import threading
import time

from . import lakeside_pb2

lakeside_pb2.py

import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2

Since I'm very much not a programmer and am not familiar with the environment HassOS runs, I have no idea where to go from here. I'd appreciate any pointers.

@kjake
Copy link

kjake commented Sep 21, 2021

My Eufy switches have been unavailable since August 29. I switched my config to just username and password and it did not resolve it.

I checked the Eufy API as documented in the Home Assistant docs and it still exists and works as documented, so this isn't a change to their platform that has broken something.

Logger: homeassistant.components.switch
Source: components/eufy/switch.py:26 
Integration: Switch (documentation, issues) 
First occurred: 8:41:15 PM (2 occurrences) 
Last logged: 8:41:19 PM

Error while setting up eufy platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/eufy/switch.py", line 11, in setup_platform
    add_entities([EufySwitch(discovery_info)], True)
  File "/usr/src/homeassistant/homeassistant/components/eufy/switch.py", line 26, in __init__
    self._switch.connect()
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 229, in connect
    return device.connect(self)
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 66, in connect
    self.update()
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 246, in update
    response = self.get_status()
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 242, in get_status
    response = self.send_packet(packet, True)
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 232, in send_packet
    return device.send_packet(self, packet, response)
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 90, in send_packet
    self.connect()

[-- snip hundreds of repeating lines --]

  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 239, in get_status
    packet.sequence = self.get_sequence()
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 235, in get_sequence
    return device.get_sequence(self)
  File "/usr/local/lib/python3.9/site-packages/lakeside/__init__.py", line 112, in get_sequence
    packet.sequence = random.randrange(3000000)
  File "/usr/local/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 702, in field_setter
    new_value = type_checker.CheckValue(new_value)
  File "/usr/local/lib/python3.9/site-packages/google/protobuf/internal/type_checkers.py", line 152, in CheckValue
    if not isinstance(proposed_value, numbers.Integral):
  File "/usr/local/lib/python3.9/abc.py", line 119, in __instancecheck__
    return _abc_instancecheck(cls, instance)
  File "/usr/local/lib/python3.9/abc.py", line 123, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
RecursionError: maximum recursion depth exceeded while calling a Python object

I was able to fix my devices by unplugging them and plugging them back in. The Eufy Home app always worked though. Seem like the error is ultimately with the Lakeside library?

@DoctorOctagonapus
Copy link

DoctorOctagonapus commented Nov 25, 2021

OK from a couple of weeks of using the custom integration, I can confirm it works a hell of a lot better than the official version but it's not perfect. I don't know if anyone else can confirm but I've found it's a lot more stable if I configure it with the e-mail and password than if I use the access token approach. With that set up I'd say the failure rate is around 50% as opposed to the 90% failure I was seeing with the official integration. It does start to get less reliable the longer HA has been running as well, no idea why that is.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 15, 2022
@gblachstein
Copy link
Author

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@gblachstein
Copy link
Author

This is still an issue in the latest version.

@github-actions github-actions bot removed the stale label Jul 15, 2022
@DoctorOctagonapus
Copy link

Yeah the custom version I made isn't perfect but the official version is definitely still broken.

I think there might be something wrong with the lakeside component at the heart of the integration. If so we might be SOL because there's been no commits since 2019 and the guy who wrote it seems to have abandoned his account.

@duckbrain
Copy link

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. google/python-lakeside#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.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@DoctorOctagonapus
Copy link

This is still a problem.

@gblachstein
Copy link
Author

Yes, this is still a problem.

@gblachstein
Copy link
Author

Did anything change with the latest release? I don't see anything listed in the release notes, but I just upgraded to 2023.1.5 and all of my inactive Eufy switches are now showing active again without me having to have reset the devices manually. Can anyone else confirm?

@gblachstein
Copy link
Author

Nevermind, I updated to 2023.2.4 and it's broken again :(

@DoctorOctagonapus
Copy link

The latest release of HA Core has upgraded Lakeside from 0.12 to 0.13. Can anyone confirm if this fixes the issue?

The lakeside repo linked above has now been marked as archived, so it's likely now being maintained elsewhere.

@gblachstein
Copy link
Author

The latest release of HA Core has upgraded Lakeside from 0.12 to 0.13. Can anyone confirm if this fixes the issue?

The lakeside repo linked above has now been marked as archived, so it's likely now being maintained elsewhere.

It is now working for me. I had to remove your custom component to get it working properly.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@akcamperdude
Copy link

I know there only seem to be a few of us who care, but it's still not working for me. These switches are nearly unusable via HA.

@gblachstein
Copy link
Author

I too am still having issues with these switches. They don't work at all now.

@dereitz
Copy link

dereitz commented Aug 7, 2023

I'd recommend giving up on the Eufy integration and going to Zigbee or something instead.

@gblachstein
Copy link
Author

It's been over three years since this integration has worked consistently. IMHO, it should either get fixed properly, or let people know that these switches will not work properly on the HA documentation page. The Eufy app and google assistant integration still works fine so they are what I currently use to control these switches.

@DoctorOctagonapus
Copy link

It's intermittent for me, at the moment it's OK about 80% of the time, but it's still problematic.

As we've said further up the thread it's not HA that's the issue, it's Lakeside that the integration depends on that's not working properly. The new repo has issues disabled as well so good luck telling them it's broken.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests