erlendsellie / priceanalyzer

Priceanalyzer for Home Assistant, based on Nordpool Prices.
64 stars 5 forks source link

Gives false today top 5 value #28

Open rinowit opened 1 year ago

rinowit commented 1 year ago

Hello, I have a updated HA with a updated priceanalyzer 1.4. I have a Issue that priceanalyzer is showing false on today top 5 and top 10 when it should be true. It's showing the right value on the attribute list. But wrong value in "current hour"

I was running priceanalyzer 1.0 for a while and had to downgrade from 1.4 a while ago as the value was broken in the newer HA releases. Now the HA was update in may and the value for 1.0 is also broken.

Display name
Low price
false
Tomorrow valid
false
Max
1,31
Min
0,94
Price difference is small
false
Price difference is small tomorrow
Ukjent
Peak
1,04
Off peak 1
1,05
Off peak 2
1,07
Average
1,06
Average tomorrow
Ukjent
Current hour
start: '2023-05-22T11:00:00+02:00'
end: '2023-05-22T12:00:00+02:00'
value: 1.063
price_next_hour: 0.967
price_in_2_hours: 0.936
is_gaining: false
is_falling: true
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is falling and not low price
Raw today
- start: '2023-05-22T00:00:00+02:00'
end: '2023-05-22T01:00:00+02:00'
value: 1.053
price_next_hour: 1.031
price_in_2_hours: 1.027
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T01:00:00+02:00'
end: '2023-05-22T02:00:00+02:00'
value: 1.031
price_next_hour: 1.027
price_in_2_hours: 1.028
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T02:00:00+02:00'
end: '2023-05-22T03:00:00+02:00'
value: 1.027
price_next_hour: 1.028
price_in_2_hours: 1.03
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T03:00:00+02:00'
end: '2023-05-22T04:00:00+02:00'
value: 1.028
price_next_hour: 1.03
price_in_2_hours: 1.047
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T04:00:00+02:00'
end: '2023-05-22T05:00:00+02:00'
value: 1.03
price_next_hour: 1.047
price_in_2_hours: 1.029
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T05:00:00+02:00'
end: '2023-05-22T06:00:00+02:00'
value: 1.047
price_next_hour: 1.029
price_in_2_hours: 1.143
is_gaining: true
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T06:00:00+02:00'
end: '2023-05-22T07:00:00+02:00'
value: 1.029
price_next_hour: 1.143
price_in_2_hours: 1.309
is_gaining: true
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 1
reason: Is gaining, and not in five most expensive hours
- start: '2023-05-22T07:00:00+02:00'
end: '2023-05-22T08:00:00+02:00'
value: 1.143
price_next_hour: 1.309
price_in_2_hours: 1.196
is_gaining: true
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: true
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T08:00:00+02:00'
end: '2023-05-22T09:00:00+02:00'
value: 1.309
price_next_hour: 1.196
price_in_2_hours: 1.158
is_gaining: false
is_falling: true
is_max: true
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: true
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is max
- start: '2023-05-22T09:00:00+02:00'
end: '2023-05-22T10:00:00+02:00'
value: 1.196
price_next_hour: 1.158
price_in_2_hours: 1.063
is_gaining: false
is_falling: true
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: true
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is falling and not low price
- start: '2023-05-22T10:00:00+02:00'
end: '2023-05-22T11:00:00+02:00'
value: 1.158
price_next_hour: 1.063
price_in_2_hours: 0.967
is_gaining: false
is_falling: true
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: true
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is falling and not low price
- start: '2023-05-22T11:00:00+02:00'
end: '2023-05-22T12:00:00+02:00'
value: 1.063
price_next_hour: 0.967
price_in_2_hours: 0.936
is_gaining: false
is_falling: true
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is falling and not low price
- start: '2023-05-22T12:00:00+02:00'
end: '2023-05-22T13:00:00+02:00'
value: 0.967
price_next_hour: 0.936
price_in_2_hours: 0.981
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: true
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T13:00:00+02:00'
end: '2023-05-22T14:00:00+02:00'
value: 0.936
price_next_hour: 0.981
price_in_2_hours: 0.997
is_gaining: false
is_falling: false
is_max: false
is_min: true
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: true
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T14:00:00+02:00'
end: '2023-05-22T15:00:00+02:00'
value: 0.981
price_next_hour: 0.997
price_in_2_hours: 1.006
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: true
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T15:00:00+02:00'
end: '2023-05-22T16:00:00+02:00'
value: 0.997
price_next_hour: 1.006
price_in_2_hours: 1.049
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: true
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T16:00:00+02:00'
end: '2023-05-22T17:00:00+02:00'
value: 1.006
price_next_hour: 1.049
price_in_2_hours: 1.061
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: false
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: true
is_five_cheapest: true
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T17:00:00+02:00'
end: '2023-05-22T18:00:00+02:00'
value: 1.049
price_next_hour: 1.061
price_in_2_hours: 1.11
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T18:00:00+02:00'
end: '2023-05-22T19:00:00+02:00'
value: 1.061
price_next_hour: 1.11
price_in_2_hours: 1.093
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T19:00:00+02:00'
end: '2023-05-22T20:00:00+02:00'
value: 1.11
price_next_hour: 1.093
price_in_2_hours: 1.078
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: true
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T20:00:00+02:00'
end: '2023-05-22T21:00:00+02:00'
value: 1.093
price_next_hour: 1.078
price_in_2_hours: 1.057
is_gaining: false
is_falling: false
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T21:00:00+02:00'
end: '2023-05-22T22:00:00+02:00'
value: 1.078
price_next_hour: null
price_in_2_hours: 1.057
is_gaining: null
is_falling: null
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T22:00:00+02:00'
end: '2023-05-22T23:00:00+02:00'
value: 1.057
price_next_hour: null
price_in_2_hours: 1.057
is_gaining: null
is_falling: null
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
- start: '2023-05-22T23:00:00+02:00'
end: '2023-05-23T00:00:00+02:00'
value: 1.045
price_next_hour: null
price_in_2_hours: 1.057
is_gaining: null
is_falling: null
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: false
price_percent_to_average:
- null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: 0
reason: No need to correct..
Raw tomorrow
Ten cheapest today
- start: '2023-05-22T11:00:00+00:00'
end: '2023-05-22T12:00:00+00:00'
value: 0.936
- start: '2023-05-22T10:00:00+00:00'
end: '2023-05-22T11:00:00+00:00'
value: 0.967
- start: '2023-05-22T12:00:00+00:00'
end: '2023-05-22T13:00:00+00:00'
value: 0.981
- start: '2023-05-22T13:00:00+00:00'
end: '2023-05-22T14:00:00+00:00'
value: 0.997
- start: '2023-05-22T14:00:00+00:00'
end: '2023-05-22T15:00:00+00:00'
value: 1.006
- start: '2023-05-22T00:00:00+00:00'
end: '2023-05-22T01:00:00+00:00'
value: 1.027
- start: '2023-05-22T01:00:00+00:00'
end: '2023-05-22T02:00:00+00:00'
value: 1.028
- start: '2023-05-22T04:00:00+00:00'
end: '2023-05-22T05:00:00+00:00'
value: 1.029
- start: '2023-05-22T02:00:00+00:00'
end: '2023-05-22T03:00:00+00:00'
value: 1.03
- start: '2023-05-21T23:00:00+00:00'
end: '2023-05-22T00:00:00+00:00'
value: 1.031
Five cheapest today
- start: '2023-05-22T11:00:00+00:00'
end: '2023-05-22T12:00:00+00:00'
value: 0.936
- start: '2023-05-22T10:00:00+00:00'
end: '2023-05-22T11:00:00+00:00'
value: 0.967
- start: '2023-05-22T12:00:00+00:00'
end: '2023-05-22T13:00:00+00:00'
value: 0.981
- start: '2023-05-22T13:00:00+00:00'
end: '2023-05-22T14:00:00+00:00'
value: 0.997
- start: '2023-05-22T14:00:00+00:00'
end: '2023-05-22T15:00:00+00:00'
value: 1.006
Ten cheapest tomorrow
Ukjent
Five cheapest tomorrow
Ukjent
erlendsellie commented 1 year ago

Hi! I can't see any differences between the currenthour-attribute and the list item for the same hour (2023-05-22T11:00:00+02:00) for the raw_today-attribute in your pasted text?

Is that what you meant?

start: '2023-05-22T11:00:00+02:00'
end: '2023-05-22T12:00:00+02:00'
value: 1.063
price_next_hour: 0.967
price_in_2_hours: 0.936
is_gaining: false
is_falling: true
is_max: false
is_min: false
is_low_price: false
is_over_peak: true
is_over_average: true
price_percent_to_average: null
is_ten_cheapest: false
is_five_cheapest: false
is_five_most_expensive: false
is_falling_a_lot_next_hour: false
temperature_correction: -1
reason: Is falling and not low price

In the Five cheapest today on the other hand, we find this:

start: '2023-05-22T11:00:00+00:00'
end: '2023-05-22T12:00:00+00:00'
value: 0.936

Note that this is two hours later (as this timestring does not have a timezone-value), and another value. I think the bug here is that the 'top 5' and 'top 10' values does not add timezone's to the date-string? 2023-05-22T11:00:00+02:00 is rightly not in top 5 or top 10.

Tip: Add code-snippets like this (without the -) to format it nicely in markdown:

-```yaml
code: code
-```
rinowit commented 1 year ago

How can I correct the time issue? You are probably right.

Thanks for helping

erlendsellie commented 1 year ago

Well, you can submit a PR, or wait for me to fix it, hehe. It's not technically wrong per se, since 2023-05-22T11:00:00+00:00 is the same date and time as 2023-05-22T11:00:00+02:00. So the current_hour attribute will be correct. The time is just displayed differently, but is the same time, regardless.

This can be visually validated with the apex chart for the component: image

I'll keep the issue open, and fix it once i have some time to fix it :-)

rinowit commented 1 year ago

Aha:) I understand now:) Thank you so much:)