Solarman has an API | Sofar Solar

I just found out that the Solarman has build an open API. But pvoutput does not integrate with this API yet. I was checking out if there are more users that want to log their output from solarman to here.

The platforms are:
SOLARMAN Smart:https://home.solarmanpv.com/login build for endusers
SOLARMAN Business:switch home with pro in the link above → build for professionals

I emailed with customerservice@solarmanpv.com for API acces to the old portal and they offered to migrate from the old portal to the ‘new’ solarman smart without dataloss. So that’s great.

edit
they made a thorough manual for the API too. I can share this, but not sure how.

2 Likes

Yes, please! I had my (second, on a different house) PV system installed in November last year with a Sofar Hybrid Inverter which uploads to the Solarman pages by default. Have been trying to get an upload script I found on GitLab to work for ages, but my python is not great and I can’t get past the errors. Got the API key and all from Solarman, but an automatic integration to PVOutput would be amazing!

1 Like

@beninho & @Aquaholic

Thanks for the API documentation @beninho.

Someone has put together a Python script for uploading Solarman data to PVO

In order to access the Solarman API you will need to contact them ( per the instructions ) in order to obtain your unique Solarman API Key.

Looking at the script you will also need to know the smpv_plant_id of your respective systems. I’d assume that this ID is visible within the web portal that they provide.

Hi @grannos,

Yes, they have send me an APP ID and an APP secret. I think this is the API.

@grannos

I’ve downloaded the script to my homeserver. But am unable to run/start it. I’ve edited the file SolarmanPV-to-PVoutput.py with APP ID and APP secret + API from PVoutput.

But I think I maby must be editing another file.

Hi @beninho

What version of Python are you using? ‘python -V’ should give you the answer.

What error message(s) are you getting?

It appears that the script has a dependency that you may need to install first.

I had to install ‘requests’ before I could run the script without error using Python version 3.

‘pip install requests’ OR ‘pip3 install requests’ depending on your Python version.

Grannos

2 Likes

Hi @grannos i totally missed your reply.

  • Python 3.8.5

I now installed requiests via → python3-pip

When i try to run the script i get the error blow. It seems trivial, i’ll look into it now.

-bash: ./SolarmanPV-to-PVoutput.py: /usr/bin/python: bad interpreter: No such file or directory

/solved this above issue with: sudo apt install python --this installed it again somehow. Bu okay.

New error:

File “./SolarmanPV-to-PVoutput.py”, line 41
smpv_client_secret = XXX
^
SyntaxError: invalid syntax

hmm @grannos

Now i’am not sure anymore.
Which one do i have to edit & run:

  • ./doit-example.sh
  • ./SolarmanPV-to-PVoutput.py

I filled all the data and still get and error on plant id.

./doit-example.sh: line 9: syntax error near unexpected token XXX' ./doit-example.sh: line 9: --smpv_plant_id ’

I’ve taking it from here: https://home.solarman.cn/main.html → that is the old page that is still up and running. I cannot find a plant ID on the new solarman smart UI.

Hi @beninho. Looking at the two scripts the easiest option is to edit ./doit-example.sh and populate it with the identifiers for YOUR system and YOUR account. Within SolarMax_PVoutLiveLog.py line #30 may need to be edited to set the correct IP address for your inverter[s].

I’m unable to access the solar man.cn link without an account.

-=-=-=

#!/bin/bash

Simple script to run the Python code with personal parameters

replace the IDs and keys with yours below

/home/chrismc/src/SOLAR-INVERTER-SOLARMAN/Solarman-PV-to-PVoutput-logger/SolarmanPV-to-PVoutput.py
–smpv_client_id
–smpv_client_secret
–smpv_plant_id
–pvo_key
–pvo_system_id

END OF FILE

Hi @grannos i’ve used all these personal parameters. But, it hangs on the plant id. I found it only in the previous enviroment, not in the ‘new’ smart one. But since they are both the same, it hought i could use it. Gues not, just emailed the solarman people the help my identify it.

and… when i leave it empty → it skips the error but gaves me the same on line 11 pvo_system_id → and i know for sure i’ve got the right parameters set here

I will lookinto the IP adres for my inverter:

Array of inverters in system. IP address and device number
factory default is likely 192.168.1.123:12345 1
inverters = {‘10.0.1.190’: [1, ]}

Device number refers to the amount of inversters/loggers in the system?

Hi @beninho,

Potentially you could have more than one inverter at a single place. From github there’s more information about the parameters required. The first two would identify YOU as a person whereas the the plant_id would identify a specific system. A single account holder could have lots of systems. You must be able to get the plant_id for your system from somewhere as it is the unique identifier for your system.

Good luck…

–smpv_client_id SMPV_CLIENT_ID
SolarmanPV API client ID
–smpv_client_secret SMPV_CLIENT_SECRET
SolarmanPV API client secret
–smpv_plant_id SMPV_PLANT_ID
ID of the plant (i.e. The solar PV site within
SolarmanPV)
–pvo_key PVO_KEY PVoutput API key
–pvo_system_id PVO_SYSTEM_ID
PVoutput system ID