Connecting Goodwe Solar Panel Inverter to Openhab

Mmmh. It seems that the authentication to the semsportal fails.

Could you add

echo $RESULT
echo $HEADER

to end of the script.

EDIT: Please X-out any sensitive data in the output before posting, such as the token or your id and email.

Oeps, my mistake, hope i wiped it all.
Put
echo $RESULT
echo $HEADER
at the end.

Now nothing happens in the log file.
But in the exec.things, i don’t see collors like the topic starter.
Is that oke?

Could you run the script on the command line with those additions?

No then i get > something
>

Then i use ctrl c to stop it.
But no nothing happens in the log about the goodwe.

.

Roger,

Now i’have a very very long logfile.
Still a mistake in the sitemap, but we’re getting there.

Edit: It’s working,but how can i shorten the logfile?

Anyone how know’s how to make that very long logfile shorter?
And i only get the total KW of that day.
The rest is blank.

Good to hear, that you were able to make progress. Sadly, I haven’t found a solution for the amount of logging. Openhab only offers to switch of the logging for all things and items, but not for dedicated items.

If you are missing more information than something isn’t working with the JSON parsing. Basically, you can read everything you see in the log.

I read most information from the powerflow section in the log.

“powerflow”: {
“pv”: “216.52(W)”,

“load”: “527.52(W)”,
“loadStatus”: 1,
“grid”: “311(W)”,

},

For example, to read the current PV generation you need to read the JSON-path $.powerflow.pv
I do this in my rule “PV JSON transform”. I then remove the brackets around the ‘W’, so openhab can use it.

val outputPower = transform(“JSONPATH”,“$.powerflow.pv”,PV_JSON_Out.state.toString)
UG_PV_Output_Power.postUpdate(outputPower.toString.replace(‘(’,’ ‘).replace(’)‘,’'))

This, works with every information in the log, so also your local load, the battery status, etc.

Hi, first off all, thanks for the very nice solution to integrate the goodwe inverters into openhab.

I also did not like the extended logging this solution is generating.
i have worked around the solution to only pass the information i need form the JSON to the openhab item. basically i modified your bash script to echo only the inverter type, daily kW and actual W

last line of my script is now:

echo “$RETURN” | jq “[.data.inverter | {inverter: .invert_full.name, kwday: .invert_full.eday, power: .invert_full.pac}]”

my output

[ { “inverter”: “GW6000-DT”, “kwday”: 1, “power”: 0 },
{ “inverter”: “GW8000-DT”, “kwday”: 1.4, “power”: 0 } ]

ofcourse .rules and .items files are to be changed too

1 Like

Hi Power-Producers,

as the Informations i get from the API back for my installation … how can i get these additional informations in the connector? For me its in first interesting whats the chargelevel of my battery (soc)

One Response (Partly) of my Account is shown below :

“capacity”: “5kW”,
“model”: “GW5K-ET”,
“output_power”: “389W”,
“output_current”: “1.1A”,
“grid_voltage”: “233.4V/234.3V/232.1V”,
“backup_output”: “233.4V/19W”,
“soc”: “49%”,
“soh”: “100%”,
“last_refresh_time”: “08.29.2021 14:30:31”,
“work_mode”: “Wait Mode”,
“dc_input1”: “232.8V/8.6A”,
“dc_input2”: “0V/0A”,
“battery”: “200.2V/-7.8A/-1562W”,
“bms_status”: “ChargingOfBattery”,
“warning”: “Normal”,
“charge_current_limit”: “18A”,
“discharge_current_limit”: “18A”,
“firmware_version”: 618,
“creationDate”: “08/29/2021 20:30:31”,
“eDay”: 6.6,
“eTotal”: 100.5,
“pac”: 2002.08,
“hTotal”: 304,
“vpv1”: 232.8,
“vpv2”: 0,
“vpv3”: null,
“vpv4”: null,
“ipv1”: 8.6,
“ipv2”: 0,
“ipv3”: null,
“ipv4”: null,
“vac1”: 233.4,
“vac2”: 234.3,
“vac3”: 232.1,
“iac1”: 1.1,
“iac2”: 1,
“iac3”: 1,
“fac1”: 49.99,
“fac2”: 49.99,
“fac3”: 49.99,
“istr1”: 0,
“istr2”: 0,
“istr3”: null,
“istr4”: null,
“istr5”: null,
“istr6”: 13.9,
“istr7”: null,
“istr8”: 12.2,
“istr9”: null,
“istr10”: 11.9,
“istr11”: null,
“istr12”: 0,
“istr13”: 0,
“istr14”: 0,
“istr15”: 0,
“istr16”: 0

Hello all,

I’m new to this community, so forgive me if I do something wrong.

In OH3 there is a SEMSportal binding, but unfortunately only a few channels are supported. So the solution proposed by @RogerG007 is still the best option for me.

There are some minor changes:

  • The configuration files are now located in /etc/openhab (previously /etc/openhab2)

  • For security reasons you have to add a line in /etc/openhab/misc/exec.whitelist:

bash /etc/openhab/scripts/semsapi.sh

In order to drastically reduce the logging, like @jippe I have adapted the last line of semsapi.sh. Mine looks like:

echo "$RETURN" | jq '.data | {eday: .inverter[0].invert_full.eday, pv: .powerflow.pv, pvStatus: .powerflow.pvStatus, battery: .powerflow.bettery, batteryStatus: .powerflow.betteryStatus, load: .powerflow.load, loadStatus: .powerflow.loadStatus, grid: .powerflow.grid, gridStatus: .powerflow.gridStatus, soc: .powerflow.soc, ebuy: .energeStatisticsCharts.buy ,esell: .energeStatisticsCharts.sell ,econsumption: .energeStatisticsCharts.consumptionOfLoad }' |tr '\n' ' '

If you want to study the data, you can temporarily replace this last line by

echo "$RETURN" | jq '.data' > goodwe.json

You can view the generated goodwe.json file with an editor like Notepad++. If you choose the JSON syntaxis, then you can collapse all the unnecessary branches.

I found that .powerflow.bettery and .powerflow.grid are always positive values. So if you want to know the direction, you also have to monitor the status values (-1, 0 or 1). Unfortunately there is a small error in the API for the grid status: you have to use .powerflow.loadStatus and not .powerflow.gridStatus. This could be different for your inverter. I have an EH type inverter.

1 Like

Hi all,

I used this good solution as a base for a new solution using direct communication with the inverter. No more need for an internet connection:
https://community.openhab.org/t/connecting-goodwe-solar-panel-inverter-directly-to-openhab/130982

For testing purposes, both solutions can work at the same time without interfering with each other. Of course with new items and rules.

Diego

I get a lot of these warnings in the log file:

2022-04-18 10:58:56.611 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler StationHandler of thing semsportal:station:08dc1a843c:d1ffe7e8-2573-455a-8fb5-f5f4e161ec0d tried accessing its bridge although the handler was already disposed.

2022-04-18 10:58:56.635 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler StationHandler tried updating the thing status although the handler was already disposed.

That’s probably because you changed settings which stopped and started the binding. Stopping the binding does not properly dispose all handlers and an old one still polls the sems portal. Try restarting openhab, those messages will most likely be gone.

Hi,

I’ve just found and implemented the SEMSPortal binding. Thanks for creating that! But is there no possibility to show the battery and the SOC?

Thx,
Denis

I also installed SEMSportal. I also miss battery SOC and current load or meter (power consumption of the house).
I would like to get to the state to know the difference between current load and current output of the solar plant. I want to add rules that switches device to “eat up” the output before it goes to grid (e.g. charging the car).

Is it possible to add the channels to the binding (openhab 4.1.1 on raspberry pi)

Is the shell script solution still working in OH 4.1.1?

Yes, I am still using it to get all the values I need. (including SOC and current load).

Sorry, my mistake. I was referring to the bash-script solution:

This works. If you need any help here, let me know.

Sorry, wrong thread. I deleted my post