hesselonline / wallbox

MIT License
23 stars 8 forks source link

Long term stats for HA Energy #11

Open jpleite opened 3 years ago

jpleite commented 3 years ago

Hi @hesselonline. Great work you've done. As you know HA launched Energy panel and integrations need to configure their entities correctly so Home Assistant knows that we need to track statistics for it and how. Metered entities have a value that keeps increasing until reset, like energy consumption or production. To have Home Assistant track this entity a last_reset property needs to be included. https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

Would you be so kind to include it? Thanks for your great work!

hesselonline commented 3 years ago

Hi, I haven't had any time to look into this, but I will certainly make time in the near future. So, I will have a look and let you know what's possible in this regard.

mafelipe16 commented 3 years ago

Could be possible to "download" from Wallbox Portal the "Monthly summary Energy"? That will give the necessary data to create an Utility_meter sensor inside HomeAssistant, that parameter gives the kWh consumed charging the car....

jpleite commented 3 years ago

Hi. Actually after my last request and further investigation you can in fact have long term stats for wall box. First add this to customize.yaml

sensor.wallbox_portal_added_energy: device_class: energy state_class: measurement last_reset: "1970-01-01T00:00:00+00:00"

Then, under configuration.yaml

utility_meter: wallbox_monthly: name: Wallbox Monthly source: sensor.wallbox_portal_added_energy cycle: monthly

Which this you can monitor individual devices (such as wall box) under Energy portal and also a sensor is created with monthly added energy for Wallbox.

tipofthesowrd commented 3 years ago

I heard the last_reset parameter will change again in 2021.9. So be careful adding this in. However, the sensor proposed here would a very nice addition to the Energy dashboard.

Question is how many times we would update the sensor? Is it polled on a regular basis from the web api?

hesselonline commented 3 years ago

I will add this in a future release of the HA integration. Not sure if I will also add it to the custom component (the integrated HA component is quite different at this point in time so I would need to invest some time in combining these).

I will be using the added_energy sensor for this.