PV Data from Solarman WiFi logger - with API

So they sent me the AppId and AppSecret.

Still to apply it to Home-Assist, but managed to play with the API using terminal on my Macbook.

Basically, everything is Post requests, using Auth headers (Access Token).

But first, you need to obtain the access token… to get the access token you have to send a post request as follows,

curl --request POST \
  --url 'https://api.solarmanpv.com/account/v1.0/token?appId=<appId>&language=en&=' \
  --header 'Content-Type: application/json' \
  --data '{
	"appSecret": "<appSecret>",
	"email": "<email>",
	"password": "<passwordConvertedToSHA256>"
}'

If done correctly, you’ll receive a JSON string, containing an access and refresh token.

Something like this,

{
  "code": null,
  "msg": null,
  "success": true,
  "requestId": "<req_id>",
  "access_token": "<token>",
  "token_type": "bearer",
  "refresh_token": "<token>",
  "expires_in": "5183999",
  "scope": null,
  "uid": <uid>
}

Once you have that going, you can start requesting different data based on the documentation.

Example to get the real time data (well kinda real time, noticed about a 6 minute delay) , you can do that following.

curl --request POST \
  --url 'https://api.solarmanpv.com/device/v1.0/currentData?appId=<appId>&language=en&=' \
  --header 'Authorization: bearer <accessToken>' \
  --header 'Content-Type: application/json' \
  --data '{
	"deviceSn": "<deviceSerial>"
}'

In my case, I added my Inverter’s serial number. Something like 2004xxxxxx.

Returned data would be json and looks something like this,

{
  "code": null,
  "msg": null,
  "success": true,
  "requestId": "<reqID>",
  "deviceSn": "<serial>",
  "deviceId": <devid>,
  "deviceType": "INVERTER",
  "deviceState": 1,
  "dataList": [
..... A LOT OF DATA HERE.......
  ]
}

Let me know if you get stuck!

Cheers

Hello there.

Have you by any chance figure this out? I have a Deye Inverter with a Solarman Wifi Dongle but would really like to get it integrated with my HA.

I have managed to get an ID and API key from Solarman but i would really like to get realtime data from the inverter.

2 Likes

Anyone have a link to the documentation online to see what fields are avialable?
Thanks

Hi Matt, Can you send me that API document of SolarMan PV over my email address [email protected]? It would be very helpful to me.

Regards,

Hello Ronald
I want to do the same with my inverter to include in Home Assist.
You managed to get all done and reading the values from Solarman?
Tx Werner

I’ve done a quick write up as to how I was able to see my data in home assistant

Hi all

I came across www.solar-assistant.io they offer a Pi setup with cables that link to inverter and battery bank and give real time starts and is integrated with HA. I installed in yesterday on two my Sunsynk inverters running in parallel with pylontech battery bank and it seems to work fine. Will do the HA integration later this week but this seems to be a much better solution that the wifi loggers - my loggers would only update once every 15 mins. They will roll out online setting changes in September, for now it is limited to logging only

I ran into the same issue when all of a sudden my PV data was missing in Home Assistant. To fix this for my situation, I’ve made a python script (and docker image) to retrieve W and kWh metrics from SolarmanPV and send it to MQTT. You do need to request an API appid/secret, as mentioned earlier in this thread.

If you feel a bit adventurous you can get yourself a USB to RS485 adaptor and read directly from your Sunsynk / Deye / SolArk inverter, using this Home Assistant Add-On.

I forked your project which was a really good starting point for me. I added some more functions, like logger and inverter attributes (voltages, currents, etc…).

Nice! Creating a PR back would be appreciated!

Hello guys.
I send several email to Solarman asking about appID and secret Id. I dont know what I am doing wrong. Please can someone tell me the right email address and what I need write to get answer from Solarman people?

Hi,
It took a few days for them to reply. I also thought at first that there will be no answer, but then I got an email (after 4 business days) with all the necessary information. I think you have to be a little patient.

edit: Regarding your question: [email protected] is the correct address

hi. have u integrated into HA yet?

Managed to get it working, however my inverter does not show DC power per string. Is there any way to get two of these sensors/values multiplied?

e.g. something like solarmanpv_inverter_dc_power_pv1 = solarmanpv_inverter_dc_voltage_pv1 * solarmanpv_inverter_dc_current_pv1

For some reason I can’t get it working

This is used to get the sensor value into HA

template:

  • sensor:
    • name: solarmanpv_inverter_dc_voltage_pv1
      unit_of_measurement: ‘V’
      state: “{{ state_attr(‘sensor.solarmanpv_inverter’, ‘DC_Voltage_PV1’) }}”
      state_class: measurement
  • sensor:
    • name: solarmanpv_inverter_dc_current_pv1
      unit_of_measurement: ‘A’
      state: “{{ state_attr(‘sensor.solarmanpv_inverter’, ‘DC_Current_PV1’) }}”
      state_class: measurement

Check out this awesome custom component, it retrieve data locally 30 second with ton of useful sensor data

Hello everyone, I’m trying to obtain my token from solarman, but I am getting the following:
{
“code”: “2101018”,
“msg”: “auth appId not found”,
“success”: false,
“requestId”: “e24a8a34f10be85a”
}
I am sure I put the correct data in the input, does anyone have any idea what could be wrong? Thanks.

I have exact same response for curl run

I got it working now, I was not replacing AppID in URL, replacing it with my appID worked fine

1 Like

Finally got it working too, I believe I was making the same mistake, thanks for pointing it out Shriganesh!