Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery SOC not working #239

Open
Sarelseekat opened this issue Apr 18, 2024 · 26 comments
Open

Battery SOC not working #239

Sarelseekat opened this issue Apr 18, 2024 · 26 comments
Labels
bug Something isn't working

Comments

@Sarelseekat
Copy link

Sarelseekat commented Apr 18, 2024

It seems like there are a couple of end points like the battery SOC that is not reading from the API and shows as unknown on the dashboard. Is there any way to fix this?

image

@Sarelseekat Sarelseekat added the bug Something isn't working label Apr 18, 2024
@FozzieUK
Copy link
Collaborator

Hi, which inverter do you have - is it by chance an H3 Pro (with dual battery inputs ?)

The Boost Temperature has (to date) always been unknown it's either a feature that will be used, or was used a long time ago - but it never shows any values (if you look at the Foxesscloud website and select it, you can see it never reports a value)

@Sarelseekat
Copy link
Author

Sarelseekat commented Apr 18, 2024

Hi, which inverter do you have - is it by chance an H3 Pro (with dual battery inputs ?)

The Boost Temperature has (to date) always been unknown it's either a feature that will be used, or was used a long time ago - but it never shows any values (if you look at the Foxesscloud website and select it, you can see it never reports a value)

Yes it is - How did you know
30kW with Duel battery Pack of 15kWh Each

@FozzieUK
Copy link
Collaborator

It's an interesting bug as it depends which input you use on the H3 Pro for your batteries - if you were to switch to the other input, the Fox apps and the cloud will work fine - but when it's in the second input the Fox cloud doesn't resolve it properly and the Fox apps V1/2 will show different levels of problem, some will show it on the main page but not in the battery page.

It has been raised as a bug with Foxess, but as it affects all of the apps as well most H3 Pro users have taken the plunge and moved the battery to the other input which 'fixes' it.

@Sarelseekat
Copy link
Author

The issue is we are using both inputs. 2 stacks with 15kWH each.

@FozzieUK
Copy link
Collaborator

ok, thanks - i'll report it again to Fox 👍

@FozzieUK
Copy link
Collaborator

ok, i've reported it to the Fox product manager - but just in case she asks, how does the battery soc show when you look at it in the apps, is it showing as zero in certain pages ?

@Sarelseekat
Copy link
Author

On the apps, it shows all the battery telemetry. That's on the V1 and V2 App. On the foxesscloud.com I can also see both battery stacks with full telemetry -
image

@FozzieUK
Copy link
Collaborator

Ok thanks for that - it looks like they have fixed the apps to display correctly, it’s just the API that is missing the information. I’ve had a response to say it’s been passed to their dev team to look at. I’ll let you know when I hear something.

@FozzieUK
Copy link
Collaborator

@Sarelseekat Foxess have asked me to provide your inverter serial number so they can look at the battery soc problem - could you email it to me please so I can forward it to them (my email b5djf@yahoo.com)

@Sarelseekat
Copy link
Author

Sure - Sending it now

@FozzieUK
Copy link
Collaborator

Got it, thanks - i’ll forward it on 👍

@Sarelseekat
Copy link
Author

Sarelseekat commented Apr 20, 2024

Something I noticed in raw data output in the Logs - It looks like it is returning a value under SoC but as a variable-
{'unit': '%', 'name': 'SoC', 'variable': 'SoC_1', 'value': 20.0}, {'unit': '%', 'name': 'SoC', 'variable': 'SoC_2', 'value': 21.0}

'SoC_1': 20.0, 'SoC_2': 21.0

@FozzieUK
Copy link
Collaborator

That’s interesting, I wonder if they have added that as a result of my request, or whether it was there before ? - i’ll have to do a bit of work to capture this is they have changed the variable name with a 2 battery system, so i’ll need to do some pre-processing on a 2 battery system.

Thanks for the api key etc.. - that allows me to do some solid testing here, hopefully i’ll have something for you to try by tomorrow 👍

@Sarelseekat
Copy link
Author

Fantastic. We're looking to make use of Fox a lot more going forward and this integration will help.

@FozzieUK
Copy link
Collaborator

Ok I have a test version for you to try.

I haven't released it so for now you will need to copy the contents of the file sensor.py from the https://github.com/macxq/foxess-ha/tree/TestingPV5and6/custom_components/foxess directory over the top of the contents of the file sensor.py file in your /homeassistant/custom_components/foxess/ directory.

Once that's done restart HA.

You should now have PV5 (and 6) _power, _current and _volt sensors.

I've also added new SoC sensors to handle dual batteries on H3 Pro - The original _bat_soc sensor from the OpenAPI is only populated on single battery systems as before (for you will be 'unknown'), however on dual battery systems you will have 2 new sensors _bat_soc1 and _bat_soc2

Let me know how that goes 👍

@Sarelseekat
Copy link
Author

Everything looks to be working 100%. I can see the two packs and the normal SOC sensor become irrelevant. PV5 and PV6 Is also showing 100%.

Thanks to much for all the assistance. We can now automate the generator by checking the SoC on the battery packs.

@FozzieUK
Copy link
Collaborator

Perfect, thanks - i'll wrap this up and release shortly 👍

@Sarelseekat Sarelseekat reopened this Apr 23, 2024
@Sarelseekat
Copy link
Author

Hi There. Everything seems to working fine, but one thing I picked up is that The Bat Charge and Bat Discharge looks like it's only being calculated for one battery. Today we discharged the battery down to 20% SoC and charged to 100% but the two sensors only show 14.9 kWh Charged and 13.4 kWh Discharged.

It should be closer to 24kWh if you consider each battery pack is 15kWh - Total 30kWh storage on the two packs

@FozzieUK
Copy link
Collaborator

Hmmm that doesn’t look right at all, if it was only one battery you would expect a max of 12kWh for discharge and a little bit more for charge, and if it were reporting total of 2 batteries it’s far out.

Those stats actually come directly from the inverter, they get stored on the cloud and turn up as ‘report’ variables from the openapi.

Some things to check - as the charge and discharge power stats come direct from the inverter, if you go to the inverter panel and select ‘History’, ‘Inverter Yield’ you’ll be able to see the battery stats and within that menu are the charge and discharge totals for the day.

As these are daily totals they will be reset at midnight ~ double check your inverter clock and timezone are set correctly.

If the inverter battery totals are what the cloud is reporting then it’s time to look closely at the inverter itself - if the cloud and inverter don’t agree then that’s an api or cloud storage problem. Both will have to get referred to Foxess but it will need more tests to prove which it is.

The H3 Pro dual batteries feature is very new so it’s always possible that the inverter is getting some of it’s maths wrong in the totals, can you confirm whether the inverter totals agree with the cloud (or not).

I guess worth checking the batteries are set correctly, balanced and outputting what you expect, if possible try and measure the amount of battery charge / discharge power it should help to form the right questions to refer Foxess.

@Sarelseekat
Copy link
Author

Sarelseekat commented Apr 23, 2024

Getting the same from the FoxCloud app. Will have to check the inverter tomorrow. Clock and Time Zone is correct. The inverter hasn't been updated with new firmware yet. Will ask my supplier in the morning to request a firmware update to see if it fixes things. I also noticed that one of the batteries has newer firmware than the others.

Total battery capacity is also only reading one of the packs at 14740wh

WhatsApp Image 2024-04-23 at 20 59 08_e5209ef5

@FozzieUK
Copy link
Collaborator

Ok latest firmware sounds a good start 👍

@Sarelseekat
Copy link
Author

Sarelseekat commented Apr 24, 2024

Ok - So fox did a firmware update today. The inverter battery capacity still only shows one battery, but the charge and discharge kWh reading does appear to be correct on the inverter.

I Suppose the difference between the charge and discharge is the efficiency loss?

WhatsApp Image 2024-04-24 at 16 05 21_5f4ae540
WhatsApp Image 2024-04-24 at 16 05 21_bf26ba98

@Sarelseekat
Copy link
Author

Even after the update. The charge and discharge is still incorrect.

image

@FozzieUK
Copy link
Collaborator

ok, that seems to confirm the inverter is correct but the Fox cloud is not using the correct value.

The efficiency loss isn't the easiest to calculate from the 'daily' values because it resets at midnight so you may have more charge than discharge (or the other way round) - if you use the 'Total' values that should get you close, that's total since inverter inception.

I'll email them with this and ask, they may want you to raise a ticket to track it - but i'll let you know.

As an aside I can add to the integration battery1(&2)current and battery1(&2)volts which would allow you to calculate battery1(&2)power, and then feed those into a Riemann sum to work out daily power, admittedly it will be based on 5 minute samples but it usually gets surprisingly close.

@FozzieUK
Copy link
Collaborator

I've had a reply from the Fox API product manager, they have asked if you could raise a support ticket who will be able to raise it R&D and then be able to track it for quality purposes.

You can raise a support ticket within your app or at this link

@FozzieUK
Copy link
Collaborator

I've been doing a bit of testing this morning and can see your inverter is charging both batteries at ~3kW, interestingly despite the total reported by the cloud being wrong, the entity sensor.foxess_bat_charge_power is showing the correct combined power ~6kW.

If you add a Riemann sum to your home assistant configuration.yaml (assuming your charge/discharge sensors are called sensor.foxess_bat_charge_power and sensor.foxess_bat_discharge_power )

sensor:
  - method: left
    name: bat_charge_sum
    platform: integration
    round: 2
    source: sensor.foxess_bat_charge_power
    unit_time: h
  - method: left
    name: bat_discharge_sum
    platform: integration
    round: 2
    source: sensor.foxess_bat_discharge_power
    unit_time: h

and 2 utility meters

utility_meter:
  bat_charge_daily:
    source: sensor.bat_charge_sum
    cycle: daily
  bat_discharge_daily:
    source: sensor.bat_discharge_sum
    cycle: daily

The values of bat_charge_daily and bat_discharge_daily should give you a reasonable approximation of your daily 'total' (both batteries) for charge and discharge.

FYI - If you want complete accuracy and control of the inverter via local RS485, you would need to go for an RS485 modbus solution - that is capable of doing a lot more than the cloud interface. The H3 Pro is not currently supported on it, but a first pass is being added as I write and should be ready to test soon (you can see more here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants