JaccoR / hass-entso-e

Integration for Home Assistant to fetch day ahead energy prices from European countries via ENTSO-e Transparency Platform
159 stars 25 forks source link

ApexChart Graph suddenly empty and average sensor error in log #127

Open TheBrankman opened 1 year ago

TheBrankman commented 1 year ago

Suddenly my ApexChart graphs stay empty. I have played a bit with the yAxis min setting, but changed that one back to original.

But I do not have any graph anymore. I changed everything back to original. This is the code of the card:

type: custom:apexcharts-card
graph_span: 24h
span:
  start: day
now:
  show: true
  label: Now
header:
  show: true
  title: Electriciteitsprijzen Vandaag (€/kwh)
yaxis:
  - decimals: 2
series:
  - entity: sensor.average_electricity_price_today
    stroke_width: 2
    float_precision: 3
    type: column
    opacity: 1
    color: ''
    data_generator: |
      return entity.attributes.prices.map((entry) => { 
      return [new Date(entry.time), entry.price];
      });

Than I noticed in the logs that the sensor.average_electricity_price_today could not be found.

I do have the sensor.dynamische_energieprijzen_average_electricity_price_today So I changed the code to:

type: custom:apexcharts-card
graph_span: 24h
span:
  start: day
now:
  show: true
  label: Now
header:
  show: true
  title: Stroomprijs vandaag (€/kWh)
series:
  - entity: sensor.dynamische_energieprijzen_average_electricity_price_today
    stroke_width: 2
    float_precision: 3
    type: column
    opacity: 1
    color: ''
    data_generator: |
      return entity.attributes.prices.map((record, index) => {
        return [record.time, record.price];
      });
yaxis:
  - id: Prijs
    decimals: 2
    min: 0

But the graphs still stay empty. I have waited a whole night and I have waited till the next polling moment.

In the log files I have found this:

Deze fout is ontstaan door een aangepaste integratie.

Logger: homeassistant.helpers.entity
Source: custom_components/entsoe/coordinator.py:213
Integration: ENTSO-e Transparency Platform (documentation, issues)
First occurred: 14:00:00 (1 occurrences)
Last logged: 14:00:00

Update for sensor.dynamische_energieprijzen_average_electricity_price_today fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
    await self.async_update()
  File "/config/custom_components/entsoe/sensor.py", line 134, in async_update
    self._attr_extra_state_attributes = {x: self.coordinator.processed_data()[x] for x in self.coordinator.processed_data() if x not in invalid_keys and x not in existing_entities}
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/entsoe/coordinator.py", line 171, in processed_data
    "min_price": self.get_min_price(filtered_hourprices),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/entsoe/coordinator.py", line 213, in get_min_price
    return min(hourprices.values())
           ^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: min() arg is an empty sequence
VictorvandenHoven commented 1 year ago

I have exactly the same problem:

2023-07-04 08:00:00.821 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.anwb_average_electricity_price_today fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await self.async_update()
File "/config/custom_components/entsoe/sensor.py", line 134, in async_update
self._attr_extra_state_attributes = {x: self.coordinator.processed_data()[x] for x in self.coordinator.processed_data() if x not in invalid_keys and x not in existing_entities}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 171, in processed_data
"min_price": self.get_min_price(filtered_hourprices),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 213, in get_min_price
return min(hourprices.values())
^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: min() arg is an empty sequence

image

TheBrankman commented 1 year ago

I have exactly the same problem:

2023-07-04 08:00:00.821 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.anwb_average_electricity_price_today fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await self.async_update()
File "/config/custom_components/entsoe/sensor.py", line 134, in async_update
self._attr_extra_state_attributes = {x: self.coordinator.processed_data()[x] for x in self.coordinator.processed_data() if x not in invalid_keys and x not in existing_entities}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 171, in processed_data
"min_price": self.get_min_price(filtered_hourprices),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/entsoe/coordinator.py", line 213, in get_min_price
return min(hourprices.values())
^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: min() arg is an empty sequence

image

Yes, your graph looks exactly as min, only the first bar is visible! When did this start for you, also since one day?

VictorvandenHoven commented 1 year ago

Yes, your graph looks exactly as min, only the first bar is visible! When did this start for you, also since one day?

Yep, since one day.

morini1 commented 1 year ago

Since Sunday i didn’t get new data from Api. So all empty now.

Axalian215 commented 1 year ago

Same issue here. Empty graphs

Tim16200 commented 1 year ago

Same issue here.

VictorvandenHoven commented 1 year ago

My chart is working again! Without changing anything btw.

Axalian215 commented 1 year ago

Apparently the entsoe api has a new version. See https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html)

So the creator of this plugin should implement this change aswell

Axalian215 commented 1 year ago

It's also working here now..strange

TheBrankman commented 1 year ago

It really is strange, for me it is still not working, even after a reboot.... unfortunatelly...

PV-Web commented 1 year ago

Having the same problem here. Still empty after 2 days. Also got a new API code but it is still not working. Following this.

jjvandenberg commented 1 year ago

The data contained in sensor.entso_average_electricity_price_today is from juli 2, seems to be stuck at that date, does not update.

PeterPasmans commented 1 year ago

Same issue here. The graph data stored in the attributes of the average_electricity_price_today got last updated on July 2 (including the data for July 3). On Monday July 3, the attributes where not updated in the afternoon (so no "tomorrow" data). On Tuesday July 4 there was no sensor data between 0:00 until 9:00. Since Tuesday 9:00 the sensor data like current electricity price is being updated, but the average_electricity_price_today attributes still contain the data for July 2 and 3.

Zakarumit commented 1 year ago

I am having the same issue for several days. This is what I have found in logs:

Logger: custom_components.entsoe.sensor Source: custom_components/entsoe/sensor.py:128 Integration: ENTSO-e Transparency Platform (documentation, issues) First occurred: July 5, 2023 at 16:51:41 (15 occurrences) Last logged: 11:20:53

Unable to update entity due to data processing error: None and error: min() arg is an empty sequence Unable to update entity due to data processing error: None and error: unsupported operand type(s) for /: 'NoneType' and 'float'

RogMoe commented 1 year ago

Remove old entso-e entry and creat new one with slightly different name solves the issue. Don't forget to adjust the new entity names in your apexchart.

TheBrankman commented 1 year ago

Remove old entso-e entry and creat new one with slightly different name solves the issue. Don't forget to adjust the new entity names in your apexchart.

For me, that did the trick!

ajouwens commented 12 months ago

Same here, thanks everyone :D

RogMoe commented 12 months ago

I just explained it... Are you sure you're in the right place?

marcel-st commented 12 months ago

I just explained it...

Hardly, but that happens when you're looking at it from differend angles. Sometimes ppl need a little more direction than just "remove this and add that".

Are you sure you're in the right place?

yeah, pretty sure i am.

Doesn't matter anyways, i already figured it out.

Ronm10 commented 12 months ago

I am one that need more info. What do I delete? Energyzero or anwb entso-e. Integration? Or something else. Help would be appreciated for a newbie

PeterPasmans commented 12 months ago

Yesterday I have removed the "stuck" entry from the ENTSO-e integration and created a new one (or two actually). The new one immediately filled with up-to-date data and was again updated this afternoon as it used to work before! Thanks for the solution RogMoe!

marcel-st commented 12 months ago

I am one that need more info. What do I delete? Energyzero or anwb entso-e. Integration? Or something else. Help would be appreciated for a newbie

Step 1: Go to the devices & services screen and open up the entso-e module. Now under “integration entities” add a new entry. Make sure you name it something that you remember. I used “energy” but feel free to choose any name.

Step 2: Go to your chart and replace the current sensor entry (which should be something like “sensor.entsoe_average_electricity_price_today”) with “sensor._average_electricity_price_today”

The chart should fill up again.

Ronm10 commented 12 months ago

Thanks that is what i needed. Works. Great thanks

schellekensonline commented 12 months ago

It worked for me too, but what is/was the cause of this issue? Is it a bug in the integration or did the transparency platform cause this and if so why did the integration not recover by it self?

RogMoe commented 12 months ago

I'm not sure, but I think it's within HA or its database. Apexchart works, so does entso-e. What remains is HA. I spent one hour looking for the glitch, but desided not to waiste more time on it. Deleting/re-creting/editing instances takes 3 minutes.

DannyOosterveer commented 2 weeks ago

This is a quite persistent and annoying error. I've been using the integration for over two years. Everytime the ENTSO-e API had some error, and there is no data available for some time, the integration seems to corrupt the data in sensors. Even after the data in the API is correct again, you can't use the previous sensors anymore. You'll have to delete the integration, add it again and change all our automations etc. Probably some better error handling is necessary when receiving empty or wrong data from the API...

mourmeer commented 1 week ago

I also keep having it....