MiguelAngelLV / balance_neto

Componente para Home Assistant que calcula el Balance Neto Horario para instalaciones fotovoltáicas.
37 stars 6 forks source link

Feature Request: Additional balance calculation before full hour #12

Closed Jordan87 closed 9 months ago

Jordan87 commented 10 months ago

Hi Miguel

As you alredy know im facing issue that in avarege one every other day calculation for balance your "Net Balance" component is doing calculation for entity "Net Exported" and "Net Imported" few/several seconds to late and Energy calculation sometimes is incorrect because of missing value for full houer and next one is accumulated for two hours. image image Now when I'm using multitariffs (diffrent prices for different hours during day/weekend) its evem more important to have proper energy usage in Energy tab.

I have some idea which probably can be easy implement in your addon/component. :) May be you can perform two calculations before every full hour? Now it should be done 5 seconds before every full hour but in some cases (at lest for me it slightle delayed and done after full hour but is it doable to perform two calcolatios, one for example 20seconds before full hour and second calculation lets say 2 seconds before which will update "Net Exported" and "Net Imported" value?

Thanks :)

MiguelAngelLV commented 10 months ago

I am working in configurable version so you will could set the offset you want ;)

MiguelAngelLV commented 9 months ago

Added configurable offset in new beta ;)

I can't do "multiples calculates" because Import and Export must be "only increment", so, if a value down a little between calculates, HA show error.

It is the reason I don't save each 30s

Jordan87 commented 9 months ago

Thank You

I will experiment with different values :)

btw Any idea why sometimes there is so big delay in calculation by your component? Most of the time it was spot on 5 seconds vbefore full hour but not always. Can we do something to put higher prio for that component? :)

MiguelAngelLV commented 9 months ago

I think the problem is HA overhead.

HA use a queue of task. Each task is added a queue and they will resolve in order. If any task need a lot of time, the next task will need wait it...

These is the reason for security offset.