Skip to content

Some logs to investigate ? #175

@coserotondo

Description

@coserotondo

Describe the bug
Just to highlight two logs related to the integration that could require more investigation.

Error message
At HA reboot I have the following logs that seems to be related to the integration?

2024-12-09 21:30:15.515 WARNING (Thread-7 (_do_shutdown)) [homeassistant.util.executor] Thread[SyncWorker_6] is still running at shutdown: File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/econnect_metronet/devices.py", line 193, in has_updates
    data = self._connection.poll({key: value for key, value in self._last_ids.items()})
  File "/usr/local/lib/python3.12/site-packages/elmo/api/decorators.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/elmo/api/client.py", line 137, in poll
    response = self._session.post(self._router.update, data=payload)
  File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 463, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/usr/local/lib/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.12/socket.py", line 708, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.12/ssl.py", line 1252, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.12/ssl.py", line 1104, in read
    return self._sslobj.read(len, buffer)

Then I receives (during normal HA run) the following:

2024-12-10 15:51:58.537 ERROR (MainThread) [custom_components.econnect_metronet.coordinator] Unexpected error fetching econnect_metronet data
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/elmo/api/decorators.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/elmo/api/client.py", line 633, in query
    raise err
  File "/usr/local/lib/python3.13/site-packages/elmo/api/client.py", line 628, in query
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://metronet.iessonline.com/api/statusadv
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/config/custom_components/econnect_metronet/coordinator.py", line 69, in _async_update_data
    status = await self.hass.async_add_executor_job(self._device.has_updates)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/econnect_metronet/devices.py", line 192, in has_updates
    self._connection.query(q.ALERTS)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/elmo/api/decorators.py", line 27, in func_wrapper
    raise InvalidToken
elmo.api.exceptions.InvalidToken: Used token is not valid. You must authenticate again.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/econnect_metronet/coordinator.py", line 84, in _async_update_data
    return await self.hass.async_add_executor_job(self._device.update)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/econnect_metronet/devices.py", line 294, in update
    raise err
  File "/config/custom_components/econnect_metronet/devices.py", line 281, in update
    sectors = self._connection.query(q.SECTORS)
  File "/usr/local/lib/python3.13/site-packages/elmo/api/decorators.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/elmo/api/client.py", line 632, in query
    raise DeviceDisconnectedError
elmo.api.exceptions.DeviceDisconnectedError: Device is disconnected

Environment

  • Operating System (OS): HAOS 14.0
  • Library version (commit or version number): 2.4.1
  • Home Assistant version: 2024.12.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions