judasgutenberg / SolArkMonitor

For people who need an API to access their SolArk or SunSynk inverter for better device energy allocation.
0 stars 0 forks source link

Sol-ark API Documentation #1

Closed JL00001 closed 2 weeks ago

JL00001 commented 3 months ago

Is there an api guide for the Sol-ark access? I am looking to pull some data from Sol-ark's website and have been trying to access it in the way you described in your php code, but keep getting HTTP Error 405 Not Allowed.

judasgutenberg commented 3 months ago

I just retried this code and it worked fine -- you might need to install cURL on your system. I don't know if it always installs by default.

if it works, you will get an output similar to :

"{"code":0,"msg":"Success","data":{"custCode":29,"meterCode":0,"pvPower":2892,"battPower":2324,"gridOrMeterPower":0,"loadOrEpsPower":392,"genPower":0,"minPower":0,"soc":100.0,"pvTo":true,"toLoad":true,"toGrid":false,"toBat":true,"batTo":false,"gridTo":false,"genTo":false,"minTo":false,"existsGen":false,"existsMin":false,"genOn":false,"microOn":false,"existsMeter":false,"bmsCommFaultFlag":false,"pv":null,"existThinkPower":false},"success":true}" array(25) { ["custCode"]=> int(29) ["meterCode"]=> int(0) ["pvPower"]=> int(2892) ["battPower"]=> int(2324) ["gridOrMeterPower"]=> int(0) ["loadOrEpsPower"]=> int(392) ["genPower"]=> int(0) ["minPower"]=> int(0) ["soc"]=> float(100) ["pvTo"]=> bool(true) ["toLoad"]=> bool(true) ["toGrid"]=> bool(false) ["toBat"]=> bool(true) ["batTo"]=> bool(false) ["gridTo"]=> bool(false) ["genTo"]=> bool(false) ["minTo"]=> bool(false) ["existsGen"]=> bool(false) ["existsMin"]=> bool(false) ["genOn"]=> bool(false) ["microOn"]=> bool(false) ["existsMeter"]=> bool(false) ["bmsCommFaultFlag"]=> bool(false) ["pv"]=> NULL ["existThinkPower"]=> bool(false) }

judasgutenberg commented 3 months ago

if you want to directly intercept data from the WiFi dongle, check out this repo I just updated:

https://github.com/judasgutenberg/SolArk_Live_Data

JL00001 commented 2 weeks ago

Ok, I have and some time to come back to this. Using the developer tools in chrome and logging in to the Sol-Ark plant page. I can see some of the api calls the webpage does.

https://www.solarkcloud.com/api/v1/plant/energy//generation/use https://www.solarkcloud.com/api/v1/plant//realtime https://www.solarkcloud.com/api/v1/plant/energy//day?lan=en&date=2024-09-12&id= https://www.solarkcloud.com/api/v1/plant/energy//flow

flow, what you used in your PHP script, seems to have how the power is flowing in the system. realtime, seems to have how the real time amount, as well as the running totals day, seems to have the raw data for the day in the url. use, seems to have weights for how the sol-ark decides things? Speculation on this part.

JL00001 commented 2 weeks ago

https://www.solarkcloud.com/api/v1/plant/energy//total?lan=en&date=2024&id=

Has totals for plant