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

[Bug]: SSL Certificate Verification Error for MOHU Budapest (former FKF Budapest) #3683

Open
7 tasks done
bakoscsaba opened this issue Jan 25, 2025 · 0 comments
Open
7 tasks done

Comments

@bakoscsaba
Copy link

I Have A Problem With:

A specific source

What's Your Problem

Source provider for Budapest changed from FKF to MOHU. The new source address is: https://mohubudapest.hu/hulladeknaptar
In the fkf_bp_hu.py file I changed every fkf.hu entry to mohubudapest.hu. It was working for 1-2 days then the integration stopped working.

In the log I found the following error message:
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.mohubudapest.hu', port=443): Max retries exceeded with url: /hulladeknaptar (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1018)')))

Source (if relevant)

fkf_bp_hu

Logs

2025-01-22 20:00:23.957 ERROR (SyncWorker_2) [custom_components.waste_collection_schedule.waste_collection_schedule.source_shell] fetch failed for source MOHU Budapest:
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
        conn,
    ...<5 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
    ~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 1061, in _validate_conn
    conn.connect()
    ~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
                ~~~~~~~~~~~~~~~^
        sock=conn,
        ^^^^^^^^^^
    ...<8 lines>...
        tls_in_tls=tls_in_tls,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/urllib3/util/ssl_.py", line 458, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
        sock, context, tls_in_tls, server_hostname=server_hostname
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/util/ssl_.py", line 502, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        sock=sock,
        ^^^^^^^^^^
    ...<5 lines>...
        session=session
        ^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/ssl.py", line 1076, in _create
    self.do_handshake()
    ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/ssl.py", line 1372, in do_handshake
    self._sslobj.do_handshake()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1018)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
        method=request.method,
    ...<9 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 802, in urlopen
    retries = retries.increment(
        method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/util/retry.py", line 594, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.mohubudapest.hu', port=443): Max retries exceeded with url: /hulladeknaptar (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1018)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 158, in fetch
    entries: Iterable[Collection] = self._source.fetch()
                                    ~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/fkf_bp_hu.py", line 39, in fetch
    r = session.post(
        API_URL,
    ...<6 lines>...
        },
    )
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 698, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.mohubudapest.hu', port=443): Max retries exceeded with url: /hulladeknaptar (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1018)')))

Relevant Configuration

2025-01-22 20:00:23.925 DEBUG (MainThread) [custom_components.waste_collection_schedule.init_ui] Setting up entry 01JHQ9APRB18SFCXCDTQNFR61N, with data {'args': {'district': '1011', 'house_number': '10', 'street': 'Apród utca'}, 'name': 'fkf_bp_hu'} and options {'calendar_title': 'FKF Budapest', 'customize': {'Communal': {'dedicated_calendar_title': 'Communal waste', 'show': True, 'use_dedicated_calendar': True}, 'Selective': {'dedicated_calendar_title': 'Recycle waste', 'show': True, 'use_dedicated_calendar': True}}, 'day_offset': 0, 'day_switch_time': '10:00', 'fetch_time': '01:00', 'random_fetch_time_offset': 60, 'sensors': [{'additional': False, 'date_template': '{{value.date.strftime("%a, %Y-%m-%d")}}', 'details_format': 'appointment_types', 'name': 'Communal waste schedule', 'skip': False, 'types': ['Communal'], 'value_template': '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}'}, {'date_template': '{{value.date.strftime("%a, %Y-%m-%d")}}', 'details_format': 'appointment_types', 'name': 'Selective waste schedule', 'types': ['Selective'], 'value_template': '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}'}], 'separator': ', '}

Checklist Source Error

  • Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
  • Checked that the website of your service provider is still working
  • Tested my attributes on the service provider website (if possible)
  • I have tested with the latest version of the integration (master) (for HACS in the 3 dot menu of the integration click on "Redownload" and choose master as version)

Checklist Sensor Error

  • Checked in the Home Assistant Calendar tab if the event names match the types names (if types argument is used)

Required

  • I have searched past (closed AND opened) issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
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

1 participant