hass-entso-e icon indicating copy to clipboard operation
hass-entso-e copied to clipboard

ApexChart Graph suddenly empty and average sensor error in log

Open TheBrankman opened this issue 1 year ago • 27 comments

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

TheBrankman avatar Jul 04 '23 14:07 TheBrankman

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

VictorvandenHoven avatar Jul 04 '23 14:07 VictorvandenHoven

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?

TheBrankman avatar Jul 04 '23 15:07 TheBrankman

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.

VictorvandenHoven avatar Jul 04 '23 15:07 VictorvandenHoven

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

morini1 avatar Jul 04 '23 15:07 morini1

Same issue here. Empty graphs

Axalian215 avatar Jul 04 '23 16:07 Axalian215

Same issue here.

Tim16200 avatar Jul 04 '23 17:07 Tim16200

My chart is working again! Without changing anything btw.

VictorvandenHoven avatar Jul 04 '23 18:07 VictorvandenHoven

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 avatar Jul 04 '23 19:07 Axalian215

It's also working here now..strange

Axalian215 avatar Jul 05 '23 05:07 Axalian215

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

TheBrankman avatar Jul 05 '23 06:07 TheBrankman

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

PV-Web avatar Jul 05 '23 09:07 PV-Web

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

jjvandenberg avatar Jul 05 '23 17:07 jjvandenberg

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.

PeterPasmans avatar Jul 05 '23 21:07 PeterPasmans

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'

Zakarumit avatar Jul 06 '23 09:07 Zakarumit

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.

RogMoe avatar Jul 06 '23 10:07 RogMoe

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!

TheBrankman avatar Jul 06 '23 11:07 TheBrankman

Same here, thanks everyone :D

ajouwens avatar Jul 06 '23 20:07 ajouwens

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

RogMoe avatar Jul 07 '23 11:07 RogMoe

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.

marcel-st avatar Jul 07 '23 12:07 marcel-st

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

Ronm10 avatar Jul 07 '23 18:07 Ronm10

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!

PeterPasmans avatar Jul 07 '23 18:07 PeterPasmans

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.

marcel-st avatar Jul 07 '23 18:07 marcel-st

Thanks that is what i needed. Works. Great thanks

Ronm10 avatar Jul 07 '23 19:07 Ronm10

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?

schellekensonline avatar Jul 08 '23 06:07 schellekensonline

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.

RogMoe avatar Jul 08 '23 12:07 RogMoe

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...

DannyOosterveer avatar Jun 14 '24 21:06 DannyOosterveer

I also keep having it....

mourmeer avatar Jun 25 '24 12:06 mourmeer

v0.4.0 is released this version contains fixes that solve a lot of warnings and known issues. This issue is probably also solved. Please update to the latest version. Closing this issue for now. If you still have issue please feel free to open a new issue.

Roeland54 avatar Aug 31 '24 11:08 Roeland54

v0.4.0 is released this version contains fixes that solve a lot of warnings and known issues. This issue is probably also solved. Please update to the latest version. Closing this issue for now. If you still have issue please feel free to open a new issue.

Thanks for the fix! One day to the next, my graph stopped working and the dynamic energy prices from ENTSO-e stopped showing. After the update everything worked again. I had this problem before and then I had to reset all the sensors, not a very big problem, but not really convenient.

LenFaki avatar Sep 12 '24 06:09 LenFaki