rnovacek / homeassistant_cz_energy_spot_prices

Home Assistant integration that provides current Czech electricity spot prices based on OTE.
Apache License 2.0
75 stars 17 forks source link

spot_electricity_is_cheapest_X_hours_block is time shifted by +2 hours #28

Closed kislik-git closed 9 months ago

kislik-git commented 1 year ago

Hello Radek,

today SPOT prices: https://www.ote-cr.cz/cs/kratkodobe-trhy/elektrina/denni-trh?date=2023-05-31

Two cheapest hours block start at 13:00:00 and stop at 14:59:59. Now is 14:15 and block is still off. Four cheapest hours block start at 11:00:00 and stop at 14:59:59. Time is 14:15 and block is on.

It looks like the blocks are shifted by two hours. Timezone is UTC +2 / Central European Summer Time (CEST).

Attributes of 2_hours_block and 4_hours_block:

Start: 2023-05-31T13:00:00+02:00 Start hour: 13 End: 2023-05-31T14:59:59+02:00 End hour: 14 Min: 1.02354 Max: 1.16939 Mean: 1.096465 icon: mdi:cash-clock friendly_name: Spot Electricity Is Cheapest 2 Hours Block

Start: 2023-05-31T11:00:00+02:00 Start hour: 11 End: 2023-05-31T14:59:59+02:00 End hour: 14 Min: 1.02354 Max: 2.05585 Mean: 1.352705 icon: mdi:cash-clock friendly_name: Spot Electricity Is Cheapest 4 Hours Block

Pavel

kislik-git commented 1 year ago

There is some other problem in hours blocks. 2 hour block was in On state in last week (25.5. - 31.5.) only 3 times.

4 hour block was in On state in last week (25.5. - 31.5.) only 5 times.

Pavel

kkoouu commented 1 year ago

It happened to me as well now ... though block sensor's attributes Start/End show correct values, sensor value is not changed. I saw an error in log (below) - probably short network outage. After reloading the integration everything is fine and values switched immediately. Is it possible to have a sensor reflecting that all the stuff is reloaded correctly ? Or any other way of detecting this issue ? Maybe the processing is stopped after this error occurs and the switching part is skipped while we have all the required info to do so.

This error originated from a custom integration.

Logger: custom_components.cz_energy_spot_prices.coordinator
Source: helpers/update_coordinator.py:237
Integration: Czech Energy Spot Prices (documentation, issues)
First occurred: June 20, 2023 at 12:00:05 (13 occurrences)
Last logged: 10:00:01

Error requesting Czech Energy Spot Prices data: Cannot connect to host www.cnb.cz:443 ssl:default [Try again]
Error requesting Czech Energy Spot Prices data: Server disconnected
Error requesting Czech Energy Spot Prices data: Cannot connect to host www.ote-cr.cz:443 ssl:default [Connection reset by peer] 
rnovacek commented 9 months ago

I believe this is fixed in 0.6.0. It was caused by failing to fetch the data from OTE servers which then fail to update the update the actual sensor value.

Please reopen if you still see the problem.