StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
615 stars 111 forks source link

[BUG] Python issues? #773

Open alfureu opened 5 months ago

alfureu commented 5 months ago

Environment

Describe the bug

ShellyForHASS keeps crashing after roughly 24h of running. It was never doing it before, so I guess it is something that got introduced with the most recent update

Steps to Reproduce

Just run ShellyForHASS in a HA docker on a slower machine, it will happen.

Expected behavior

Should not crash, as with previous versions

Screenshots

N/A

Traceback/Error logs

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 374, in _update_loop

    self.check_by_ip()

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 241, in check_by_ip

    ip_addr = self._mdns.get_ip(*data['id'].split('|'))

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/pyShelly/mdns.py", line 19, in get_ip

    info = self._zeroconf.get_service_info(type, name)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_core.py", line 266, in get_service_info

    if info.request(self, timeout, question_type):

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "src/zeroconf/_services/info.py", line 778, in zeroconf._services.info.ServiceInfo.request

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_utils/asyncio.py", line 117, in run_coro_with_timeout

    raise EventLoopBlocked from ex

zeroconf._exceptions.EventLoopBlocked

2024-01-26 22:20:54.537 ERROR (Update loop) [pyShelly] Error update loop, , Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_utils/asyncio.py", line 113, in run_coro_with_timeout

    return asyncio.run_coroutine_threadsafe(aw, loop).result(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 458, in result

    raise TimeoutError()

TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 374, in _update_loop

    self.check_by_ip()

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 241, in check_by_ip

    ip_addr = self._mdns.get_ip(*data['id'].split('|'))

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/pyShelly/mdns.py", line 19, in get_ip

    info = self._zeroconf.get_service_info(type, name)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_core.py", line 266, in get_service_info

    if info.request(self, timeout, question_type):

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "src/zeroconf/_services/info.py", line 778, in zeroconf._services.info.ServiceInfo.request

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_utils/asyncio.py", line 117, in run_coro_with_timeout

    raise EventLoopBlocked from ex

zeroconf._exceptions.EventLoopBlocked

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_utils/asyncio.py", line 113, in run_coro_with_timeout

    return asyncio.run_coroutine_threadsafe(aw, loop).result(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 458, in result

    raise TimeoutError()

TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 374, in _update_loop

    self.check_by_ip()

  File "/usr/local/lib/python3.11/site-packages/pyShelly/__init__.py", line 241, in check_by_ip

    ip_addr = self._mdns.get_ip(*data['id'].split('|'))

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/pyShelly/mdns.py", line 19, in get_ip

    info = self._zeroconf.get_service_info(type, name)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_core.py", line 266, in get_service_info

    if info.request(self, timeout, question_type):

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "src/zeroconf/_services/info.py", line 778, in zeroconf._services.info.ServiceInfo.request

  File "/usr/local/lib/python3.11/site-packages/zeroconf/_utils/asyncio.py", line 117, in run_coro_with_timeout

    raise EventLoopBlocked from ex

zeroconf._exceptions.EventLoopBlocked

Additional context

Running HA as a docker: homeassistant/home-assistant:latest

auno88 commented 3 months ago

Good morning.

I have the same problem as you, everything updated to the latest version, and with docker.

The only difference is that it tells me "python3.12" instead of "python3.11", but exactly the same thing happens to me.

Have you solved it?