fsaris / home-assistant-zonneplan-one

Unofficial Zonneplan integration for Home Assistant
https://github.com/fsaris/home-assistant-zonneplan-one
MIT License
101 stars 17 forks source link

Daily reset for ‘sensor.electricity_production_costs_today’ #129

Open vries-ict opened 1 month ago

vries-ict commented 1 month ago

The value of ‘sensor.electricity_production_costs_today’ sometimes still has a value after 0:00 hours and then is unavailable until the energy production starts the next day. This behavior causes for instance a utility meter helper that is based on this sensor to start with the wrong value. Can you please make it behave just like it’s counterpart ‘sensor.electricity_delivery_costs_today’ and have a daily reset to zero at 0:00 hours?

fsaris commented 1 month ago

Both sensors are setup equal and use the same property to trigger a reset on the new day. So they should already behave the same.

Can you provide the graphs for both sensors?

vries-ict commented 1 month ago

image ‘sensor.electricity_delivery_costs_today’ (above) drops to zero just after 0:00 hours. image image ‘sensor.electricity_production_costs_today’ (above) also drops just after 0:00 hours but not completely to zero, just before status unavailable. I think this is the reason I ran into some issues on creating a utilitymeter for net power costs over a period of time (delivery - production), since it registers a negative value at the daily reset. For now I solved this with a template sensor with extra logic to reset and keep the value at zero at the daily reset. But maybe it can also be fixed in the source sensor itself.

fsaris commented 1 month ago

@vries-ict can you test the main branch? Added a fallback to zero when sensor gets unavailable

vries-ict commented 1 month ago

Thanks for your swift action. Never done this before, but I found these instructions:

Installing main/beta version using HACS: Go to HACS => Integrations Click on the three dots icon in right bottom of the Zonneplan card Click Reinstall Make sure Show beta versions is checked Select version main Click install and restart HA

So, I will await the results and report back to you.

fsaris commented 1 month ago

See the instructions in the readme https://github.com/fsaris/home-assistant-zonneplan-one?tab=readme-ov-file#installing-mainbeta-version-using-hacs

vries-ict commented 1 month ago

Over the last couple of day ‘sensor.electricity_production_costs_today’ had a daily reset to zero as you intended. That also solved the issues I had with calculating net costs. Thanks @fsaris !