-
Notifications
You must be signed in to change notification settings - Fork 21
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
H1 Gen2 Inverter support #585
Conversation
https://github.com/TonyM1958/HA-FoxESS-Modbus/blob/main/custom_components/HA-FoxESS-Modbus/modbusH1G2_RS485_LAN.yaml Things that don't seem to work: - Charge periods - can't get the sensors to appear, charge period card doesn't load - Inverter fault codes - no mapping for these yet - bms_kwh_remaining is 0.0 kWh (but I just had a cube slave added so the BMS might not have worked it out yet?)
Also got nothing for Residual so that's not present on G2 as it stands. Also no registers available for BMS Cell Volts or Temps high / low or BMS cycle count. Edit: I checked the scans we did for Charge times and values are there but after schedules were enabled, all values went to zero. |
Also inverter state doesn't look right. Holding register 39063 returns '4' when the G2 is 'On Grid', which doesn't map to either the H1 or KH lists in |
|
Hmm.. adding support to mask out bitwise fields is definitely stretching my Python skills, I'm a Perl guy.. |
We need a new InverterModel. Also order H1_G2 before H1_G1 to avoid negative lookahead.
custom_components/foxess_modbus/entities/entity_descriptions.py
Outdated
Show resolved
Hide resolved
custom_components/foxess_modbus/entities/entity_descriptions.py
Outdated
Show resolved
Hide resolved
custom_components/foxess_modbus/entities/entity_descriptions.py
Outdated
Show resolved
Hide resolved
custom_components/foxess_modbus/entities/remote_control_description.py
Outdated
Show resolved
Hide resolved
custom_components/foxess_modbus/entities/remote_control_description.py
Outdated
Show resolved
Hide resolved
Where do you need to do this? Python uses normal bitwise operations to mask out things: |
Thanks for this! I've gone through all of the registers, and they all look in line with @TonyM1958's findings, unless noted It looks like we might need to have a new sensor for the status code registers. Not sure what we want to do there, whether to show the same thing as the other inverters for consistency (and lose some information in the process), or have 2 different sensors. I've added some commits to the branch. I've fixed an issue with the inverter profiles, and made a few style tweaks. |
Yeah there are likely mistakes.. I was hacking around at midnight, keen to have HA working this morning in some form, and I'm definitely not fluent in Python. |
custom_components/foxess_modbus/entities/charge_period_descriptions.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Co-authored-by: Antony Male <github@antony.male.rocks>
OK, so just questions around ac_power_limit_down, pwr_limit_bat_up, and what we do with the status code. Does everything else seem to be working OK? |
I've just noticed in the log:
@TonyM1958 has pv*_current scaled by 0.01, so looks like this needs to be different for the G2. |
The PV Volts, Current and Power are still available at the H1 holding addresses if you want to simplify the configuration by using 31000 - 31007 with the existing scaling. Just a little less precision on the current. |
Probably best to keep things simple. You can get "Battery Temperature" at 31023 holding as well by the look of it. Also, current models only have PV1 and PV2 so you don't need to include PV3 and PV4 if you want to clean things up a bit - those are my address place holders in case inverters get more MPPT in the future. That should help align more of the registers between H1_G1 and H1_G2. |
Having extra registers or tweaking the scaling a bit isn't really any extra effort -- you can see from the diff that it's only an extra line. |
This is closer to other read registers, which means reads can be more efficient.
Right, fixed those. Can you also test the Force Charge / Force Discharge work modes please? |
Great, I’ll test in a hour once the kids are asleep .. |
Thanks! The force charge/discharge stuff isn't related to the mode scheduler -- we implement it ourselves using the remote control registers, and as far as I know it should work with the firmware you have. |
Ah. They're all around 65000, which is suspicious.... Can you use the Read Registers service (Developer Tools - Services) to read one of those registers? |
I'll use mbpoll as it's quicker :) [39279]: 0 Hasn't happened for a while so I'll try to catch it when it does and then also see what 31002 & 31005 say. |
Force Charge & Force Discharge work modes both worked as expected. 👍 |
Cheers. It does somewhat imply that there's a problem in my code, as those registers are signed and so shouldn't go above 32767, but I can't spot where it is. |
Aah, pv_power is 2 registers wide on the G2, I forgot that. The fact that it's wrapping at 65535 does rather suggest that it isn't actually 2 registers wide however. |
I've added an inverter state sensor for the G2. Provided that works, I think the only remaining thing is these weird 65535 readings? |
PV Power Now is calculated on H1 as the sum of PV1 Power etc. The new sum covers up to 24 PV inputs and is 32-bits for that reason. But, its not the only sensor that does not conform with other 'sources'. I think you could just drop it and work it out as previously? |
I hadn't even noticed that the G2 provided a |
Looks good. Will check it changing tomorrow afternoon when I test EPS mode again. Haven't seen any weird PV power readings since 20:50 this evening. Will report if any more are recorded. |
I'm going to merge this in: the H3-Pro spec just landed, and that's largely the same as the G2. If there are further fixes needed to can get those in separately before the next release. Thanks for your help! |
Hi guys, is there a sort of table to quickly find out what sensors are supported for each model of inverter? |
First go at H1-*-G2 modbus support based on the register mapping at
https://github.com/TonyM1958/HA-FoxESS-Modbus/blob/main/custom_components/HA-FoxESS-Modbus/modbusH1G2_RS485_LAN.yaml
Things that don't seem to work: