GithubHelp home page GithubHelp logo

Comments (37)

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

Have a look at the work i did on the Goodwe SBP5000 and the breakdown of the responses etc - there is a long series of posts on the Australian Whirlpool discussion forums in the energy section about Grid Arbitrage.

I also put a lot of debugging stuff i worked through in the issues of this Github repository

mletenay/home-assistant-goodwe-inverter#48

Craig

from goodwe.

oziee avatar oziee commented on August 11, 2024

thanks Craig..

I had found that thread and read through before. its just a pity that values do not link to what they mean. I would have expected PV values to be empty since there is no PV connections.

im still trying to work out which sensor items to tally to work out solar production etc since there is a CT clamp there must be some type of sensor to work with

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

Did you have a look at the Whirlpool thread on Grid Arbitrage ? There are a couple of guys who are using Modbus on ESP devices to talk to the inverter and pull out stats and control the battery (which one day i will probably get around to as well !)

I think you might find that the SBP5000 shares the same registers with the 5048 series - that do support Solar Panels.

Craig

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

I think you will need to pick apart their Python code and see which registers they are mapping - i think they are lumping the SBP in with the 5048 series and assuming the results are the same (as very few people have these inverters) and hence they are mapping some info incorrectly.

Do you have the GM1000D (dual CT clamp sensor with yours) or the GM3000 (3 Phase ?)

Craig

from goodwe.

oziee avatar oziee commented on August 11, 2024

GM1000D

Forking and hacking it is :)

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

from goodwe.

oziee avatar oziee commented on August 11, 2024

@craigcurtin-dev yup.. been reading though whirlpool too..

also reverse engineering the PV Master app.. seem that the SBP might be a different type than what it is selected in code in this repo.. might be EH type

public static int getEHBHSBType() {
        byte var0;
        if (Constant.Inverter_sn.contains("5000")) {
            var0 = 1;
public static boolean is105PlatForm() {
        return Constant.Inverter_sn.contains("ESU") || Constant.Inverter_sn.contains("EMU") || Constant.Inverter_sn.contains("ESA") || Constant.Inverter_sn.contains("BPS") || Constant.Inverter_sn.contains("BPU");
    }

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@marcelblijleven I have the same issues with same inverter, how can we progess resolution, happy to help.
home-assistant/core#79866

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

@Uksa007 (as commented in the other issue) please provide output from the following program (change the ip_address to yours), plus a capture of matching data from semsportal so they can be compared/aligned.

import asyncio
import goodwe
import logging

async def get_runtime_data():
    ip_address = '192.168.30.126'

    inverter = await goodwe.connect(ip_address)
    runtime_data = await inverter.read_runtime_data(include_unknown_sensors=True)

    for sensor in inverter.sensors():
        if sensor.id_ in runtime_data:
            print(f"{sensor.id_}: \t\t {sensor.name} = {runtime_data[sensor.id_]} {sensor.unit}")


logging.basicConfig(level=logging.DEBUG)
asyncio.run(get_runtime_data())

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz @oziee has provided the same info that i can post at top of this issue, I don't see the point in duplicating.
We need some direction from @marcelblijleven as to how to resolve.

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

@Uksa007 when you run with the debug flag turned on, the raw bytes from the inverter are displayed, not just the "processed" key-value. The problem is (I'm assuming) in the interpretation of the bytes, so looking at the known-bad data isn't so helpful.

For example, mine is:

DEBUG:goodwe:Connecting to DT family inverter at 192.168.30.126.
DEBUG:goodwe.inverter:Creating lock instance for current event loop.
DEBUG:goodwe.protocol:Sending: 7f03753100280409
DEBUG:goodwe.protocol:Received: aa557f0350000200c80001303030304B4454413030303030303030475732304b41552d4454ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000f000f0010044b00bb00030000e4bd
DEBUG:goodwe:Connected to inverter GW20KAU-DT, S/N:xxx.
DEBUG:goodwe.protocol:Sending: 7f0375940049d5c2
DEBUG:goodwe.protocol:Received: aa557f0392160a1513172a0f4100440dbc0047ffffffffffffffffffffffffffffffff0f2d0f4d0f6908d508bc08eb0048004a00471384138413850000135d000100000000000000000000000000cd0000000003e7ffff016cffffffff00c60000a8280000047300200000000000000000ffffffffffffffffffffffffffffffff0000174b0bad000000040000044b00000004000000696b04

With your inverter bytes, we can create a test-case (like this) using it, then iterate on the interpretation until it matches what you know from semsportal.

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz it seems to identify as BP inverter which it is.

I will try to get matching data with SEMS but it is always behind and think it may do some averaging, as it's update is slow.
Edit: updated with matching data from SEMS

SEMS

DEBUG:asyncio:Using proactor: IocpProactor
DEBUG:goodwe:Connecting to BP family inverter at 192.168.60.134.
DEBUG:goodwe.inverter:Creating lock instance for current event loop.
DEBUG:goodwe.protocol:Sending: aa55c07f0102000241
DEBUG:goodwe.protocol:Response has unexpected length: 149, expected 149.
DEBUG:goodwe.protocol:Received invalid response: aa557fc001868c0ec5000c000000000100020f019f0050010400360064006400001c001c6403000001097800180001138b0100000016ff02138d00020160000000000000048e0000016d0011003d00000f75ff0201003000000000010000febf100008000000160a160d0e25000000000000000000000000000000000000000000000000000004e7000004bf020000000000001128
DEBUG:goodwe.protocol:Sending: aa55c07f0102000241 - retry #1/3
DEBUG:goodwe.protocol:Received: aa557fc001824d3130313043475735303030532d42502331300000000000000000000000000039353030304250533232335730313336333630303431302d30343030312d3130093431302d30323033342d313502100e
DEBUG:goodwe:Connected to inverter GW5000S-BP, S/N:removed.
DEBUG:goodwe.protocol:Sending: aa55c07f0106000245
DEBUG:goodwe.protocol:Failed to receive response to aa55c07f0106000245 in time (1s).
DEBUG:goodwe.protocol:Sending: aa55c07f0106000245 - retry #1/3
DEBUG:goodwe.protocol:Received: aa557fc001868c0ebb000d000000000100020f019f0050010400360064006400001c001c640300000109760019000e13890100000017ff02138900020160000000000000048e0000016d0011003d00000f75ff0201003000000000010000fec1100008000000160a160d0e25000000000000000000000000000000000000000000000000000004e7000004bf020000000000001128
vpv1:            PV1 Voltage = 377.1 V
ipv1:            PV1 Current = 1.3 A
ppv1:            PV1 Power = 490 W
pv1_mode:                PV1 Mode code = 0
pv1_mode_label:                  PV1 Mode = PV panels not connected
vpv2:            PV2 Voltage = 0.0 V
ipv2:            PV2 Current = 0.1 A
ppv2:            PV2 Power = 0 W
pv2_mode:                PV2 Mode code = 0
pv2_mode_label:                  PV2 Mode = PV panels not connected
ppv:             PV Power = 490 W
vbattery1:               Battery Voltage = 52.7 V
battery_status:                  Battery Status = 80
battery_temperature:             Battery Temperature = 26.0 C
ibattery1:               Battery Current = -5.4 A
pbattery1:               Battery Power = -285 W
battery_charge_limit:            Battery Charge Limit = 100 A
battery_discharge_limit:                 Battery Discharge Limit = 100 A
battery_error:           Battery Error Code = 0
battery_soc:             Battery State of Charge = 28 %
battery_soh:             Battery State of Health = 100 %
battery_mode:            Battery Mode code = 3
battery_mode_label:              Battery Mode = Charge
battery_warning:                 Battery Warning = 0
meter_status:            Meter Status code = 1
vgrid:           On-grid Voltage = 242.2 V
igrid:           On-grid Current = 2.5 A
pgrid:           On-grid Export Power = 14 W
fgrid:           On-grid Frequency = 50.01 Hz
grid_mode:               Work Mode code = 1
grid_mode_label:                 Work Mode = Inverter On
vload:           Back-up Voltage = 0.0 V
iload:           Back-up Current = 2.3 A
pload:           On-grid Power = -254 W
fload:           Back-up Frequency = 50.01 Hz
load_mode:               Load Mode code = 0
load_mode_label:                 Load Mode = Inverter and the load is disconnected
work_mode:               Energy Mode code = 2
work_mode_label:                 Energy Mode = Normal (On-Grid)
temperature:             Inverter Temperature = 35.2 C
error_codes:             Error Codes = 0
e_total:                 Total PV Generation = 116.6 kWh
h_total:                 Hours Total = 365 h
e_day:           Today's PV Generation = 1.7 kWh
e_load_day:              Today's Load = 6.1 kWh
e_load_total:            Total Load = 395.7 kWh
total_power:             Total Power = -254 W
effective_work_mode:             Effective Work Mode code = 1
effective_relay_control:                 Effective Relay Control = 48
grid_in_out:             On-grid Mode code = 0
grid_in_out_label:               On-grid Mode = Idle
pback_up:                Back-up Power = 0 W
plant_power:             Plant Power = -254 W
meter_power_factor:              Meter Power Factor = 0.001
xx85:            Unknown sensor@85 = 0
xx87:            Unknown sensor@87 = -319
diagnose_result:                 Diag Status Code = 268437504
diagnose_result_label:           Diag Status = Self-use load light, SOC protect off
house_consumption:               House Consumption = 191 W

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

Copy/past from the HA issue:

Uksa007 commented 14 minutes ago
@lyricnz Is there someway to just view the raw the values, I have a feeling that the current script is doing wrong maths and makes some of the values really hard to match to anything.

So far I have:

e_day: Today's PV Generation = 1.7 kWh should be e_day: Today's Battery output = 1.7 kWh
e_total: Total PV Generation = 116.6 kWh should be e_total: Total Battery output = 116.6 kWh
pgrid: On-grid Export Power = 14 W from meter (+export, -import seems backward)
plant_power: Plant Power = -254 W maybe AC ongrid power charge/discharge (+discharge -charging)

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

Hi @Uksa007

Most of the fields that you see in the sensors are just mapped directly from (runtime) bytes in the hex you saw above. There's some "sensor definition table" which is applied to the bytes - they start at "offset", have a size and unit etc.

Eg:
image

Here's the sensor table for the ES inverter (which seems to include BP)
https://github.com/marcelblijleven/goodwe/blob/master/goodwe/es.py

Actually, I've just noticed there is already a test for your inverter: https://github.com/marcelblijleven/goodwe/blob/master/tests/test_es.py#L300

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

Actually, I've just noticed there is already a test for your inverter:

Thats sounds good, how can I test it?
Seems like Mock data?

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz @craigcurtin-dev > Hey guys, Just wanted to jump in here and mention that I was the one that originally got the ball rolling on the SBP integration stuff. At the time that it was all being put together (prior to it being an official integration) I had just received my 3 x SBP5000 units and was busy decoding them each evening using wireshark I went backwards and forwards with the developer sending him the outcome of throwing the various 241 and 245 codes at the inverters and I do not believe we ever got to the point of having a working fully decoded stream – so it was just shoe horned into the rest of it. >>

Hi,
Yes I guess that what I'm seeing some things seems right(with wrong labels) some things just don't seem to match anything.
Would be really good to get fully decoded stream.
Developer seems to be AWAL, wondering how to progress, any idea?

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

Thanks for the tips @craigcurtin-dev. Is the SBP really too much different to the ES/EM/BP as implemented in es.py? (I saw the message about "Response has unexpected length: 149, expected 149" :/)

As far at this user is reporting, I haven't quite been able to get to the bottom of what they need. Clearly the labels say PV when it means battery (but so does semsportal - so who's to say when it should be different? may depend on runtime mode)

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

@Uksa007 if you don't like the labels in HA, you could just make a new sensor, with the labels you like, which gets its values from the "wrongly named" ones in the Goodwe integration.

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

I'll make a PR to make the 149 != 149 error message a bit more sane.

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

Way ahead of you there, I pretty much have managed to use the provided data, and calculate a few things, but would be good to fix it, so it's not so broken.

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

@Uksa007 I'm in HA discord if you want to chat in more realtime (but I'm not a maintainer of this module)

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@craigcurtin-dev
So I take it that there is no documentation to decode the stream, it doesn't follow any of the modbus type data?

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@craigcurtin-dev > I will try and setup my capture environment again this evening and report back when I can do some more captures.
Thanks craig.

The following are a mystery to me:

vpv1: PV1 Voltage = 377.1 V                  Inverter Bus?
ipv1: PV1 Current = 1.3 A                    Inverter Bus?
ppv1: PV1 Power = 490 W                      Inverter Bus?
e_load_day: Today's Load = 6.1 kWh           Maybe Daily imported energy, but seems too high?
e_load_total: Total Load = 395.7 kWh         Maybe Total imported energy, but seems too high?
total_power: Total Power = -254 W            Same as plant_power?
plant_power: Plant Power = -254 W            AC power charged/discharged?
xx85: Unknown sensor@85 = 0
xx87: Unknown sensor@87 = -319
house_consumption: House Consumption = 191 W  Is not house consumption, not sure what it is?

Missing things may or maynot be available in the data stream:
Charging energy, eg how much energy you stored in the battery.

from goodwe.

craigcurtin-dev avatar craigcurtin-dev commented on August 11, 2024

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

So answering some of my own questions here, in es.py I found the below, it explains:

  • Why house consumption is incorrect, it is using pv1 which seems like inverter power bus not solar, in fact it doesn't know solar power unless it pulls it from SEMS or maybe can calculate it somehow, still thinking on that.
  • There looks to be a bunch of stuff commented out, missing sensors some of which i had to calculate manually, maybe it was a todo list that never got done?
        # Energy4("e_total_exp", 93, "Total Energy (export)", Kind.GRID),
        # Energy4("e_total_imp", 97, "Total Energy (import)", Kind.GRID),
        # Voltage("vpv3", 101, "PV3 Voltage", Kind.PV),  # modbus 0x500
        # Current("ipv3", 103, "PV3 Current", Kind.PV),
        # Byte("pv3_mode", 104, "PV1 Mode", "", Kind.PV),
        # Voltage("vgrid_uo", 105, "On-grid Uo Voltage", Kind.AC),
        # Current("igrid_uo", 107, "On-grid Uo Current", Kind.AC),
        # Voltage("vgrid_wo", 109, "On-grid Wo Voltage", Kind.AC),
        # Current("igrid_wo", 111, "On-grid Wo Current", Kind.AC),
        # Energy4("e_bat_charge_total", 113, "Total Battery Charge", Kind.BAT),
        # Energy4("e_bat_discharge_total", 117, "Total Battery Discharge", Kind.BAT),

        # ppv1 + ppv2 + pbattery - pgrid
        Calculated("house_consumption", 0,
                   lambda data, _:
                   round(read_voltage(data, 0) * read_current(data, 2)) +
                   round(read_voltage(data, 5) * read_current(data, 7)) +
                   (abs(round(read_voltage(data, 10) * read_current(data, 18))) *
                    (-1 if read_byte(data, 30) == 3 else 1)) -
                   (abs(read_power2(data, 38)) * (-1 if read_byte(data, 80) == 2 else 1)),
                   "House Consumption", "W", Kind.AC),
    )

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz
So what's the best plan of attack to start fixing this?
Should I fork it, make changes and hope @marcelblijleven accepts the pull request?

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

@Uksa007
I think that's the best approach. Even if they don't accept your PR, you can always install it into your local HA. You'd have to be super-careful not to break any of the other inverters supported by the same Inverter class. (I don't know if there's any model-specific kludgery). I have a fork with a couple of PRs I did while looking into your issue.

This module doesn't talk to semsportal, so the sensors can only reflect what the inverter itself knows. You might need to do any additional logic in the custom HA sensor.

Re: the commented out - it's more likely the list was cut and pasted from somewhere else, and those weren't applicable/correct for this inverter. You can look at the xx values to see if there's any useful-looking numbers in there.

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz > You'd have to be super-careful not to break any of the other inverters supported by the same Inverter class.

It looks like there was an old BP model which was a DC only, it sat between Solar panels and inverter with battery.
I was thinking of creating a new inverter class "S-BP", so it wouldn't interfere with the old BP inverter or any of the existing inverters.

Just trying to figure it out, python it not my native language :-p

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

I can see some device-specific kludges happen in DT read_device_info() - maybe it's okay to monkey around with self._sensors in some model-specific way. But the exact stuff you're expecting might also be mode-specific.

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz I want to change many things to be more model specific, so I think it might be safer to create new model class.
Have forked it, created new inverter class: SBP
https://github.com/Uksa007/goodwe/blob/master/goodwe/__init__.py

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

@lyricnz @craigcurtin-dev @marcelblijleven
Continue Discussion here
Uksa007#1

from goodwe.

mletenay avatar mletenay commented on August 11, 2024

As mentioned above, since the BP inverters seem to be that different from the (PV) inverters speaking the "ES" protocol, I suggest to go with dedicated class, so it does not break other families.
I'm happy to review and merge any changes, but you have to do the hard-work since I have no access to BP inverter to verify.

from goodwe.

lyricnz avatar lyricnz commented on August 11, 2024

How are you going @Uksa007 ?

from goodwe.

Uksa007 avatar Uksa007 commented on August 11, 2024

How are you going

@lyricnz Good, I have forked it and clean it up and it's looking good, just a couple of outstanding value I haven't been about to decode, @craigcurtin-dev was going to have a look but I think he has been busy.

Please see Uksa007#1

from goodwe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.