Massaging battery parameters to use with the Energy Dashboard #126
Replies: 4 comments 9 replies
-
I can see that the profile is missing Total Battery Charge and Total Battery Discharge sensors. But I presume the inverter has registers for that? |
Beta Was this translation helpful? Give feedback.
-
Hmm... close enough: That could have saved me a shedload of code!!!! |
Beta Was this translation helpful? Give feedback.
-
567 (0x0237) is useful too - battery health percentage. One of mine shows 100, the other 95. That better document I added above is like the normal one, but with lots of the "reserved" entries filled in. |
Beta Was this translation helpful? Give feedback.
-
Hi David, do you think 0x0224, 0x0225, and 0x0237 might make it into an update soon? If so, I'll hold off adding number-based reads in my scripts. No problem if not, though - I don't want to pressure you. I know this isn't a full time job! |
Beta Was this translation helpful? Give feedback.
-
I use an ME3000SP with the solarman_wifikit.yaml definition file.
I tried to add my batteries to HA's energy dashboard, but couldn't because it expects to see in and out values in kWh (evergy), but the output from the ME3000SP is a single charge/discharge instantaneous reading in kW (power). So I had to massage that data into the right format to get it to work.
In case anyone else wants to try, this is how I did it. This is based on stuff I found out there on the Internet, but which didn't work, so I had to make loads of changes. All of this goes into configuration.yaml, by the way.
Firstly, I split the charge/discharge into separate in and out entities using templates:
You'll see I use batt1 in the code - that's because I have two battery systems. batt2 have essentially the same code duplicated.
You will need to replace battery1_battery_charge_discharge_power with whatever the charge/discharge parameter is called in your system. I think that by default it's solarman_battery_charge_discharge_power.
The next thing I do is use the built in integral facility to sum the kW feed into kWh data:
You may well have an existing sensor: section, if so just add this to the end of that.
Finally, I use the built-in utility meter facility to reset the data on a daily basis:
After this, I'm able to use batt1_in_integration_daily and batt1_out_integration_daily to populate the battery fields in the energy dashboard. It won't show correct data until the following day.
I hope someone else finds that useful!
Beta Was this translation helpful? Give feedback.
All reactions