Skip to main content

Python client for the Sol-Ark Cloud API

Project description

pysolark

pysolark is a Python client for the Sol-Ark Cloud API.

This library is intentionally validation-first and currently optimized for near-real-time visibility (for time-series systems like Prometheus). Sol-Ark publishes very little public API documentation, so the current framework focuses on endpoints confirmed by direct login tests against https://api.solarkcloud.com and by inspecting the mysolark.com frontend bundle.

Validated API areas in the current near-real-time-focused cut:

  • POST /oauth/token
  • GET /api/v1/user
  • GET /api/v1/plant/{id}
  • GET /api/v1/plant/{id}/realtime
  • GET /api/v1/plant/energy/{id}/flow
  • GET /api/v1/plant/energy/{id}/generation/use
  • POST /api/v1/plant/{id}/contacts
  • GET /api/v1/plants/map
  • GET /api/v1/version/latest
  • GET /api/v1/batteries/count
  • GET /api/v1/inverters/count

Additionally, the library exposes raw_get() so we can continue exploring undocumented endpoints safely while still surfacing Sol-Ark envelope errors as SolArkAPIError.

Install

pip install pysolark

Quick start

from pysolark import SolArkClient

client = SolArkClient(username="you@example.com", password="***")
client.login()

plant_id = 123456  # replace with your Sol-Ark plant ID
plant = client.get_plant(plant_id)
realtime = client.get_plant_realtime(plant_id)
flow = client.get_plant_energy_flow(plant_id)
usage = client.get_plant_generation_use(plant_id)
contacts = client.get_plant_contacts(plant_id)
plants_map = client.get_plants_map()
latest_version = client.get_latest_version()
battery_count = client.get_batteries_count()
inverter_count = client.get_inverters_count()

print(plant.name)
print(realtime.pac)
print(flow.soc)
print(usage.grid_sell)
print(contacts.updated_at)
print(plants_map[0].plant_id if plants_map else None)
print(latest_version.version)
print(battery_count.total, inverter_count.total)

Live smoke check

SOLARK_ENV_FILE=/path/to/solark-cloud.env ./examples/live_authenticated_smoke.sh

Expected output is JSON summarizing a real authenticated pass across the currently validated near-real-time endpoints.

Notes

Observed authentication behavior:

  • login succeeds with JSON body fields grant_type=password, username=<email>, and password=<password>
  • the API returns a JSON envelope with code, msg, data, and often success
  • nonzero code values should be treated as API-level failures even when the HTTP status is 200

Observed documentation gap:

  • some endpoints referenced by the frontend still returned 400, 404, or No Permissions during exploration
  • this repo should expand only as additional endpoints are actually validated against live responses

Development

uv venv .venv
. .venv/bin/activate
uv pip install -e '.[dev]'
python -m pytest -q

PyPI-ready validation

. .venv/bin/activate
python -m build
python -m twine check dist/*

Roadmap

  • Keep the client centered on near-real-time plant, flow, battery, and device-status visibility
  • Add convenience helpers for exporter-friendly near-real-time telemetry shaping
  • Revisit historical/day-month-year data pulls later, after the near-real-time surface is stable

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysolark-0.2.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysolark-0.2.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file pysolark-0.2.1.tar.gz.

File metadata

  • Download URL: pysolark-0.2.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pysolark-0.2.1.tar.gz
Algorithm Hash digest
SHA256 66447a144175a31aa93af20480fbf5624a978e806a3298c33c1c1b93dacc3fec
MD5 e9f93e273e41ffccd9d711948213dab9
BLAKE2b-256 9cfa4446b8bd631ec46fdde8bcc8f88f822cc5e3e34e9b5bbdbba11e3d27bd95

See more details on using hashes here.

File details

Details for the file pysolark-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pysolark-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pysolark-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34aa6fc2c47d46c7656f4e3be8bedc2e70385fe4ef335126296ac8ea31eab169
MD5 d7aa4038db753004d1987f6809225e42
BLAKE2b-256 cc6adaf89ce0dbe7e4c4498e00966626e37fb9ccc77ba4d38d38ac3155bafad2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page