Collect Inverter data from Solarman API

Hello, I sent API access request to Solarman a week ago but no response so far. How long did you wait?

Just to document it here as well:

I ran into following response when getting the bearer token:

{"code":"2101025","msg":"{\"error\":\"invalid_request\",\"error_description\":\"\",\"code\":\"AUTH_INVALID_USERNAME_OR_PASSWORD\",\"param\":null}","success":false,"requestId":"4b47a1cf11111111","access_token":null,"token_type":null,"refresh_token":null,"expires_in":null,"scope":null,"uid":null}%  

In my case the password at Solarman was too long and contained special characters. A 16 character ASCII password did the trick.

Hi,

I am trying your example, but i am not getting any value output.
have you seen this before?
for example checking the webdata_now with the curl command | less

Thanks, this was, what I was looking for as i also have them in my status.js file

Hey Dannyplace, Could you please share the modifications ?

Just to note that as of today the Solarman API address has changed to https://globalapi.solarmanpv.com. I’ve tested with new address and instructions on this thread are still good apart from the older API address.
@Skully maybe you can update the first post to reflect this?

Extract from email announcement below…

Now we are delighted to inform you that we have successfully upgrade data centers. If you are using the “International Data Center”, we kindly remind that you use the new OPENAPI domain https://globalapi.solarmanpv.com to access the platform, replacing the previous domain https://api.solarmanpv.com. Your APPID and APPSECRET will remain the same, but you will need to obtain a new token to access the platform.

If you require historical data during the upgrade, we recommend that you use the historical data interface (Interface 3.4 and Interface 4.3) to supplement it after the upgrade is completed.

2 Likes

Noted the email and that my stats had died… Updated and all working well for me.

Strange is that I’ve updated my token from globalapi.solarmanpv.com , to obtain values for HA , I’m still using api.solramanpv.com . I’ve tried with global and I got ERROR.

Urghhhhh yes mine worked for about 1.5hrs on globalapi, just heading to bed and saw your message… I had a look and its failed again. Using globalapi token but changed back to api.solramanpv.com same as you now works again. I’ll see what the morning brings :slight_smile: Seems they are still tinkering.

1 Like

Didn’t work for two days. The error I got was AUTH_USER_ALREADY_MIGRATED.
Then I found this thread and your posts. I changed https://api.solarmanpv.com to https://globalapi.solarmanpv.com and it’s working again like a charm.

Thanks!

1 Like

Is there anybody here who can share there code to acces the new Global-API of Solarman? I had it running flawlessly before the upgrade and just can’t get it to work anymore. I tried to locally access the inverter (Trannergy) but couldn’t get any information from it, neither with the HA integration. So I want to get the API way running again, but can’t get it done…:frowning:
Thnx in advace!!

It’s exactly the same instructions as in the thread here, just the API address is updated/changed.
Use https://globalapi.solarmanpv.com/ instead of https://api.solarmanpv.com/ in your commands and everything else is the same.

Rogier, if it has been working flawlessly, send a mail to the support desk asking to elevate your api authentication level for the user account you are using as the authentication fails. It most likely takes a week or so to get response, but it solves the issue (besides of course the move to the global api url)

I wish you were right… I used to use the code below to get data, where !secret solarman_api_url was https://api.solarmanpv.com/device/v1.0/currentData?appId=MyAppId&language=en&=
Changing it to globalapi.solarmanpv.com didn’t give any data…

- platform: rest
  resource: !secret solarman_api_url
  method: POST
  name: "DV1"
  scan_interval: 180
  headers:
   Authorization: !secret solarman_authorization
   Content-Type: application/json
  payload: '{  "deviceSn": "MyDeviceSerial"}'
  value_template: "{{ value_json.dataList[1].value }}"

OMG… I tried via regbin to acces the API and it worked out. I then figured out that there was a new bearer key on the new URL. Changed bearer and the info was back…

To help others with the same issue. Watch the words in capitals you need to replace with you own info

To get your bearer key:

Step 1 op https://reqbin.com/curl:

curl --request POST
–url ‘https://globalapi.solarmanpv.com/account/v1.0/token?appId=YOURAPPID&language=en&=
–header ‘Content-Type: application/json’
–data ‘{
“appSecret”: “YOURAPPSECRET”,
“email”: “YOUTEMAILADDRESS”,
“password”: “YOURSOLARMANPASSWORK”
}’

Step 2 on https://reqbin.com/curl:

curl --request POST
–url ‘https://globalapi.solarmanpv.com/device/v1.0/currentData?appId=YOURAPPID&language=en&=
–header ‘Authorization: bearer HERETHEBEARERFROMSTEP1’
–header ‘Content-Type: application/json’
–data ‘{
“deviceSn”: “YOURDEVICESN”
}’

You will now get info from your inverter

so your wish came true…I was right :sunglasses:

always better to focus on checking code, syntax, etc than jumping at people telling you the proven right way to do something…glad you got there in the end :+1:

So, I’ve spent too much time trying to get this to work. I’ve finally got the Bearer token, which is a huge long alpha-numeric string with dots and dashes etc. Do I use the entire thing?
When I get to step 2 above I receive this error - {
“code”: “2101006”,
“msg”: “invalid param”,
“success”: false,
“requestId”: “xxx”
}

I believe I’m using the correct code/syntax:
curl --request POST
–url ‘https://globalapi.solarmanpv.com/account/v1.0/token?appId=xxx&language=en
–header ‘Authorization: bearer xxx’
–header ‘Content-Type: application/json’
–data ‘{
“deviceSn”: “xxx”
}’

Assuming I’m able to get this sorted, how do I actually use the information? Do I create sensor in the config.yaml? I have managed to get some of the solar production values to work with the direct IP connection, but I really want to get some battery data if I can.

Hi, i get this error in curl commands

{
“code”: “2101025”,
“msg”: “{“error”:“invalid_request”,“error_description”:”",“code”:“AUTH_INVALID_USERNAME_OR_PASSWORD”,“param”:null}",
“success”: false,
“requestId”: “c93359b2c5dbdd9c”,
“access_token”: null,
“token_type”: null,
“refresh_token”: null,
“expires_in”: null,
“scope”: null,
“uid”: null
}

I used the email and password to access solarman.pv, where am I going wrong?

Hi Vince

Same here:

{
    "code": "2101025",
    "msg": "{\"error\":\"invalid_request\",\"error_description\":\"\",\"code\":\"AUTH_INVALID_USERNAME_OR_PASSWORD\",\"param\":null}",
    "success": false,
    "requestId": "7370cc33a1eba4c5",
    "access_token": null,
    "token_type": null,
    "refresh_token": null,
    "expires_in": null,
    "scope": null,
    "uid": null
}

Solarman have sent me an API ID that I’m using for the APP ID, is this correct?

I’ve tried a few SHA256 websites, changing my Solarman password and email address but can’t pull the access token.

curl --request POST \
  --url 'https://api.solarmanpv.com/account/v1.0/token?appId=20xxxxxxxxxxxxx&language=en&=' \
  --header 'Content-Type: application/json' \
  --data '{
	"appSecret": "8exxxxf9b6xxxxxxxxxxxxxxxxxxxx",
	"email": "[email protected]",
	"password": "b5xxxxbe78b0exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}'

Thanks