I have been trying to get the python script to work myself for sometime. Whilst my credentials to the plant seem to be ok, and connect I don’t get any power data back and in the end have a timedate format error.
I had to set the timezone in the script and made other changes, to no avail.
However, even if I can get this script to work I am not convinced the data would upload to pvoutput because it is such a mess when it comes from the inverter and would fail the pvoutput validation each day.
When I download the inverter data manually via the web site I need to do a lot of manipulation in excel to be able to load the csv values (remove duplicate rows, extract the columns I want to upload)
Issues I found with the inverter data are
- the timestamp is arbitrary and does not follow the 5, 10, 15, 20 , 25 min… interval
- lots of duplicated rows for the same timestamp, but to varying degrees each day. These often result in the max row value being exceeded for upload.
- data from the previous day transferred to the night time records of the next day with the full generation value from the preceding day. Luckily the load validation to Pvoutput now ignores these.
- lots of rounding down errors in the Energy generation column so it does not increment correctly and fails PVoutput validation.
etc…
For info my debug output looks like this:
Connection successful
2021-07-16T11:34:58.118000: getPower()
2021-07-16T11:34:58.134000: today == 2021-07-16
2021-07-16T11:34:58.140000: Getting plant power (for a day)
response == <Response [200]>
response.url == https://openapi.solarmanpv.com/v1/plant/power?date=2021-07-16&plant_id=dummy&timezone_id=Europe%2FDublin
response.encoding == utf-8
response.text == {“data”:{“powers”:[{“time”:“2021-07-16T00:00:00Z”,“power”:0},{“time”:“2021-07-16T00:02:47Z”,“power”:0},{“time”:“2021-07-16T00:05:00Z”,“power”:0},{“time”:“2021-07-16T00:07:47Z”,“power”:0},{“time”:“2021-07-16T00:10:00Z”,“power”:0},{“time”:“2021-07-16T00:12:47Z”,“power”:0},{“time”:“2021-07-16T00:15:00Z”,“power”:0}
[cut]
Then the errors:
Traceback (most recent call last):
File “C:\Solarman\SolarmanPV-to-PVoutput_v2.py”, line 117, in
power_details = smpv.getPower(datetime.date.today().strftime("%Y-%m-%d"), True)
File “C:\Solarman\SolarmanPVAPI\solarmanpv_api.py”, line 245, in getPower
power_data.sort(key=self.__extractTimePowerData, reverse=True)
File “C:\Solarman\SolarmanPVAPI\solarmanpv_api.py”, line 181, in __extractTimePowerData
unix_ts = datetime.datetime.strptime(json[‘time’], “%Y-%m-%dT%H:%M:%SZ”).strftime("%s")
ValueError: Invalid format string.
I just load the csv’s manually ever so often now.