Goodwe rest sensor for multiple json elements

Updated! (Was on holiday.)
Thanks for @vPotusFlotus (on GitHub) for providing the fix and updating the code to use the GoodWe API!

Instructions are also updated in the readme.

Would it be possible to get SOC and SOH from a battery system connected to the Goodwe? The status shows in the SEMS app so I guess it may be available on the API?

That is an interesting idea. Since I do not own a battery I can’t easily try this out.
You can start using the web portal and use the web inspector to see which API requests are being done. The hass component should be able to mimic this.

Ok, I logged into the portal and this is what i see in the inspector:

{“api”:“v1/PowerStation/GetSoc”,“param”:{“powerStationId”:“my_station_id”}}

I’m not seeing anything specific for SOH (State of Health) - It may already be included in:

{“api”:“v1/PowerStation/GetMonitorDetailByPowerstationId”,“param”:{“powerStationId”:“my_station_id”}}

When I login I see a POST to https://www.semsportal.com/GopsApi/Post?s=v1/PowerStation/GetMonitorDetailByPowerstationId and in the json inside inverter/d I see

 "soc": "100%",
 "soh": "0%",

Is this the information you require?

Yes thats it :slight_smile:

I think it is already in the state of the SEMS component. See sensor.sems_portal in Developer Tools > State

I did have a look there previously - I just checked again. I see all the other values but no SOC or SOH

That’s odd. I see it as one device:

Maybe you explicitly created sensors for the different components? Or are you using @bouwew’s component? I’m using https://github.com/TimSoethout/goodwe-sems-home-assistant.

My bad… I’ve just realized I’m being really dumb. I’m using a different version (from https://github.com/bouwew/sems2mqtt)… I see the soc and soh aren’t defined in the code…

FYI - I did manage to get the missing stats:

image

@bouwew I have created a pull request on your end - Have a look and see if you’re ok with the changes?

@kernelkraut
I have moved recently so I don’t own a Goodwe solar inverter anymore.
I can keep the repository alive, accepting pull requests like yours. But I would not mind for someone taking my code and taking it further wrt functionality and quality :slight_smile:

I’m happy to help wherever I can :slight_smile:

Pull-request accepted in my github.

thank you for the component.
I have added the lines in the config file:

Sensor:
- platform: sems 
  username: youremailaddresshere
  password: secretpasswordfromsemsportal
  station_id: stationidhere

But get error:
‘’’
Failed config
General Errors:
- Platform not found: sensor.sems
‘’
Do I need to add a line like to one below to point to the sems directory?

sems: !include_dir_list custom_components/sems

PLease advise

I have updated the call to

sems:
- platform: sems 
  username: youremailaddresshere
  password: secretpasswordfromsemsportal
  station_id: stationidhere
  name: (optional, name for sensor)

that seem to have found the component. Now the error is

2020-04-11 08:06:49 ERROR (MainThread) [homeassistant.setup] Error during setup of component sems
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/setup.py”, line 194, in _async_setup_component
component.setup, hass, processed_config)
AttributeError: module ‘custom_components.sems’ has no attribute ‘setup’

Little bit new, but making progress. Any pointers where to look?

Hi,
where did you install the custom component? it should be in …/config/custom_components/sems/{all files here}.
Your config should should look like:
sensor:

  • platform: sems

Has anyone found a way to push changes to the Goodwe inverter? Currently I allow the batteries to discharge when on grid to maximise solar use, but when loadshedding starts I want HA to change this setting to prevent the batteries from being discharged while we have power

I have two inverters and batteries. I would be interested in helping get data that is meaningful in these scenarios. Currently only the data from the first inverter is shown and oddly the SOC is shown as 200 - wow I must be producing some power. Where can I begin?

Hey,
There is already a branch for multiple inverters on my SEMS component, but not yet merged because it has breaking changes.: https://github.com/TimSoethout/goodwe-sems-home-assistant/tree/%2310-multiple-inverters+async
Corresponding issue: https://github.com/TimSoethout/goodwe-sems-home-assistant/issues/10

Maybe you can start there?
You could start by capturing the JSON output of the SEMS API by manually using https://www.semsportal.com/home/login and capturing the network traffic (via browser tools). Maybe there is some info on batteries there?