a529987659852 / openwbmqtt

Custom component for home assistant supporting openWB wallbox
35 stars 16 forks source link

update integration to allow the usage within the energy dashboard #24

Closed ChristophCaina closed 1 year ago

ChristophCaina commented 2 years ago

Hi, I love the new energy dashboard from home assistant - and I would really appreciate the fact, if openwbmqtt could be integrated there. Unfortunately, It seems, that the sensors don't meet the requirements to be shown in the energy dashboard, since it is not available in the configuration area of the dashboard.

It would probably make sense to add the ev-charger as a battery type, as long as there isn't a dedicated configuration for electric vehicles available. Can you consider to implement the integration into the HA Energy Dashboard (without the need to create utility_meters and so on manually)

Thanks :)

ChristophCaina commented 2 years ago

thanks for the update :) I think, this might add some benefits for the users (who might not have their own PV integration or lost the ability to monitor their PV in homeassistant directly 👍

ChristophCaina commented 2 years ago

Hi @a529987659852 :

During the last days I've noticed the following behave of the sensor: "total_charging" - which should be changed for the energy dashboard:

  1. I've charged aprox 15 kWh to my car. --> Everything was shown as expected within the energy dashboard.
  2. after I've unplugged the car, the sensor switcht to "0.00" which isn't expected by the energy dashboard. --> therefore, it recalculated the complete graph and caused a mess in the statistics.
  3. today, after I've plugged in my car again, the sensor came back with the previous amount of charged kWh.

The energy Dashboard requires a continues grow of the sensor values. It should not fall back to 0.00 kWh - otherwise, it will re-add the previous sensor state (15 kWh) the next time:

statistics would be like that:

hh:mm value total 11:00 0.0 0.0 12:00 5.5 5.5 13:00 4.5 10.0 14:00 5.0 15.0 15:00 0.0 15.0 16:00 0.0 15.0

10:00 15.0 30.0 11:00 4.3 34.3 12:00 5.0 39.3

and so on. Is it possible to fix the sensor to keep it's value even if the car will be unplugged?

a529987659852 commented 2 years ago

Hi Christoph, are you using the sensor.openwb_cp1_geladene_energie_gesamt or any other sensor? If not, please try this one and tell me wether it works as expected. Andreas

ChristophCaina commented 2 years ago

Hi,

I've used the sensor.openwb_cp1_geladene_energie_gesamt. After the current charging has finished I've disconnected the sensor - and keep an eye on it... but here's the graph from HomeAssistant: grafik

AS you can see, the previous state yesterday was available for some time (I wasn't at home when the charging finished - and disconnected the cable when I came back)

Therefore, I will keep an eye on this - right now, I haven't noticed anything after disconnecting the openWB

EDIT: For now, I have restored the energy statistics, since I could see that 14.8 kwh have been substracted yesterday (don't know why) - and added again today. Now, the energy usage looks ok again... maybe - it was also a co-incidence with another sensor which I've added in order to get the "battery charging" into the dashboard... don't know, if this overwrote the other sensor-value somehow

a529987659852 commented 2 years ago

Hi Christoph, the fact that geladene_energie_gesamt reset to 0 in openWB is indeed strange. My value did not reset when disconnecting the car. And from the name, I assumed that this sensor in openWB was the total energy charged since the first start (like a utility meter).

I'm struggeling a little which state class to choose: https://developers.home-assistant.io/docs/core/entity/sensor/ --> Section "How to choose state_class and last_reset"

From what I understand in the documentation, state_class = total should be used for a sensor which never resets --> should be the case for this sensor. However, if the sensor resets (even by coincidence), then total_increasing should be more suitable as a negative difference between value N and N-1 is simply ignored (see the example in section "State class total_increasing").

What do you think? Andreas

a529987659852 commented 2 years ago

Update: Most other wallboxes and inverters use total_increasing for such kind of sensors - I'll try that as well.

ChristophCaina commented 2 years ago

OK, thanks :) I think, that should also answer my comment on your post in the openWB forum :)

ChristophCaina commented 2 years ago

hi, just as mentioned above, I wanted to provide an update to the sensor:

grafik it seems, that now, the sensor has resetted the last charging - and felt back to the 14,8 kWh which I have manually repaired in the statistics.

The cable is still plugged in, but not locked - I did an update on homeassistant, so the system did reinitiate the sensors

grafik grafik