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

iMPK binary_sensor issue on html-card #6

Open
Krzysztonek opened this issue Sep 4, 2023 · 7 comments
Open

iMPK binary_sensor issue on html-card #6

Krzysztonek opened this issue Sep 4, 2023 · 7 comments

Comments

@Krzysztonek
Copy link

Krzysztonek commented Sep 4, 2023

My custom:html-card with the bus/tram timetable worked fine for me so far.

type: custom:html-card
card_mod:
  style: |
    ha-card {
    background-color: var(--primary-background-color);
    border-color: lime;
    border-radius: 5%
       }
content: >
  <br><font color="lime"><big><b><center>Powrót ze szkoły</center></big>
  <big><b><div><br></div></b></big>
  <i><center><font color="yellow">ul. Szpitalna - <font color="red">Przystanek
  tramwajowy T-10245<br><br></i></font><font color="white">
  [[ sensor.impk_10245.attributes.html_timetable ]]
  <br>

iMPK sensor has been defined as follows:

- platform: impk
  stops:
    - id: 10245

Also iMPK binary sensor has been defined:

- platform: impk
  monitored_conditions:
    - news

Since yesterday afternoon the following sudden issue has appeared:
obraz
I'm not sure if this is a html-card issue or iMPK integration problem. Both have been reinstalled, but it didn't resolve this issue.

@PiotrMachowski
Copy link
Owner

Is sensor.impk_10245 entity available?

@Krzysztonek
Copy link
Author

Krzysztonek commented Sep 4, 2023

no, this entity is NOT available :(

@PiotrMachowski
Copy link
Owner

Anything in HA logs?

@Krzysztonek
Copy link
Author

Krzysztonek commented Sep 4, 2023

Jjust an update: Following error just appeared in HA Logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 362, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/impk/sensor.py", line 42, in setup_platform
    raise Exception("Invalid stop id: {}".format(stop_id))
Exception: Invalid stop id: 11618

Does it mean that this stop is no longer available? I saw it on my html-card yesterday morning. I changed nothing in its code since then.

@PiotrMachowski
Copy link
Owner

I think that the stop has bee removed/changed and this is no longer available
https://www.wroclaw.pl/komunikacja/przystanek-oporow-linia-20-kierunek-zajezdnia-borek-slupek-11618

@Krzysztonek
Copy link
Author

Krzysztonek commented Sep 5, 2023

I already removed some stops which are no longer available. Now all the remaining sensor.impk_* entities are available.
However, it looks this is not only stop issue. I've just got following:

Logger: homeassistant.components.binary_sensor
Source: custom_components/impk/binary_sensor.py:70
Integration: Sensor binarny (documentation, issues)
First occurred: 09:50:48 (1 occurrences)
Last logged: 09:50:48

impk: Error on device update!

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 403, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1053, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 179, in _new_conn
    raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f2973849dd0>, 'Connection to 62.233.178.84 timed out. (connect timeout=None)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 798, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='62.233.178.84', port=8088): Max retries exceeded with url: /mobile?function=getNews (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f2973849dd0>, 'Connection to 62.233.178.84 timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/impk/binary_sensor.py", line 70, in update
    response = requests.get(address, auth=HTTPDigestAuth('android-mpk', 'g5crehAfUCh4Wust'), verify=False)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 507, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='62.233.178.84', port=8088): Max retries exceeded with url: /mobile?function=getNews (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f2973849dd0>, 'Connection to 62.233.178.84 timed out. (connect timeout=None)'))

Now it seems this is more a binary sensor issue, since the card hangs on the news which are not being displayed.
However, I can see the following when looking on the binary_sensor.impk_news.attributes.html section:

obraz

So, it looks the news are filled with data (see above), but they are not displayable due to some issue shown in the attached log.

@Krzysztonek Krzysztonek changed the title html-card error iMPK binary_sensor issue on html-card Sep 5, 2023
@PiotrMachowski
Copy link
Owner

The problem from logs might be caused by Internet problems or by problems on iMPK server. If attributes contain data then the card should display it

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