MTrab / energidataservice

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

Unavailable after midnight - Error setting up entry Energi Data Service #558

Closed Lauriz7 closed 1 month ago

Lauriz7 commented 1 month ago

Describe the issue

After midnight the service stops reporting and is unavailable, i have running automatic restart when its unavailable, but it fails until manual restart of integration.

At 14:50 08-08-2024 i also experienced API returned error 500 and at 14:33 it was API returned error 400, Bad Request!

I do not have log of integration yet, but i think my HA core log says a lot.

What version of Home Assistant Core has the issue?

6.2

What was the last working version of Home Assistant Core?

6.2

What type of installation are you running?

Home Assistant OS

Diagnostics information

home-assistant_2024-08-09T07-02-49.851Z.log

Anything in the logs that might be useful for us?

log #1

Logger: homeassistant.config_entries
Kilde: config_entries.py:594
Første forekomst: 6. august 2024 kl. 00.01.00 (7 forekomster)
Senest logget: 00.02.00

Error setting up entry Energi Data Service - Forbrug for energidataservice
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, 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 90, in _setup
    await api.initialize()
  File "/config/custom_components/energidataservice/api.py", line 100, in initialize
    await self._connectors.load_connectors()
  File "/config/custom_components/energidataservice/connectors/__init__.py", line 36, in load_connectors
    mod = await self.hass.async_add_executor_job(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Interrupted by interrupt context manager

log #2
Logger: custom_components.energidataservice.connectors.nordpool
Kilde: custom_components/energidataservice/connectors/nordpool/__init__.py:102
integration: Energi Data Service (dokumentation, problemer)
Første forekomst: 7. august 2024 kl. 12.48.33 (7 forekomster)
Senest logget: 00.10.51

Server blocked request

log #3

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

Error adding entity sensor.energi_data_service_forbrug for domain sensor with platform energidataservice
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, 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 168, in update
    await api.async_get_spotprices()
  File "/config/custom_components/energidataservice/connectors/nordpool/__init__.py", line 73, in async_get_spotprices
    raw = raw + self._parse_json(i)
                ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/energidataservice/connectors/nordpool/__init__.py", line 111, in _parse_json
    if "data" not in data:
       ^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Additional information

No response

MTrab commented 1 month ago

You added a logfile rather than diagnostics, could you please add the diagnostics as requested?

Lauriz7 commented 1 month ago

You added a logfile rather than diagnostics, could you please add the diagnostics as requested?

I just enabled diagnostics, so i would need to wait before the issue appears again I guess.

MTrab commented 1 month ago

No, you just need to click download diagnostics - no need to enable anything or wait for anything image

Lauriz7 commented 1 month ago

No, you just need to click download diagnostics - no need to enable anything or wait for anything image

config_entry-energidataservice-781db64c7c5a73d8b25308ad6650d042.json

Thats the file available.

In to addition, i have other entity configured without tarrifs, and it does not stop working.

File for the working entity:

config_entry-energidataservice-781db64c7c5a73d8b25308ad6650d042 (3).json

MTrab commented 1 month ago

Seems like this is somehow related to the 500 errors we have seen the last few days from Energi Data Service API. Handling of this should be fixed in the latest version of the integration, released today.