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

K series manager 1.33 upgrade breaks integration #678

Open
williamjeccles opened this issue Sep 27, 2024 · 36 comments
Open

K series manager 1.33 upgrade breaks integration #678

williamjeccles opened this issue Sep 27, 2024 · 36 comments

Comments

@williamjeccles
Copy link
Collaborator

williamjeccles commented Sep 27, 2024

KH inverters upgraded to manager 1.33 and now seeing the following error in HA:

Error connecting to inverter (friendly name: "KHM"). Error reading registers. Type: RegisterType.HOLDING; start: 31039; count: 10; slave: 247 from tcp://192.168.1.164:502: Exception Response(131, 3, IllegalAddress)

@williamjeccles williamjeccles changed the title K series manager upgrade breaks integration K series manager 1.33 upgrade breaks integration Sep 27, 2024
@williamjeccles
Copy link
Collaborator Author

So @TonyM1958 confirmed that address 31039 is PV3 voltage, moving a solar string over to pv3 and I can confirm that the address is showing 0v in home assistant using tony's project so assume this manager update has broken pv3 in someway.
Happy to test if someone can confirm how I can comment out the pv voltage registers and see if I get overcome the blocking faulty register?

@williamjeccles
Copy link
Collaborator Author

williamjeccles commented Sep 27, 2024

Currently, the following are failing to respond and blocking the integration from loading cleanly.

Broken left / working right
Pv3 & PV4
31039 - 39074
31040 - 39075
31041 - 39283
31042

rpower
31045
31046

EPSpower
31047
31048

Gridct
31049 - 39168
31050

ct2
31051
31052

loadpower
31053

With these addresses commented out the integration loads.

@williamjeccles
Copy link
Collaborator Author

Ok so Tony pointed me to a new v2 address register, I've tested out the new address on the pv3 voltage address which is the first failing address and it's working. I'm going to test out updating them each with the new values but it looks like more of an improvement to the address consistency than bugs introduced at this stage.

image

@canton7
Copy link
Collaborator

canton7 commented Sep 27, 2024

Yay, I hate it when they break things. Looks like they're bringing it into line with the H3 Pro perhaps? That's the other inverter which uses 39074.

I think we're going to need to start selecting which registers to use based on the firmware version... We can't just keep breaking all KH users because one person upgrades. I'll try and find some time to implement something.

@williamjeccles
Copy link
Collaborator Author

thanks @canton7, do you want me to commit a PR so we can offer a beta version for those who have upgraded while you work on a switch of some kind?

@canton7
Copy link
Collaborator

canton7 commented Sep 27, 2024

Sure, if you've got the time to update the register map, that would be helpful!

Can you do what we did for the KH, and at least keep the old register map around? (For the KH, we did that as KH_PR119).

@williamjeccles
Copy link
Collaborator Author

@canton7 versions are completely messed up also :(

image

I feel like this is going to need proper reengineering, maybe a switch in the config wizard or maybe we only support the latest firmware?

@canton7
Copy link
Collaborator

canton7 commented Sep 27, 2024

🤦

@TonyM1958
Copy link

Looks like the encoding of the versions has changed, it seems unlikely they got this wrong?

Previously, they have used decimal and then hex encoding. Don't think they expected to get to version 2.55. You may need to write out the values you read in binary to see if you can make any sense it.

@canton7
Copy link
Collaborator

canton7 commented Sep 28, 2024

Re the version... We're currently interpreting this as hex, which seems to be the "new" standard. That means that "31.31" is 0x3131.

I can't work out any way in which that maps onto "1.33"....

It seems more likely to me that they've gone and moved the version registers, particularly if they're moving to parity with the H3 Pro. @williamjeccles can you check registers:

  • 36001 (master version)
  • 36002 (slave version)
  • 36003 (manager version)

please?

@TonyM1958
Copy link

TonyM1958 commented Sep 28, 2024

ah OK. I just assumed you would have already tried that... may be not. There are other examples of versions in Modbus v2 as well, such as Protocol Version Code that is 32-bit hex byte encoded.

@canton7
Copy link
Collaborator

canton7 commented Sep 29, 2024

I've started having a crack at the KH-1.33 support. See #681.

I haven't put in anything which the spec says has 3 phases, as I'm not sure what the inverter reports there. @williamjeccles if you could have a poke around that would be great!

I also haven't decided how best to not break everyone who's on an older KH firmware version. They've gone and moved the version registers, which is very annoying.

@williamjeccles
Copy link
Collaborator Author

FoxESS Modbus Protocol--20240516 (V1.05.00.00)(1).pdf

@canton7 new modbus spec as I've been blessed to share it.

I'll test those changes and report back

@williamjeccles
Copy link
Collaborator Author

williamjeccles commented Sep 29, 2024

image

So good news is that the integration loads when using commit #681, but fews things we need to fix.

As you can see from the attached, grid CT even when putting grid load on is showing 0

@canton7
Copy link
Collaborator

canton7 commented Sep 29, 2024

Cool! Yep, as I said, I haven't put in anything which the latest spec says has 3 phases, as the KH is only single phase. If you can figure out how ids actually exposing that data (just using the R phase etc), I'll put them in.

@canton7
Copy link
Collaborator

canton7 commented Sep 29, 2024

Could you also check the versions? The spec also claims to support force charge /discharge work modes natively, so I've enabled them and haven't enabled the remote control stuff - mins testing?

@williamjeccles
Copy link
Collaborator Author

@canton7 any chance you push to a beta branch so I can easily import via hac instead of having to pull the commit?

@TonyM1958
Copy link

Could you also check the versions? The spec also claims to support force charge /discharge work modes natively, so I've enabled them and haven't enabled the remote control stuff - mins testing?

Definitely worth testing those work modes before you commit any changes. I don't expect writing Force Discharge to work without other parameters to set fdPwr and fdSoc and time, similarly Force Charge without a time limit does not make sense.

I think Fox may have added work modes that are read-only to reflect what is going on in schedules? In schedule mode, the work mode Modbus register is read-only and I think that is when you might see these new work modes being shown?

@williamjeccles
Copy link
Collaborator Author

I also have access to the old 1.31 so I can switch between 1.31 and 1.33 with ease.

@williamjeccles
Copy link
Collaborator Author

@canton7 so using that commit, the biggest issues right now that I think we need to fix is the grid ct isn't working for me. I believe the address should be 39168. If you can update that and I'll pull the change and try it out again.

@canton7
Copy link
Collaborator

canton7 commented Oct 6, 2024

@williamjeccles As soon as you can have a play with modpoll and let me know what the KH exposes on the R/S/T phase registers (i.e. what register of those 3 (if any) actually contains the information we need), I can get that in

@williamjeccles
Copy link
Collaborator Author

williamjeccles commented Oct 10, 2024

@canton7 so if i've understood the ask correctly I've tested out the following:
image

Meter1/CT1 RPhase Active Power address: 38816 appears to be the ct1 negative number for export, positive for import

Meter1/CT1 SPhase Active Power address: 38818 - appears to respond but with no data

Meter1/CT1 TPhase Active Power address: 38820 - appears to respond but with no data

I hope that helps resolve the K series grid related registers in the next release.

@FozzieUK
Copy link
Contributor

@williamjeccles not sure if you have looked at this, but i'm intrigued to know if the BMS registers that went missing after the 1.19 update may actually have been moved to meet the new modbus spec

Could you have a poke around at these addresses and see if you get a response please - particularly the items 24 - 32 & 39, 40, 42 on this list

11111

@williamjeccles
Copy link
Collaborator Author

Looks like it @FozzieUK - 37632 is giving me data. Going to check them all and report back
image

@williamjeccles
Copy link
Collaborator Author

williamjeccles commented Oct 10, 2024

Yeh so mV high low, Cell temps high low, remaining kWh all working.
SOH I can't test as I've not got a v2 battery to test with but the modbus address works it just returns 0 for me.

I think it's safe to say they've moved and are all working.

@FozzieUK
Copy link
Contributor

Thanks, that’s great - be nice to have them working again 👍

@williamjeccles
Copy link
Collaborator Author

@FozzieUK are you able to push a fix for the grid side stuff and these extra battery addresses?

@canton7
Copy link
Collaborator

canton7 commented Oct 10, 2024

Thanks! I'll get those in when I get the chance (I'm afraid I'm a bit swamped until the middle of next week).

I'm keen not to release this until we have a way to switch between H3 Pro versions (either automatically or manually), as I don't want an update to just break our existing H3 Pro users.

@FozzieUK
Copy link
Contributor

No problem - I'll leave it to Antony - he'll be much quicker when he gets to it 👍

(also in the middle of fixing Nathan's EM which has stopped working on 2024.10.x)

@williamjeccles
Copy link
Collaborator Author

Thanks! I'll get those in when I get the chance (I'm afraid I'm a bit swamped until the middle of next week).

I'm keen not to release this until we have a way to switch between H3 Pro versions (either automatically or manually), as I don't want an update to just break our existing H3 Pro users.

Thanks

@ApronCricket
Copy link

Hi, any guidance on how to get a KH10 working again with fw Master:1.35?
If there is any information you might need that I can help with, let me know.
Or, if I'm best just waiting for a new release, is there any chance of an ETA?
Thanks.

@ApronCricket
Copy link

Yeh so mV high low, Cell temps high low, remaining kWh all working. SOH I can't test as I've not got a v2 battery to test with but the modbus address works it just returns 0 for me.

I think it's safe to say they've moved and are all working.

image

I've a brand new V2 battery and get 100(%) at the SOH address, so looks correct.

@williamjeccles
Copy link
Collaborator Author

Yeh so mV high low, Cell temps high low, remaining kWh all working. SOH I can't test as I've not got a v2 battery to test with but the modbus address works it just returns 0 for me.
I think it's safe to say they've moved and are all working.

image

I've a brand new V2 battery and get 100(%) at the SOH address, so looks correct.

thanks for confirming

@ocl80
Copy link

ocl80 commented Nov 9, 2024

Hi, I'm new here.. but just had a KH8 inverter installed, which has firmware Master: 1.39, Slave: 1.01, Manager: 1.35, and I encountered this issue where the integration wouldn't load. To get it up and running, I forked it here, with some "quick fixes" of the addresses which have moved.

I haven't fully understood how the model and version identification is working, so this very much a quick and dirty fix, but it seems to be working for me, so thought I would share here.

@rand12345
Copy link

Thank you for creating a fix @ocl80, it's working well here.

@FozzieUK Do you have time to help bring these changes into @canton7 work and create a PR for this? I think many users are affected by this issue.

@FozzieUK
Copy link
Contributor

@rand12345 I think @williamjeccles has also done a lot of work on this as well to merge.

The biggest challenge is not to break the integration with earlier releases of firmware before 1.33 and @canton7 has already started work on that.
Sadly i'm away for a couple of weeks so won't be able to get to look it for a while, I can see a number of users are needing this so hopefully @canton7 can find a bit of spare time to push this out 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants