Hello all, I hope you find this useful, this should work for any Inverter/Logger that reports to Solarman Smart website. I am not very comfortable with REST, API etc so I am sure that some of it could be done better but hopefully this will help someone.
1 -
Email [email protected] and ask for API access. You will receive documentation and an ID and Key.
2 -
Go to Run Curl Commands Online
Paste the below into the left window, make sure you amend the relevant sections.
appSecret is your key.
You can hash your password by visiting SHA256 Online. Iâve had issues with other websites but this one works consistently for me
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>"
}'
3 -
You will see this in the box on the right
Grab your access_token for the next step
4 -
Check to make sure you can see data from your inverter. Paste this into the box on the left, replacing values as appropriate.
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>"
}'
You should get the following result (truncated for here)
5 -
Copy everything and paste it into https://jsonpathfinder.com/
6 -
Create a rest sensor in configuration.yaml. I have split my config up so your configuration.yaml file may look slightly different to mine. Make sure you replace the relevant sections with your details
### Solarman API ###
- platform: rest
resource: https://api.solarmanpv.com/device/v1.0/currentData?appId=<APPID>&language=en&=
method: POST
name: "Cumulative Production kWh"
scan_interval: 3600
headers:
Authorization: bearer <AUTH>
Content-Type: application/json
payload: '{ "deviceSn": "<SN>"}'
value_template: "{{ value_json.dataList[16].value }}"
To get the correct sensor reading, use the JSON Path Finder website to get the appropriate value_json. In my example Iâm looking at Cumulative Production (Active)
7 -
Save your file, check the config and restart. You should then see your sensor in Home Assistant
TODO - Try to understand the difference between auth and refresh token and when to use each one
I will try and answer any questions you have but as I said, I am not very knowledgable.