PV Data from Solarman WiFi logger - with API

Good evening all,

I’ve got a PV system on the roof with a Sofar inverter equipped with a Solarman Wifi Logger that outputs data to the cloud every few minutes. I’ve now been granted API access by the developers of the WiFi logger, but have no real clue how to ‘use’ the data. I have an ‘AppID’ and a ‘AppSecret’ code ready to use. But unsure how to continue.

Is it probable that I’ll need some extra hardware? All I’d really like to see is ‘current solar gain’ in watts on my HA dashboard. There’s a large PDF with plenty of instructions on what data can be called for, and how to set different variables. But I just need the ‘leg up’ on the first step in HA…

Any ideas? I’ve seen a few projects on GitHub but they seem to be pushing data to another external website and then calling that data back again - seems a bit long winded!

Thanks in advance!
Matt

2 Likes

Hi Matt!

Random question, how did you get the AppID and App Secret?

Hi Ronald, had to email the Solarman guys. I’ve got their email address somewhere. In the meantime come check out the Facebook group for all things Solar/Data/Raspberry/API/Local gathering. :slight_smile: https://www.facebook.com/groups/2477195449252168/?ref=share

1 Like

Great, thank you very much Matt.
Got their email address on the App and sent them a message. Hopefully they’ll get back to me.

Will keep you updated!

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

1 Like

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.

1 Like

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