kotope / aio_energy_management

Home Assistant All-In-One Energy Management integration
MIT License
16 stars 0 forks source link

Cheapest electricity hours -sensor not toggling correctly #33

Open teelahti opened 3 hours ago

teelahti commented 3 hours ago

I used the old script-based approach for a long time without issues, but now AIO based one has a new, weird bug: The cheapest hours sensor does not turn to "on" correctly.

Here's my setup:

Screenshot 2024-10-21 at 9 26 59

Here's the sensor information and attributes. As seen, the sensor did not correctly turn on. Failsafe is not on either.

Screenshot 2024-10-21 at 8 50 29

What's even weirder is that the calendar shows correct data; cheapest hours should have started at 01.00.

Screenshot 2024-10-21 at 8 50 49

Based on the above I feel like there is some kind of bug in the current logic, but I'm out of ideas how to debug this further.

kotope commented 2 hours ago

Few basic questions again:

teelahti commented 2 hours ago

Running the latest; I had the issue with restart previously. Restarted day before yesterday, and this toggling issue has happened twice since. As I did not restart yesterday I assumed it is not related to same problem (but I might be wrong).

Looking at my own screenshots I noticed now that the cheapest times list in the sensor is correct, the main state just doesn't change correctly.

kotope commented 2 hours ago

Thanks for the info. It's indeed odd that the binary sensor status is wrong, but attributes seems to be fine.

There's few things that can get wrong on that point:

So, a followup questions:

Anyhow I agree that there's probably some bug on the code now caused with some specific config or setting. I haven't noticed it on my dev or prod env at all and I've got quite bunch of different configurations running.

Ps. your first_hour is 00 even though it should be 0. Should not matter though, but I'd suggest of changing that just to make sure.

teelahti commented 51 minutes ago

My home assistant locale is country FI, language en-GB.

This has now happened on two consecutive nights after the last restart. So I don't know whether it is random, or started to happen consistently after the restart. It used to work before, and I didn't change any of AIO settings. That's why I'm puzzled.

I changed the first hour, thanks for noticing!

kotope commented 25 minutes ago

I'll make a similar config to my dev env to see if I can reproduce the issue.

Please report here if you keep experiencing the same issue again.

Ps. You need to restart Home Assistant after 00 -> 0 change for it to be effective.