TimSoethout / goodwe-sems-home-assistant

Sensor for Home Assistant pulling data from the GoodWe SEMS API for solar panel production metrics.
88 stars 38 forks source link

More than 1 inverter #10

Closed jojoro1 closed 3 years ago

jojoro1 commented 4 years ago

How to get data from second inverter?

spaya1 commented 3 years ago

Ok so I was able to pull the gui

image

But now it picks the second inverter only xD

image

I would expect here 2 entities

image

Did I do something wrong?

TimSoethout commented 3 years ago

Cool! Progress! You should be able to add the integration twice with the different powerstation id's. At least that was the idea. I can only test with one. :P

spaya1 commented 3 years ago

In my case the plant name is the same for both inverters :). The curious thing is that before (with platform setup) it was showing Inverter 1, and now (with gui setup) it shows Inverter 2.

TimSoethout commented 3 years ago

Ooooh wait. The powerstation_id is the plant id? And not the specific inverter ID? If that is so, I need to change the code. :P

On Wed, 14 Apr 2021 at 21:37, spaya1 @.***> wrote:

In my case the plant name is the same for both inverters :). The curious thing is that before (with platform setup) it was showing Inverter 1, and now (with gui setup) it shows Inverter 2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TimSoethout/goodwe-sems-home-assistant/issues/10#issuecomment-819781306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQZ3D6VTVIJQHTQ67DTRTTIXVHFANCNFSM4JQ6HYBA .

spaya1 commented 3 years ago

If you tell me how I can load the api, I can look which are the fields that hold the 2 serial numbers that I am looking for :)

TimSoethout commented 3 years ago

You can login to https://semsportal.com and in your browsers developer tools on the network tab you can see the different api calls with their JSON responses. Will that help?

spaya1 commented 3 years ago

"releation_id": "147cb869-xxx", "type": "GW2000-NS", "capacity": 2.0, "d": { "pw_id": "5c4e9558-xxx", "capacity": "2kW", "model": "GW2000-NS"

    "invert_full": {
      "sn": "92000xxx",
      "powerstation_id": "5c4e9558-442f-xxxx",
      "name": "Old PV",
      "model_type": "GW2000-NS",

"releation_id": "50e0e175-xxx", "type": "GW2000-XS", "capacity": 2.0, "d": { "pw_id": "5c4e9558-xxx", "capacity": "2kW", "model": "GW2000-XS",

"invert_full": { "sn": "52000xxx", "powerstation_id": "5c4e9558-xxxx", "name": "52000xxx", "model_type": "GW2000-XS", "change_type": 0,

TimSoethout commented 3 years ago

Ok, I just pushed a change that used the inverters serial number as unique id for the HA entity. Maybe this will work already when you re-add the integration.

spaya1 commented 3 years ago

Got two sensors showing now, both for the same inverter, the old one shows unavailable, the new one works and has a new name (the inverter name)

image image
spaya1 commented 3 years ago

Ok, I just pushed a change that used the inverters serial number as unique id for the HA entity. Maybe this will work already when you re-add the integration.

how about using releation_id as unique identifier?

TimSoethout commented 3 years ago

Yes, I changed some stuff with unique id's and display names. HA might show some old id's/names as well.

I just released a version based on serial number: https://github.com/TimSoethout/goodwe-sems-home-assistant/releases/tag/3.1.0-beta2 This one should also work with HACS if you turn beta versions on. Now I'm off to bed. I hope this works. :)

About the releation_id, that might also work, as long as it's unique per inverter.

TimSoethout commented 3 years ago

Thanks for all the feedback @spaya1 . If this one works, I'll promote it to the new normal version.

spaya1 commented 3 years ago

I tried left and right to install via beta, but I was only seeing 1.0.0 and 1.0.1 so I downloaded the src code from the link you shared.

At first it didn't work, it showed the old sensors, but then they were both unavailable. So I removed the integration and added it again (via gui). Now it seems to work 👍

image image image

I owe you some bitterballen!

spaya1 commented 3 years ago

Hi Tim,

Good morning, for some reason I cannot access semsportal via the app anymore :), it times out.

I would hold before making this part of the master branch. Is this an issue at Goodwe side (do you have the same today?) or is it the beta integration?

In hassio I am getting the following error:

Logger: custom_components.sems.sensor Source: helpers/update_coordinator.py:205 Integration: GoodWe SEMS PV API (documentation, issues) First occurred: 8:58:12 AM (1 occurrences) Last logged: 8:58:12 AM

Error fetching SEMS API data: Error communicating with API: 'NoneType' object is not iterable


Logger: custom_components.sems.sems_api Source: custom_components/sems/sems_api.py:84 Integration: GoodWe SEMS PV API (documentation, issues) First occurred: 8:58:12 AM (1 occurrences) Last logged: 8:58:12 AM

Unable to fetch login token from SEMS API. HTTPSConnectionPool(host='www.semsportal.com', port=443): Read timed out. (read timeout=60)


Logger: custom_components.sems.sems_api Source: custom_components/sems/sems_api.py:126 Integration: GoodWe SEMS PV API (documentation, issues) First occurred: 8:58:12 AM (1 occurrences) Last logged: 8:58:12 AM

Unable to fetch data from SEMS. 'NoneType' object has no attribute 'requestTimestamp

TimSoethout commented 3 years ago
2021-04-15 08:08:11 ERROR (SyncWorker_6) [custom_components.sems.sems_api] Unable to fetch data from SEMS. 'NoneType' object has no attribute 'requestTimestamp'
2021-04-15 08:08:11 ERROR (MainThread) [custom_components.sems.sensor] Error fetching SEMS API data: Error communicating with API: 'NoneType' object is not iterable

I get some of these with the new beta version. I also see them on my "production" system running on 1.0.1. However, it's not all the time and on both I also get data.

It seems the portal logs you out when you login elsewhere (e.g. via the integration). Maybe for your 2 inverters they log each other out?

I guess the code should reuse logins somehow... But that would take some more development and looking into how to do that.

spaya1 commented 3 years ago

Alright, then this is ready for production in that case. I also have the pvoutput integration (outside of hassio), but that connects to the api, and updates the site every 5 minutes. So dont think its related.

Thanks again!

TimSoethout commented 3 years ago

Should be solved by #26 and released as version 3.1.0. :D

Thanks for the debugging/testing support @spaya1.