kellerza / sunsynk

Deye/Sunsynk Inverter Python library and Home Assistant OS Addon
https://kellerza.github.io/sunsynk/
MIT License
204 stars 87 forks source link

seperate battery values #213

Closed f1wade closed 6 months ago

f1wade commented 9 months ago

Existing sensor definitions can be found here

Details about your Inverter: make/model/firmware

Sunsynk 5kw ecco 2 x sunsynk 5.1kwh IP65 batteries

I am pretty sure I need to update my version of the integration, but not sure that will help.

A clear and concise description of what the bug is.

Not sure if a bug or feature request. But I have seen Bat1 SOC in the definitions file 'Sensor(603, "Bat1 SOC", "%"),' I copied it to my local definitions, but it always reads empty. I have gone through 0-700 registers, and had a glance, and I can see 316 tracks similar to the battery SOC.

But I still can't find values for the 2 different batteries.

Any ideas what registers would show this, or if there is a way to read the battery BMS SOC's through this integration?

Any suggestions on proposed registers is welcome.

Logs (if applicable)

I don't think the log files are relevant, but there are a few errors in them, so attached in case they are any use to you.


paste logs in 3x backticks...
[4bb530c7_hass-addon-sunsynk-multi_2023-12-06T09-22-46.130Z.log](https://github.com/kellerza/sunsynk/files/13578952/4bb530c7_hass-addon-sunsynk-multi_2023-12-06T09-22-46.130Z.log)
kellerza commented 9 months ago

These definitions come from the Sunsynk protocol document, but I’ve never managed to get individual battery stats on my Sunsynk either

I suspect the only way would be to interrogate the batteries directly via some other method

reedy commented 8 months ago

Slightly relatedly, I've been talking to the Solar Assistant guys about something like this. Even with an RS232 cable plugged straight into one of the Sunsynk batteries, it only gets the value of the battery it's plugged into...

f1wade commented 8 months ago

It's strange as you can see it on the bms battery pages, so it must have them somewhere being read in.

reedy commented 8 months ago

Undocumented stuff? Say it ain't so ;)

I get barely anything there for my batteries

image

europer commented 8 months ago

Hello Kellerza,

You're my savior after days and days of testing, errors, testing, errors, testing, errors. But the good thing is, you always learn a lot. So a fantastic software. Thanks.

I can't explain it, but the System Working Mode (Work Mode 2) doesn't seem to be working as expected. When I set it to "on" for grid charge, the watts I set are not being used. This issue doesn't seem to be related to your fantastic software. Even manually setting it directly on the Deye Sun-12K or using the Deye Cloud has no impact on this. Discharge works fine, is only for charging!

The only way for me to control the wattage is in the Battery Setting (Batt Set2), where I change the amps using the rough calculation of Amps x average Voltage (approximately 53V), which works fine. Since this Deye inverter is only for charging/ischarging my 20.48kWh rack as a base load system (no PV on this inverter), I can play with the time and have a fixed value (at a given time, 80A). In Node-Red, I can play with time instead of the wattage, but it would be nice to control this parameter directly.

Is there a way to change the values in the Batt Set2 (see pic)?

Thanks and greetings from Munich and Oslo

20231221_212352

europer commented 8 months ago

I found this from the first issue in this tread... in the code this:

#############
# Inverter settings
#############
SENSORS += NumberRWSensor(230, "Grid Charge Battery current", AMPS, min=0, max=185)

Looks what I'm looking for?

If yes how can I use it in the config yaml in the app in HA?

Thx Per

kellerza commented 8 months ago

@europer you can add that line as a custom sensor - https://kellerza.github.io/sunsynk/reference/mysensors

You can see the registers mappings used today in the definitions.py file.

For other possible register values, take a look at #59 for the single phase inverter

europer commented 8 months ago

@kellerza thanks....what a great program. I got the custom sensor to work but I did find this in the main program and that was what I wantend, so now I can controll the Grid Charge Battery Current, just putted into the config yaml file and can now R/W what is perfect for estimating needed Watt for a time frame.

One question, the needed sensors I did find in the definitions.py and not in the definitions3ph.py.

Im using the 3ph Deye Sun-12k and in config yaml also the SENSOR_DEFINITIONS: three-phase

so do I use both py's since I guess the one is for 1ph and the other for 3ph? just for my understanding

Thanks again :) Per

#############

Inverter settings

############# SENSORS += NumberRWSensor(230, "Grid Charge Battery current", AMPS, min=0, max=185) SENSORS += NumberRWSensor(210, "Battery Max Charge current", AMPS, min=0, max=185) SENSORS += NumberRWSensor(211, "Battery Max Discharge current", AMPS, min=0, max=185)

kellerza commented 8 months ago

@europer I only have a 1-ph inverter, so it is very likely that I've added more sensors to the 1-ph definitions and that 3-ph is not in sync.

If you do find some of these that works in your mysensors.py and are not present in definition3ph.py, do you mind creating a PR to add them? (If you add only modify a single file you can do it all via the web, no need for git etc.)

europer commented 8 months ago

Sure I will :) happy new year 🍾🥳🎉 And again thx for a fantastic software your giving to the community Per

europer commented 8 months ago

Just a stupid question from my side, can you rewrite it, since I did not understand 100% what you mean "do you mind creating a PR to add them? (If you add only modify a single file you can do it all via the web, no need for git etc.)" You mean email you? (But also here of course 😀)

kellerza commented 8 months ago

PR=Pull request

You simply go to the file on the web interface, then "edit" it (it might ask you to create your own fork etc) and once you've done adding (comitting) the changes you have the option to create a Pull Request. The Pull request then gets added to the main software and you become a contributor to the project

europer commented 8 months ago

Thx, never done it but will do it. Cool, have a good start in 2024. Cheers Per

f1wade commented 6 months ago

I have just found the sunsynk modbus document https://sunsynk.freshdesk.com/support/solutions/articles/103000251063-sunsynk-modbus-protocol-single-phase- and can see a list of 15 battery pack details, So I am trying values 603 and 617, but not sure if these should be factored by any amount, and how best to tell.

I wondered if the 0.1 meant a factor, but not sure?

I tried them, but all got the value of 0, even tried the SerialSensor for the battery id, but got nothing.

kellerza commented 6 months ago

Not all the registers are supported by all firmware versions. You could always try to update your Inverter firmware...

Mine is also 0 for other battery registers