Incorrect Totals in HA

Post Reply
Phil M
Posts: 13
Joined: Wed Jan 22, 2025 2:51 pm

Following a nice sunny day, my battery has hit 100% for the first time since it was installed, so happy to see that. I looked at the stats however and it just doesn't add up. The battery is 10kWh and today went from 19% to 100%, which should be about 8kWh but the HA dashboard only shows 10.7kWh total production and only 5.3kWh going into the battery. I know it does charge from the grid once it hits 19% (back up to about 24%) and this never gets logged as ingoing charge.

I'll try to get the data across as best I can until I can figure out how to post a picture of the HA dashboard flow diagram...

Grid bubble - Export 1.5kWh, import 4.8kWh

Solar bubble - 10.7kWh

Battery Bubble - charge 5.3kWh, discharge 1.6kWh

Home - 10.3kWh

I assume "Home" is the amount my house has used, combining all sources (e.g. Home =grid in + solar in + battery discharge - battery charge - grid export). I don't get how taking a battery with 2kWh in it, adding 5kWh and then removing 1.6kWh leaves it at 10kWh. By my calculations it should be at 5.4kWh or 54% but both HA and foxcloud show it at 100%. Can anybody explain the difference? The inverter doesn't appear to output the "today" and "total" figures so I assume they are calculated by the integration. Is something in HA not adding up the totals properly?

Many thanks,

Phil
Dave Foster
Posts: 1744
Joined: Thu Oct 13, 2022 7:21 pm

What home assistant integration are you using, modbus or the cloud version?

In the energy dashboard Home is the amount of house load (from whatever source)

If this is the first time your battery has charged to 100% I think that is the reason why your maths don’t add up - the battery needs to occasionally charge all the way to 100% for a number of reasons.

One is that this is where the most of the battery cell balancing is done, the other is that the BMS will reset its counters so that is has a more accurate assessment of the actual SoC. The lifePo4 (LFP) batteries used in solar stacks have a very flat voltage curve which raises rapidly when it nears 100% charge and the BMS uses this to re-assess the amount of power stored in the battery, likewise it does the same when the battery hits the minimum state of charge - you sometimes see jumps in the SoC which is the BMS fixing it’s estimate of the remaining pack capacity.

If it never achieves either of these limits from time to time (monthly) the SoC will likely not be accurate.

I would recommend that you set your minSoC to 10% as this is what the batteries are rated (and guaranteed) for, unless you have a reason to want to keep it higher.

If the batteries do not hit 100% or 10% very often then over time the accuracy of it’s SoC will fall and that is likely what has happened here so you should find that it is more accurate over the next few days.

It is best to view battery statistics over a much longer period so that the starting /ending charge values have a smaller effect.
Phil M
Posts: 13
Joined: Wed Jan 22, 2025 2:51 pm

Thanks for the info Dave, it's quite an interesting read. I'm using the modbus integration with a waveshare RE485 to ethernet gateway and have lowered my SoC to 10% and will see how it goes once it's fully cycled a few times. The forecast looks great for the next few days so looking for some good charging.

Whilst I'm asking stupid questions, could I indulge a little more?

I've noticed the Grid CT (solar), presumably the reading from the CT around the incoming supply to the house is not the same as my meter readings and under reads by a factor of about 1.06. I've assumed this is probably down to CT clamp accuracy. Is this a reasonable assumption?

I'm confused by the battery temperature readings I get from HA and the graphs in foxcloud all run at about 20-25C however in the app, when I click on the image of the battery, it gives me a temperature of 8-10 degrees, which is more in line with the ambient temperature, which is about 5-6C in the barn where the battery is (HA is monitoring this for me also!). I also note that when I force charged the other day, it was limited to 2.2kW, not the 7kW limit set point, presumably due to low temperatures. Am I right in thinking the higher temperature is the BMS temp and the lower is the cell temp? Also, is there a way to get the cell(?) temp in HA? It seems a more useful reading. As mentioned, I'm monitoring the ambient temperature through HA and am building an enclosure for the inverter and battery which may get a small heater and forced air cooling if needed at some point.

Thanks Again

Phil
Dave Foster
Posts: 1744
Joined: Thu Oct 13, 2022 7:21 pm

The CT clamp won’t be as accurate as the smart meter (which also takes into account power factor), normally it is between 2 & 5% accurate getting worse with low loads - if it is mounted within a few inches of another CT clamp that can reduce it’s accuracy as can be on a long cable run to the inverter.

The V2 app shows you the lowest cell temp which is what drives the charge reduction algorithm but basically below 20C there is some charge current reduction getting much more significant below 10C and falling to 2A below 5C.

What you will get in HA as the battery temperature is the BMS temperature which is 6-10C higher and fairly unusable, but depending on which inverter and firmware version you have you may also have the cell low (min) and cell high temp (max) which are much more useful. Also depending on inverter model and firmware version there are the BMS charge / discharge current sensors which explain what the BMS is regulating to.

Also just going back to your original post as you are on modbus the Total and Today values are generated by the inverter and you can see most of them from the inverter panel System menu - they are useful as they are precise metrics of what work the inverter has done and measured.
WyndStryke
Posts: 52
Joined: Mon Nov 18, 2024 9:16 pm

Regarding the SoC calibration, I wrote an automation to import up to 97% during the overnight charge if the SoC has not reached that level in the previous 7 days, and similarly an automation to export down to 13% if it has not dropped that far in the last 7 days. Normally it would stay within the 20%-80% band. So hopefully I have this covered now :-)


Regarding the _today figures, do note that if the inverter time and the home assistant time have deviated from each other, the _today figure on the inverter will reset out of sync with home assistant. Obviously this is if you are collecting the data very close to midnight. With a lot of help from Dave I managed to get an automation going to sync the clocks (I am very much a newbie at HA so lots of beginner mistakes). It should be noted that directly writing registers from home assistant should be treated as high risk since it bypasses any validation, I would imagine that Fox support are unlikely to be very sympathetic if you accidentally brick the inverter.


Regarding charge speed and temperature, I have a 70W pet heat mat under the battery stack, and it turns on & off based on an automation which looks at sensor.bms_cell_temp_low, the current grid import price, the ambient temperature, and turns on when it thinks the battery needs it. It is low enough wattage so that when things go wrong (relay fault / wifi / etc) then it won't have a detrimental effect (also the effect is very mild, don't expect it to work miracles at that wattage, it's more like "take the edge off the cold" rather than "warm up the battery"). I also have charts showing the bms_charge_speed vs cell temp low, etc. The bigger the battery system compared to the inverter rating, the less important the ambient temperature, since the charge speed is more likely to be bottlenecked by the inverter rather than the BMS.
Phil M
Posts: 13
Joined: Wed Jan 22, 2025 2:51 pm

I will look into the battery cycling once I have an idea of what we'll get in normal operation. I don't have a smart meter yet so not on any tariff that would benefit from forced charge or discharge but it's hit 100% and 10% in the last week.

I have now finished the enclosure for the inverter and battery. It's larger than I'd hoped due to the battery being below and next to the inverter rather than directly below, which is a bit of a shame but it's holding 4C above ambient without any additional heating. I'm going to add more insulation to the floor and barn wall then see if I need a heater or vent fan. I have a D1 mini reporting the temperatures int he barn and enclosure so I can run a relay board from that to power a tube heater and fan if needed.

Phil
Phil M
Posts: 13
Joined: Wed Jan 22, 2025 2:51 pm

In case it is of any use to anybody, I've had my manager firmware updated to version 1.37 and I can now get cell max and cell min in HA, plus a few other values. I can now use HA to control a heater based on cell temperature rather than BMS temp, which is much higher.

Phil
Post Reply