Python module to access PV systems in Sunny Portal.
The script sunnyportal2pvoutput can be used to send data to PVOutput. It uses a config file to store the credentials for Sunny Portal and the API Key and System Id for PVOutput.
PYTHONPATH=. ./bin/sunnyportal2pvoutput --dry-run sunnyportal.config
$ PYTHONPATH=. ./bin/sunnyportal2pvoutput sunnyportal.config --help
usage: sunnyportal2pvoutput [-h] [-s] [-o] [-c] [-p DAYS_PAST] [-q] [-n] config
Connect Sunny Portal to PVoutput.org
positional arguments:
config Configuration file to use
optional arguments:
-h, --help show this help message and exit
-s, --status Report status(es)
-o, --output Report output(s)
-c, --consumption Report consumption
-p DAYS_PAST, --days-past DAYS_PAST
number of DAYS in the past to go back -- default: 0 (today only)
-q, --quiet Silence output
-n, --dry-run Don't send any data
The script sunnyportal2file can be used to save data from Sunny Portal to file/database. It uses the same config file as in sunnyportal2pvoutput to store the credentials for Sunny Portal. It will extract the fields (min, mean and max production) which are available in unit watt as numpy.uint32 along with corresponding timestamps and aggregate them into a pandas DataFrame from which it will save to file with the format specified. One file will be created for each plant your Sunny Portal account has access to.
PYTHONPATH=. ./bin/sunnyportal2file sunnyportal.config --format csv
(change --format if you prefer a different format)$ PYTHONPATH=. ./bin/sunnyportal2file -h
usage: sunnyportal2file [-h] -f {json,csv,pickle,feather,parquet,excel,sqlite} [-s START_DATE] [-e END_DATE] [-i INCLUDE_FILTER] [-q] config
Save information from Sunny Portal to file
positional arguments:
config Configuration file to use
optional arguments:
-h, --help show this help message and exit
-f {json,csv,pickle,feather,parquet,excel,sqlite}, --format {json,csv,pickle,feather,parquet,excel,sqlite}
Format for which the data is to be saved
-s START_DATE, --start-date START_DATE
The start date of data to be saved in the format YYYY-MM-DD (default yesterday)
-e END_DATE, --end-date END_DATE
The end date of data to be saved in the format YYYY-MM-DD (default yesterday)
-i INCLUDE_FILTER, --include-filter INCLUDE_FILTER
A string used to filter which plants to include (default includes all plants)
-q, --quiet Silence output