MTrab / energidataservice

Fetches spot prices from Energi Data Service
GNU General Public License v3.0
183 stars 26 forks source link

Integration cannot be configured and other entity not available #566

Closed Lauriz7 closed 2 months ago

Lauriz7 commented 2 months ago

Describe the issue

Integration entities consisting of tarrifs cannot be loaded. stopped reporting after 10:50 today. Other entity without tariffs reported still, but when restarted became unavailable. Log is for entity with tariffs.

Some errors with SSL.

Additional log added after HA restart.

What version of Home Assistant Core has the issue?

8.2

What was the last working version of Home Assistant Core?

8.2

What type of installation are you running?

Home Assistant OS

Diagnostics information

config_entry-energidataservice-781db64c7c5a73d8b25308ad6650d042.json

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Kilde: config_entries.py:604
Første forekomst: 13.45.00 (2 forekomster)
Senest logget: 22.50.42

Error setting up entry Energi Data Service - Forbrug for energidataservice
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1080, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs, sock=sock)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1149, in create_connection
    transport, protocol = await self._create_connection_transport(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1182, in _create_connection_transport
    await waiter
  File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 578, in _on_handshake_complete
    raise handshake_exc
  File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 560, in _do_handshake
    self._sslobj.do_handshake()
  File "/usr/local/lib/python3.12/ssl.py", line 917, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/async_retrying_ng/__init__.py", line 124, in wrapped
    ret = await ret
          ^^^^^^^^^
  File "/config/custom_components/energidataservice/tariffs/energidataservice/__init__.py", line 193, in async_call_api
    resp = await self.client.get(f"{BASE_URL}?{query}", headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1082, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.energidataservice.dk:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/energidataservice/__init__.py", line 54, in async_setup_entry
    result = await _setup(hass, entry)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/energidataservice/__init__.py", line 185, in _setup
    await api.async_get_tariffs()
  File "/config/custom_components/energidataservice/api.py", line 305, in async_get_tariffs
    self.tariff_data = await tariff.async_get_tariffs()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/energidataservice/tariffs/energidataservice/__init__.py", line 73, in async_get_tariffs
    resp = await self.async_call_api(query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_retrying_ng/__init__.py", line 203, in wrapped
    ret = await ret
          ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/async_retrying_ng/__init__.py", line 41, in callback
    await asyncio.sleep(attempt * delay)
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 665, in sleep
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Interrupted by interrupt context manager

Additional information

Logger: homeassistant.components.sensor Kilde: helpers/entity_platform.py:598 integration: Sensor (dokumentation, problemer) Første forekomst: 22.57.58 (1 forekomster) Senest logget: 22.57.58

Error adding entity sensor.energi_data_service for domain sensor with platform energidataservice Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1080, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1149, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1182, in _create_connection_transport await waiter File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 578, in _on_handshake_complete raise handshake_exc File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 560, in _do_handshake self._sslobj.do_handshake() File "/usr/local/lib/python3.12/ssl.py", line 917, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 598, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 912, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1365, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/energidataservice/sensor.py", line 605, in async_added_to_hass await self.validate_data() File "/config/custom_components/energidataservice/sensor.py", line 405, in validate_data await self._api.update() File "/config/custom_components/energidataservice/api.py", line 172, in update await api.async_get_spotprices() File "/config/custom_components/energidataservice/connectors/energidataservice/init.py", line 83, in async_get_spotprices resp = await self.client.get(url, headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1082, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.energidataservice.dk:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')]

Lauriz7 commented 2 months ago

Entities are reporting now after rep update. thanks