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

Watchdog: Connection is down --> how to recover from this? #324

Closed
djvanhelmond opened this issue Dec 3, 2024 · 1 comment
Closed

Watchdog: Connection is down --> how to recover from this? #324

djvanhelmond opened this issue Dec 3, 2024 · 1 comment

Comments

@djvanhelmond
Copy link

I'm reading the real time data from Tibber Pulse with the example real time from the README. After a while (I haven't detected a set interval, usually a few days) the connection dies and the Watchdog isn't in a position to recover from it.

Watchdog: Connection is down, 2024-12-03 09:50:55.895295+00:00
Error in watchdog connect, retrying in 20 seconds, 1:
Watchdog: Connection is down, 2024-12-03 09:51:41.377171+00:00
Error in watchdog connect, retrying in 19 seconds, 2: Event loop is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/tibber/realtime.py", line 155, in _watchdog
    await self._resubscribe_homes()
  File "/usr/local/lib/python3.13/site-packages/tibber/realtime.py", line 177, in _resubscribe_homes
    await asyncio.gather(*[home.rt_resubscribe() for home in self._homes])
  File "/usr/local/lib/python3.13/site-packages/tibber/home.py", line 508, in rt_resubscribe
    await asyncio.gather(
    ...<4 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/tibber/home.py", line 203, in update_info
    if data := await self._tibber_control.execute(UPDATE_INFO % self._home_id):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tibber/__init__.py", line 98, in execute
    resp = await self.websession.post(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 579, in _request
    handle = tm.start()
  File "/usr/local/lib/python3.13/site-packages/aiohttp/helpers.py", line 573, in start
    return self._loop.call_at(when, self.__call__)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 808, in call_at
    self._check_closed()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 552, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

It stays in this loop until I restart the script.

@Danielhiversen
Copy link
Owner

Danielhiversen commented Dec 10, 2024

You may need more error handling than the test script.
For a real example, you could take a look at https://github.com/home-assistant/core/tree/dev/homeassistant/components/tibber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants