google / python-lakeside

Apache License 2.0
45 stars 18 forks source link

eufy platform error: maximum recursion depth exceeded while calling a Python object #23

Open drthanwho opened 1 year ago

drthanwho commented 1 year ago

Using this package through Home Assistant's Eufy core integration results to the following error. It's unclear to me how this arises though as to me it seems random. It can work fine for a long time and then one day it no longer does.

2021-10-13 19:09:42 ERROR (MainThread) [homeassistant.components.switch] 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()
  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 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

The actual log is 2K lines long and Github won't let me upload it. Full log here

dehnert commented 1 year ago

It sounds like #15 might be the same issue, but more details of what's happening.