Coder Social home page Coder Social logo

gw2pvo's Introduction

gw2pvo

This repository is unmaintained. New maintainer(s) are welcomed.

gw2pvo is a command line tool to upload solar data from a GoodWe power inverter to the PVOutput.org website.

Installation

You need to have Python 3 and pip installed. Then:

sudo pip3 install --upgrade gw2pvo

Next determine the Station ID from the GoodWe site as follows. Open the Sems Portal. The Plant Status will reveal the Station ID in the URL. Example:

https://www.semsportal.com/powerstation/powerstatussnmin/9a6415bf-cdcc-46af-b393-2b442fa89a7f

So the Station ID is 9a6415bf-cdcc-46af-b393-2b442fa89a7f.

Furthermore, you need a (free) PVOutput account. Register a device and enable the API. From PVOutput you need:

  1. The API Key
  2. The System Id of your device

Netatmo

In case you have some Netatmo weather station nearby, you can use it to fetch the local temperature. First you need to create an (free) account at developers portal. Next create an app. This gives you a username, password, client_id, and a client_secret, which you need to supply to gw2pvo.

You have the option to either let gw2pvo find the nearest public weather station, or to select one yourself.

Dark Sky

Optionally, for actual weather information you can get a (free) Dark Sky API account. Register and get 1,000 free calls per day. Note that Dark Sky will shut down it's API in 2021 and does not accept new signups anymore.

Usage

usage: gw2pvo [-h] [--config FILE] [--gw-station-id ID]
                   [--gw-account ACCOUNT] [--gw-password PASSWORD]
                   [--pvo-system-id ID] [--pvo-api-key KEY]
                   [--pvo-interval {5,10,15}]
                   [--darksky-api-key DARKSKY_API_KEY]
                   [--netatmo-username NETATMO_USERNAME]
                   [--netatmo-password NETATMO_PASSWORD]
                   [--netatmo-client-id NETATMO_CLIENT_ID]
                   [--netatmo-client-secret NETATMO_CLIENT_SECRET]
                   [--netatmo-device-id NETATMO_DEVICE_ID]
                   [--log {debug,info,warning,critical}] [--date YYYY-MM-DD]
                   [--pv-voltage] [--skip-offline] [--city CITY] [--csv CSV]
                   [--version]

Upload GoodWe power inverter data to PVOutput.org

optional arguments:
  -h, --help            show this help message and exit
  --config FILE         Specify config file
  --gw-station-id ID    GoodWe station ID
  --gw-account ACCOUNT  GoodWe account
  --gw-password PASSWORD
                        GoodWe password
  --pvo-system-id ID    PVOutput system ID
  --pvo-api-key KEY     PVOutput API key
  --pvo-interval {5,10,15}
                        PVOutput interval in minutes
  --darksky-api-key DARKSKY_API_KEY
                        Dark Sky Weather API key
  --netatmo-username NETATMO_USERNAME
                        Netatmo username
  --netatmo-password NETATMO_PASSWORD
                        Netatmo password
  --netatmo-client-id NETATMO_CLIENT_ID
                        Netatmo OAuth client id
  --netatmo-client-secret NETATMO_CLIENT_SECRET
                        Netatmo OAuth client secret
  --netatmo-device-id NETATMO_DEVICE_ID
                        Netatmo device id
  --log {debug,info,warning,critical}
                        Set log level (default info)
  --date YYYY-MM-DD     Copy all readings (max 14/90 days ago)
  --pv-voltage          Send pv voltage instead of grid voltage
  --skip-offline        Skip uploads when inverter is offline
  --city CITY           Sets timezone and skip uploads from dusk till dawn
  --csv CSV             Append readings to a Excel compatible CSV file, DATE
                        in the name will be replaced by the current date
  --version             show program's version number and exit

The list of allowed cities can be found in the Astral documentation.

Examples

gw2pvo --gw-station-id GWID --gw-account ACCOUNT --gw-password PASSWORD --pvo-system-id PVOID --pvo-api-key KEY --log debug

If you want to save readings in a daily CSV file:

gw2pvo --gw-station-id GWID --gw-account ACCOUNT --gw-password PASSWORD --pvo-system-id PVOID --pvo-api-key KEY --csv "Solar DATE.csv"

Replace GWID, ACCOUNT, PVOID, PASSWORD, and KEY by the proper values. DATE is a template and will be automatically substituted by the current date.

Config file

It is more secure to define credentials in a config file instead of adding it to the command line. E.g. if you created gw2pvo.cfg as follows:

[Defaults]
gw_station_id = ...
gw_account = ...
gw_password = ...

pvo_api_key = ...
pvo_system_id = ...

darksky_api_key = ...

city = ...

Then this will also upload your inverter data to PVOutput:

gw2pvo --config gw2pvo.cfg --log debug

You can add any argument setting to the config file as you like.

Automatic uploads

The power graph on PVOutput is not based on the power reading from GoodWe, but on the amount of energy produced this day. This has the advantage that it does not matter if you skip one or more readings.

PVOutput gives you the option to choose to upload each 5, 10, or 15 minutes. Make sure you upload at the same rate as configured at PVOutput.

The inverter updates goodwe-power.com each 8 minutes. The API gives resolution for produced energy of only 0.1 kWh. So for a 5 minute interval we get a resolution of 1200 watt, which is pretty big. To get smooth PVOutput graphs, we apply a running average which depends on the configured PVOutput upload interval time.

Systemd service

If you run gw2pvo on a Systemd based Linux, you could install the script as a service, like:

[Unit]
Description=Read GoodWe inverter and upload data to PVOutput.org

[Service]
WorkingDirectory=/home/gw2pvo
ExecStart=/usr/local/bin/gw2pvo --config /etc/gw2pvo.cfg --pvo-interval 5 --skip-offline
Restart=always
RestartSec=300
User=gw2pvo

[Install]
WantedBy=multi-user.target

Store the file as /etc/systemd/system/gw2pvo.service and run:

sudo useradd -m gw2pvo
sudo systemctl enable gw2pvo
sudo systemctl start gw2pvo
sudo systemctl status gw2pvo
sudo journalctl -u gw2pvo -f

Docker

You can use the Dockerfile to run a Docker container as follows:

docker build --tag gw2pvo .

Add all settings to config file named gw2pvo.cfg like:

[Defaults]
gw_station_id = ...
gw_account = ...
gw_password = ...

pvo_api_key = ...
pvo_system_id = ...

city = Amsterdam
log = info
pvo_interval = 5
skip_offline = yes

Do set city to a valid value otherwise the container will use the UTC timezone. Then start the container like:

docker run --rm -v $(pwd)/gw2pvo.cfg:/gw2pvo.cfg gw2pvo

Recover missed data

You can copy a day of readings from GoodWe to PVOutput. Interval will be 10 minutes as this is what the API provides. Syntax:

gw2pvo --config gw2pvo.cfg --date YYYY-MM-DD

Beware that the date parameter must be not be older than 14 days from the current date. In donation mode, not more than 90 days.

Disclaimer and warrenty

Gw2pvo is not an official software from GoodWe/Sems and it is not endorsed or supported by this company. Gw2pvo has been written as a personal work. Feel free to improve or adapt it to your own needs.

GoodWe API access is based on the Chinese Sems Swagger documentation: global, Europe. It could be very well that at a certain point GoodWe decides to alter or disable the API.

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

gw2pvo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gw2pvo's Issues

"Basic SEMS portal login failed" DSM update?

Hi,

After using this script for several months successfully, since yesterday I get this login error. Only thing I can think of tha5 has changed is a DSM update on my Synology NAS.

In Debug mode I didn't find a clue:

ash-4.3# /bin/php goodwe2pvo.php

array(6) {

  ["hasError"]=>

  bool(false)

  ["code"]=>

  int(0)

  ["msg"]=>

  string(7) "Success"

  ["data"]=>

  array(6) {

    ["uid"]=>

    string(36) "ac826737-1ee6-45b5-b4d7-ef5e428700d2"

    ["timestamp"]=>

    float(1562924506410)

    ["token"]=>

    string(32) "84ac808a7306734bf6610854d25a9910"

    ["client"]=>

    string(3) "ios"

    ["version"]=>

    string(6) "v2.1.0"

    ["language"]=>

    string(2) "en"

  }

  ["components"]=>

  array(4) {

    ["para"]=>

    NULL

    ["langVer"]=>

    int(25)

    ["timeSpan"]=>

    int(0)

    ["api"]=>

    string(45) "http://eu.semsportal.com:82/api/Auth/GetToken"

  }

  ["api"]=>

  string(30) "https://eu.semsportal.com/api/"

}


Basic SEMS portal login failed. Enable debug mode > Any suggestions?

Python erro

The install script says it fail because python 3.3 is missing. I'v checked this (python3 --version) and python 3.4.2 is installed.
Why is it still failing at the install?
Can anyone explain?

Energy does not reset each day

Yes, I am running the Bugfix Release 1.2.2.

There appears to be some power being reported, which doesn't reset the energy to 0 and I start the next day with yesterday's result (6.50 kWh was the output of the previous day).
Maybe we can get a flag to hard reset to 0 at midnight?
Screenshot_20190628-180023

error after upgrading to 1.3.2.

Jun 29 09:32:36 raspberrypi systemd[1]: Started Read GoodWe inverter and upload data to PVOutput.org.
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: Traceback (most recent call last):
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: File "/usr/local/bin/gw2pvo", line 6, in
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: from gw2pvo.main import run
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: File "/usr/local/lib/python3.7/dist-packages/gw2pvo/main.py", line 9, in
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: from astral import LocationInfo
Jun 29 09:32:37 raspberrypi gw2pvo[25284]: ImportError: cannot import name 'LocationInfo' from 'astral' (/usr/local/lib/python3.7/dist-packages/astral.py)
Jun 29 09:32:37 raspberrypi systemd[1]: gw2pvo.service: Main process exited, code=exited, status=1/FAILURE
Jun 29 09:32:37 raspberrypi systemd[1]: gw2pvo.service: Failed with result 'exit-code'.

What is causing this error?

Date option throws an error

Hi Mark,

2 things;
Small typo in your README file. In the last example it says "data" rather than "date".

Secondly, when I run the command, with "2018-11-22" I get the following error;

Traceback (most recent call last):
  File "/usr/local/bin/gw2pvo", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.5/dist-packages/gw2pvo/__main__.py", line 116, in run
    copy(args)
  File "/usr/local/lib/python3.5/dist-packages/gw2pvo/__main__.py", line 78, in copy
    temperatures = ds.get_temperature_for_day(data['latitude'], data['longitude'], date)
  File "/usr/local/lib/python3.5/dist-packages/gw2pvo/ds_api.py", line 48, in get_temperature_for_day
    'date' : date.astimezone(datetime.now().tzinfo).isoformat()
ValueError: astimezone() cannot be applied to a naive datetime

Command I issued;

/usr/local/bin/gw2pvo --gw-station-id "<<XXX>>" --gw-account "<<XXX>>" --gw-password "<<XXX>>" --pvo-system-id "<<XXX>>" --pvo-api-key "<<XXX>>" --darksky-api-key "<<XXX>>" --date "2018-11-22"

When I leave out the darksky API, I get the following error;

Traceback (most recent call last):
  File "/usr/local/bin/gw2pvo", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.5/dist-packages/gw2pvo/__main__.py", line 116, in run
    copy(args)
  File "/usr/local/lib/python3.5/dist-packages/gw2pvo/__main__.py", line 82, in copy
    pvo.add_day(data['entries'], temperatures)
UnboundLocalError: local variable 'temperatures' referenced before assignment

Empty Data Recieved on Power and Income by Day API Call

A few days ago it seems that the GetPowerStationPowerAndIncomeByDay api call started returning an empty list in the data field. Anyone seen this? Has GoodWe made some changes?

DEBUG Starting new HTTP connection (1): au.semsportal.com

DEBUG http://au.semsportal.com:82 "POST /api/PowerStationMonitor/GetPowerStationPowerAndIncomeByDay HTTP/1.1" 200 260

DEBUG {'data': [], 'components': {'para': None, 'langVer': 63, 'api': 'http://au.semsportal.com:82/api/PowerStationMonitor/GetPowerStationPowerAndIncomeByDay', 'timeSpan': 0}, 'code': 0, 'hasError': False, 'msg': 'Success'}

WARNING 2020-03-05 - Received bad data []

change to API URL?

I have been getting this error since earlier today:

Jul 08 18:37:20 odroid gw2pvo[7181]: WARNING HTTPSConnectionPool(host='globalapi.sems.com.cn', port=443): Max retries exceeded with url: /api/v1/PowerStation/GetMonitorDetailByPowerstationId (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb5c95a10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) Jul 08 18:37:47 odroid gw2pvo[7181]: ERROR Failed to call GoodWe API Jul 08 18:37:47 odroid gw2pvo[7181]: ERROR 'inverter'

It looks like globalapi.sems.com.cn is not reachable anymore. Has goodwe maybe changed or removed that URL? I can see all my stats just fine on semsportal.

Script needs adjusting - Changes to GoodWe website

Hi Mark,

I've been using your scripts for uploading my GoodWe PV generation data to PVOutput for the last few months. It worked conveniently. I especially found your tool to upload historical data very helpful.

A few days ago, due to the new privay legislation, Goodwe added a European server to deal with european data. It also seems that the URL to fetch the data does no longer work and that you need to log in before you can retrieve the data.

I have been looking for an alteranive and found one at https://github.com/zonoskar/Goodwe2PVoutput, which seems to work with the new server, but it lacks the tools to upload historical data.

I f you have time, an update of gw2pvo would be greatly appriciated!

My best regards,

Koploper

[not an issue with gw2pvo] globalapi.sems.com.cn certificate expired on Jun 25

Thank you for writing this handy tool.

I am creating this issue so your users are aware that gw2pvo currently cannot function correctly due to a configuration error at SEMS' side. The certificate expired on June 25 and has not been replaced yet:

Certificate:                                                                    
    Data:                                                                       
        Version: 3 (0x2)                                                        
        Serial Number:                                                          
            03:38:c3:39:1f:00:e0:8f:9f:2b:ff:91:c0:bd:14:95                     
    Signature Algorithm: sha256WithRSAEncryption                                
        Issuer: C = US, O = DigiCert Inc, OU = www.digicert.com, CN = Encryptio$
 Everywhere DV TLS CA - G1                                       
        Validity                                                 
            Not Before: Jun 26 00:00:00 2019 GMT                                
            Not After : Jun 25 12:00:00 2020 GMT                               
        Subject: CN = globalapi.sems.com.cn           

Until SEMS fixes this on their end, users can work around it by adding verify=False to the two requests.post() lines in gw_api.py.

When using the option --date "on the current day", total production is incorrect

When using the --day flag to load the historical data for "today", the total production in kph is incorrect because it is actually the one returned for "yesterday" by the GoodWe API.

In such case, I would recommend instead to just sum up incrementally the production data (because the daily total is computed asynchronously in batch mode by GoodWe server), instead of trying to normalise it based on GoodWe calculations.

SEMS Portal

Hi, so today my Goodwe user stopped working. I guess to force us to the new SEMS Portal. I guess unless you're going to modify it to work with SEMS it's going to make this script obsolete.

docker compose

Thanks for gw2pvo. I just works!

I run pw2pvo in a docker container using docker compose. Personally I find this much easier to configure. (It's easy to make the container persistent, run upon system boot etc).

Shall I contribute my docker-compose.yaml as a PR?

in the meantime:

version: "3"
services:
   gw2pvo:
     build: .
     volumes:
       - ./gw2pvo.cfg:/gw2pvo.cfg
     restart: unless-stopped

time.tzset() not working on Synology python 3.7/3.8

Hi Mark, thanks for keeping this great package alive. It has been succesfully uploading our solar data now for almost two years. gw2pvo has been running on a Synology NAS without problems, but after a recent python update (3.8) I had to reinstall.
This gave me access to some of the recent updates of the script: so no more 'Success'/'success' stuff, and a config file: nice!

However, the City command now leads to errors on my installation, so I've had to remove it and then the script works smoothlessly again.

According to the output and some testing it is related to python's time module, which should support the tzset() function because synology runs a version of linux, but somehow it is not included:

gw2pvo --config gw2pvo.cfg --date 2020-11-22 --log debug
DEBUG    gw2pvo version 1.3.6
Traceback (most recent call last):
  File "/volume1/@appstore/python3/bin/gw2pvo", line 8, in <module>
    sys.exit(run())
  File "/var/packages/python3/target/lib/python3.7/site-packages/gw2pvo/__main__.py", line 196, in run
    time.tzset()
AttributeError: module 'time' has no attribute 'tzset'

I've verified this with both the 'synocommunity python' (3.7.7) and standard synology python package (3.8.2)... it's really strange because afaik tzset() should be part of any linux python installation...

cat /proc/version
Linux version 4.4.59+ (root@build3) (gcc version 4.9.3 20150311 (prerelease) (crosstool-NG 1.20.0) ) #25426 SMP PREEMPT Wed Jul 8 03:21:29 CST 2020

This might not be right place to dive into this issue, but maybe it will show if other people have the same problem, and the workaround for now to leave the city out, if your timezone is set correctly (haven't found out if it stops darksky from working).

gw2pvo.service error status=1/FAILURE

Hi,
I am fairly beginner level but tried to follow the instruction to run the code on an RP4.

When I run sudo journalctl -u gw2pvo -f, I get this error.
image

The config file information such as ID & Pass for SEMS portal is definitely correct.

When I run gw2pvo --config gw2pvo.cfg --log debug, it there is an error in the middle of the debug process,
image
image

However, in the end, the data is uploaded to PVoutput.

What would be issue here?
I'd love to upload the data to PVoutput automatically using this code..

Thank you!

Chris.

Add Temperature to the upload data

Hi, just got my new system installed and this is perfect to upload my Goodwe data to PVOutput. Thanks for doing this. It was so easy to install and great detailed instructions.
Just a comment/improvement. My inverter produces temperature data and I can't see anyway to upload it using gw2pvo. Is there a config I can change to do this ?

Calling with --date fails on upload to PVOutput

Log as follows:

DEBUG Starting new HTTPS connection (1): eu.semsportal.com:443 DEBUG https://eu.semsportal.com:443 "POST /api/v2/PowerStationMonitor/GetPowerStationPowerAndIncomeByDay HTTP/1.1" 200 445 DEBUG {'hasError': False, 'code': 0, 'msg': 'Success', 'data': [{'d': '06/10/2020', 'p': 3.8, 'i': 0.646}, {'d': '06/11/2020', 'p': 5.9, 'i': 1.003}], 'components': {'para': None, 'langVer': 73, 'timeSpan': 0, 'api': 'http://eu.semsportal.com:82/api/v2/PowerStationMonitor/GetPowerStationPowerAndIncomeByDay', 'msgSocketAdr': ''}} DEBUG {'data': '20200611,04:10,1,6.11;20200611,04:15,1,6.56;20200611,04:20,1,7.78;20200611,04:25,2,11.47;20200611,04:30,3,13.57;20200611,04:35,4,14.53;20200611,04:40,4,15.37;20200611,04:45,6,15.56;20200611,04:50,6,15.92;20200611,04:55,7,16.05;20200611,05:00,8,16.2;20200611,05:05,9,16.57;20200611,05:10,10,16.76;20200611,05:15,11,17.02;20200611,05:20,12,19.64;20200611,05:25,13,22.62;20200611,05:30,15,21.72;20200611,05:35,16,27.98;20200611,05:40,19,39.0;20200611,05:45,21,42.96;20200611,05:50,24,39.18;20200611,05:55,26,36.6;20200611,06:00,28,38.79;20200611,06:05,32,56.84;20200611,06:10,36,81.1;20200611,06:15,41,78.15;20200611,06:20,45,77.4;20200611,06:25,49,66.36;20200611,06:30,53,58.8;20200611,06:35,56,66.4'} DEBUG Starting new HTTPS connection (1): pvoutput.org:443 DEBUG https://pvoutput.org:443 "POST /service/r2/addbatchstatus.jsp HTTP/1.1" 400 None WARNING 400 Client Error: Bad Request for url: https://pvoutput.org/service/r2/addbatchstatus.jsp DEBUG Starting new HTTPS connection (1): pvoutput.org:443 DEBUG https://pvoutput.org:443 "POST /service/r2/addbatchstatus.jsp HTTP/1.1" 400 None WARNING 400 Client Error: Bad Request for url: https://pvoutput.org/service/r2/addbatchstatus.jsp DEBUG Starting new HTTPS connection (1): pvoutput.org:443

Is GoodWe API still working?

I was regularly getting timeouts or an indication that GetPowerStationPowerAndIncomeByDay() Received bad data
...but usually this was still working by repeatedly trying.

Today I cannot manage to get data at all. I am afraid the GoodWe API that my (tuned) version of gw2pvo is using has been deprecated by GoodWe, isn't it?

Max retires exceeded.

After installing gw2pvo I get the error:

HTTPSConnectionPool(host='globalapi.sems.com.cn', port=443): Max retries exceeded with url: /api/v1/PowerStation/GetMonitorDetailByPowerstationId (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f7a697ab978>: Failed to establish a new connection: [Errno -3] Try again',)

When I connect to globalapi.sems.com.cn I see the available API commands.
The command PowerStation/GetMonitorDetailByPowerstationId is not shown.

(I already changed the gw_api.py with data['msg'].lower() == 'success'.)

Is this a known issue?

Running average for smooth PVOutput graphs is broken

The running average for smooth PVOutput graphs is broken since the update from version 1.2.1 to 1.2.2. The resolution for produced energy is back to 0.1 kWh, so on a cloudy day it will report the same value multiple times and then increment with 0.1.

Before the update this worked correctly, but version 1.2.1 didn’t reset the produced energy back to 0 after midnight…

I am running gw2pvo version 1.2.2 on a RPi3. Both the script and PVOutput are set to a 5-minute interval.

Example:
https://www.pvoutput.org/intraday.jsp?id=77613&sid=68817

Retry on connection error to GW API

I regularly have gaps in my pvo graphs due to gw2pvo being unable to get the data for a specific iteration of run_once.

INFO     Normal, 381.0 W now, 13.1 kWh today, 110.7 kWh all time, 233.9 V grid, 333.1 V PV
INFO     Normal, 378.0 W now, 13.1 kWh today, 110.7 kWh all time, 233.1 V grid, 329.2 V PV
INFO     Normal, 360.0 W now, 13.2 kWh today, 110.8 kWh all time, 233.2 V grid, 329.3 V PV
WARNING  HTTPSConnectionPool(host='semsportal.com', port=443): Read timed out. (read timeout=10)
ERROR    Failed to call GoodWe API (code 100002)
INFO     Normal, 314.0 W now, 13.2 kWh today, 110.8 kWh all time, 232.7 V grid, 321.6 V PV
INFO     Normal, 294.0 W now, 13.2 kWh today, 110.8 kWh all time, 232.9 V grid, 326.0 V PV
INFO     Normal, 279.0 W now, 13.3 kWh today, 110.9 kWh all time, 233.3 V grid, 332.2 V PV

I suggest to implement some retries as on subsequent requests the portal works fine.

For example via: https://stackoverflow.com/questions/15431044/can-i-set-max-retries-for-requests-request or https://www.peterbe.com/plog/best-practice-with-retries-with-requests

Workaround:

  • Use --data xxxxx to reupload the data for every day or days with gaps

GW2PVO error - Certicate verify failed - Max retries exceeded

Hi, gw2pvo was working fine til yesterday when it stopped updating PVOutput with the error below:

WARNING HTTPSConnectionPool(host='globalapi.sems.com.cn', port=443): Max retries exceeded with url: /api/v1/PowerStation/GetMonitorDetailByPowerstationId (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

Were there any changes on SEMS that someone is aware of?

--config not working

I tried to create and use the config file but received the following error:

$ gw2pvo --config /etc/gw2pvo.cfg --log debug
usage: gw2pvo [-h] --gw-station-id ID --gw-account ACCOUNT --gw-password
PASSWORD [--pvo-system-id ID] [--pvo-api-key KEY]
[--pvo-interval {5,10,15}] [--darksky-api-key DARKSKY_API_KEY]
[--log {debug,info,warning,critical}] [--date YYYY-MM-DD]
[--pv-voltage] [--skip-offline] [--city CITY] [--csv CSV]
[--version]
gw2pvo: error: the following arguments are required: --gw-station-id, --gw-account, --gw-password

voltage and string power

can you add:

  • voltage of string 1
  • voltage of string 2
  • Generated power of string 1 (DC Voltage * DC Current * efficiency)
  • Generated power of string 1 (DC Voltage * DC Current * efficiency)

gw2pvo fails due to certificate expiration

The gw2pvo script currently fails due to a certificate expiration:

WARNING  HTTPSConnectionPool(host='globalapi.sems.com.cn', port=443): Max retries exceeded with url: /api/v1/PowerStation/GetMonitorDetailByPowerstationId (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)'),))

As a temporary workaround, you can disable verification:

in gw_api.py:

r = requests.post(self.base_url + url, verify=False, headers=headers, data=payload, timeout=10)

problem with config file

Hi,
I tried to use the config file as described, but when running the command I get following error:

odroid@odroid:~$ gw2pvo --config gw2pvo.cfg --date 2020-06-25
usage: gw2pvo [-h] --gw-station-id ID --gw-account ACCOUNT --gw-password
PASSWORD [--pvo-system-id ID] [--pvo-api-key KEY]
[--pvo-interval {5,10,15}] [--darksky-api-key DARKSKY_API_KEY]
[--log {debug,info,warning,critical}] [--date YYYY-MM-DD
--pv-voltage] [--skip-offline] [--city CITY] [--csv CSV]                                                                                                                                                                                    [--version]
gw2pvo: error: the following arguments are required: --gw-station-id, --gw-account, --gw-password

I am on version 1.3.3, installed via pip as described.

My config file looks like this, where 'xxx' stands for the respective values. I tried using quotes around them but that lead to the same result. Running gw2pvo with all the flags on the command line works.

[Defaults]
gw_station_id = xxx
gw_account = xxx
gw_password = xxx
pvo_api_key = xxx
pvo_system_id = xxx
darksky_api_key = xxx

Cheers

Custom script at intervals

Would it be possible to add an option to run a bash/python script when the gw2pvo service pushes data into the PVO ?

Idea is to use this script to upload Import data and sync it with gw output at the same time ?

Another way would be the option to add an import (v3/v4) option which we can set somehow ?

Inverter with dual string

Gents,

I have an inverter with a dual string vpv1 and vpv2 (voltage), is there a possibility to sum both strings?

gw2pvo.service: Failed with result 'exit-code'

Dear Mark,
I've tried to use your script but I receive an error and have no idea why, I hope you can help me. I have no coding/programming skills.
I'm using a Raspberry Pi 2+ with Raspbian Stretch installed.
Python version is 3.5.3 and PIP version is 9.0.1
I followed all your instructions but at the line 'sudo systemctl status gw2pvo' I receive an error, see the attachment below:
knipsel

Invalid syntax error

When I execute the example code gw2pvo --gw-station-id GWID --pvo-system-id PVOID --pvo-api-key KEY --log debug or anything for that matter, I get a Invalid syntax error.
It's probably something stupid on my side but I can't figure it out.

schermopname 3

I'm using python 3.6 on windows 10.
Thanks!

msg response field is inconsistent on API

if data['msg'] == 'success' and data['data'] is not None:

The API response on has different values on msg field sometimes have the success and other have Success so the lower and upper case cuases it to crash.

This is the solution I have on my local environment:

                msg = data['msg']

                if msg.lower() == 'success' and data['data'] is not None:
                    return data['data']

Add State Of Charge to get Battery Info

The GoodWe API returns a soc field which provides information on the battery State of Charge.

{
  "data": {
    "soc": {
      "power": 62,
      "status": 1
    }
  }
}

You can also get this data from the Inverter section

{
  "data": {
    "inverter": [
      {
        "sn": "xxxxxxxxxxx",
        "discharge_current_limit_bms": "100A",
        "charge_current_limit_bms": "100A",
        "soc": "62%"
      }
    ]
  }
}

It would be useful to have this data returned as well. The soc value is just a percentage.

Domoticz errors

Errors from domoticz log:

2020-12-25 13:00:27.659 Error: (GW) 'onMessage' failed 'TypeError':'string indices must be integers'.
2020-12-25 13:00:27.659 Error: (GW) ----> Line 307 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onMessage
2020-12-25 13:00:27.659 Error: (GW) ----> Line 217 in '/home/pi/domoticz/plugins/domoticz-GoodWeSEMS/plugin.py', function onMessage

Calling with --date fails with KeyError: 0

Calling gw2pvo with --date 2020-06-17 (for example) fails as follows:

ERROR Failed to call GoodWe API Traceback (most recent call last): File "/usr/local/bin/gw2pvo", line 10, in <module> sys.exit(run()) File "/usr/local/lib/python3.7/dist-packages/gw2pvo/__main__.py", line 116, in run copy(args) File "/usr/local/lib/python3.7/dist-packages/gw2pvo/__main__.py", line 74, in copy data = gw.getDayReadings(date) File "/usr/local/lib/python3.7/dist-packages/gw2pvo/gw_api.py", line 75, in getDayReadings eday_kwh = data[0]['p'] KeyError: 0

All imported logs with --date are 1 day ahead

When I import with this command: gw2pvo --gw-station-id --gw-account --gw-password --pvo-system-id --pvo-api-key --log debug --date 2018-12-13 --darksky-api-key

It will import the data of 2018-12-12 (at GoodWe) to 2018-12-13 (at Pvoutput).
How can I fix this?

not working?

I installed everything according to the main page but for me it doesn't seem to work. Am I doing something wrong, or did goodwe change the interface.

It seems the login is failing

I get the following debug output

INFO Starting new HTTPS connection (1): globalapi.sems.com.cn
DEBUG Setting read timeout to 10
DEBUG "POST /api/v1/PowerStation/GetMonitorDetailByPowerstationId HTTP/1.1" 200 281
DEBUG {'data': None, 'hasError': False, 'msg': 'No access, please login.', 'components': {'timeSpan': 0, 'langVer': 1, 'para': None, 'api': 'http://globalapi.sems.com.cn:82/api/v1/PowerStation/GetMonitorDetailByPowerstationId'}, 'code': 100001}
INFO Starting new HTTPS connection (1): globalapi.sems.com.cn
DEBUG Setting read timeout to 10
DEBUG "POST /api/v1/Common/CrossLogin HTTP/1.1" 200 362
INFO Starting new HTTPS connection (1): euapi.sems.com.cn
DEBUG Setting read timeout to 10
DEBUG "POST /api/v1/PowerStation/GetMonitorDetailByPowerstationId HTTP/1.1" 500 36
WARNING 500 Server Error: Internal Server Error
INFO Starting new HTTPS connection (1): euapi.sems.com.cn
DEBUG Setting read timeout to 10
DEBUG "POST /api/v1/PowerStation/GetMonitorDetailByPowerstationId HTTP/1.1" 500 36
WARNING 500 Server Error: Internal Server Error

Uploading history error

Hi Mark,

When i try to upload history data i get an error:
ERROR Failed to call GoodWe API
WARNING 2019-08-05 - Received bad data {}
Command i use is:
gw2pvo --gw-station-id ** --gw-account ** --gw-password ** --pvo-system-id ** --pvo-api-key ** --date 2019-08-05
This command did work for the last time on 2019-07-02

I also have a service running and this service is running without any problems. Same command but without -- date

OS: Lubuntu
Python 3.7.3

Thanks!

upload inverter temperature instead of local temperature

gw2pvo version 1.2.1 uses the darksky local temperature info to populate the temperature that is uploaded to pvoutput. That works fine, but I'd rather see the inverter temperature instead.

For the live status updates this can be retrieved from the GetMonitorDetailByPowerstationId query result: There is a field called 'tempperature' (Note the spelling mistake!)

Don't know how to obtain all temperatures for a particular day though. The sems web ui can export this data through a report.

only offline readings

Since oct 29th I get only offline readings. What can be wrong?
like this:
Nov 01 08:13:57 raspberrypi gw2pvo[372]: INFO Offline, 0.0 W now, 0.0 kWh today
Nov 01 08:18:56 raspberrypi gw2pvo[372]: INFO Offline, 0.0 W now, 0.0 kWh today

ImportError: cannot import name 'Astral' from 'astral'

Hi, just tried to get this program running and I get the following error. Note all sensitive info has been replaced. Any assistance would be appreciated. I have Astral installed (v2.1) Python version:

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32

Usage and error:

C:>gw2pvo --gw-station-id xxxxxxxxxxxxx --gw-account xxxxxxxxxx--gw-password xxxxxxxxxxx--pvo-system-id xxxxxx --pvo-api-key xxxxxxxxxxxxxx --log debug
Traceback (most recent call last):
File "C:\Users\yyyyyyyyyy\AppData\Local\Programs\Python\Python38-32\Scripts\gw2pvo-script.py", line 11, in
load_entry_point('gw2pvo==1.2.1', 'console_scripts', 'gw2pvo')()
File "c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources_init_.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources_init_.py", line 2852, in load_entry_point
return ep.load()
File "c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources_init_.py", line 2443, in load
return self.resolve()
File "c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources_init_.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\gw2pvo_main_.py", line 9, in
from astral import Astral
ImportError: cannot import name 'Astral' from 'astral' (c:\users\yyyyyyyyyy\appdata\local\programs\python\python38-32\lib\site-packages\astral_init_.py)

gw2pvo[850]: Bad config file, missing Defaults section

Hi

I'm pretty average at this but attempting to get working on a raspberry pi running raspbian

I have followed the directions in the readme and can get it to upload using the manual command

"gw2pvo --config gw2pvo.cfg --log debug"

It even works if I use the command located in the service file "gw2pvo --config /etc/gw2pvo.cfg --pvo-interval 5 --skip-offline"

But when I go to automate it in the next section I get the error:

-- Logs begin at Wed 2021-08-25 20:07:45 AEST. -- Aug 25 20:28:39 raspberrypihole gw2pvo[850]: Bad config file, missing Defaults section Aug 25 20:28:39 raspberrypihole systemd[1]: gw2pvo.service: Main process exited, code=exited, status=1/FAILURE Aug 25 20:28:39 raspberrypihole systemd[1]: gw2pvo.service: Failed with result 'exit-code'. Aug 25 20:33:40 raspberrypihole systemd[1]: gw2pvo.service: Service RestartSec=5min expired, scheduling restart. Aug 25 20:33:40 raspberrypihole systemd[1]: gw2pvo.service: Scheduled restart job, restart counter is at 5. Aug 25 20:33:40 raspberrypihole systemd[1]: Stopped Read GoodWe inverter and upload data to PVOutput.org. Aug 25 20:33:40 raspberrypihole systemd[1]: Started Read GoodWe inverter and upload data to PVOutput.org. Aug 25 20:33:42 raspberrypihole gw2pvo[915]: Bad config file, missing Defaults section Aug 25 20:33:43 raspberrypihole systemd[1]: gw2pvo.service: Main process exited, code=exited, status=1/FAILURE Aug 25 20:33:43 raspberrypihole systemd[1]: gw2pvo.service: Failed with result 'exit-code'. Aug 25 20:28:39 raspberrypihole gw2pvo[850]: Bad config file, missing Defaults section

Any ideas? I have the gw2pvo.cfg file with the correct data located in /etc/gw2pvo.cfg but it appears like it cannot find it..

Thanks!

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.