pysma
Library to interface an SMA Solar devices
What it is and what it does
pysma is a Python library that communicates with SMA solar inverters through their WebConnect HTTP interface. It abstracts the WebConnect protocol to let you query real-time power output, cumulative energy, and device status without writing raw HTTP requests. The library is async-first, using aiohttp for non-blocking network calls, and integrates directly with Home Assistant's SMA sensor component for home automation workflows.
The library reads inverter data over HTTP/HTTPS (with optional SSL verification control) and parses responses using jmespath. It's designed for monitoring setups where you have browser access to your SMA device's web interface and want programmatic access to the same data. Note that Modbus is not supported—only WebConnect.
Use it for:
- Monitor real-time solar power generation in Home Assistant dashboards.
- Log inverter output to a time-series database for long-term energy analysis.
- Trigger automations based on solar production thresholds.
- Read energy meter data from SMA devices for consumption tracking.
- Build custom monitoring scripts for solar systems.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Connects to SMA solar inverters via their WebConnect interface to read real-time and historical energy data for monitoring and integration with home automation systems.
Yes, if you own an SMA inverter with WebConnect access and need programmatic monitoring. The library is actively maintained, has no known vulnerabilities, low install friction, and integrates well with Home Assistant. Not suitable if your inverter uses Modbus or lacks WebConnect, or if you require Python versions below 3.12.
Install
pysma on PyPI
pip
pip install pysmauv
uv add pysmapoetry
poetry add pysmaInstalling pysma
Before you install
Low friction installation with only two lightweight runtime dependencies (aiohttp and jmespath). Actively maintained with recent commits; supports modern Python versions.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both personal and commercial projects.
Quickstart
pip install pysma
import asyncio
from pysma import SMAConnection
async def main():
async with SMAConnection(host='inverter.local') as conn:
data = await conn.get_values()
print(data)
asyncio.run(main())
Requires Python 3.12 or later; SMA inverter must be accessible via WebConnect on the local network.
Verify before relying
- Whether the library supports all SMA inverter models or only specific versions.
- Performance characteristics when polling multiple inverters or high-frequency data collection.
- Exact data fields and metrics available through the WebConnect interface.
- Whether daily usage metrics are directly available or require external workarounds.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — aiohttp, jmespath |
| Maintenance | actively maintained — 45 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 75,369/month — #14,722 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pysma-1.1.6-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
pysmappeeWrapper library for the Smappee energy…
permissive · top 15,000 on PyPI
goodweConnects to GoodWe solar inverters over local…
permissive · top 15,000 on PyPI
pysmlReads and parses Smart Message Language (SML)…
permissive · top 15,000 on PyPI
pyenphaseProvides a Python library to communicate with…
permissive · top 15,000 on PyPI
growattServerRetrieves photovoltaic system information from…
permissive · top 15,000 on PyPI
huawei-solarProvides a Python interface to read and write…
agpl · top 15,000 on PyPI
sense-energyProvides Python access to the Sense Energy…
permissive · top 15,000 on PyPI
dlms-cosemA Python library for implementing DLMS/COSEM…
permissive · top 15,000 on PyPI
systembridgeconnectorProvides a connector client for the System…
permissive · top 15,000 on PyPI
NREL-PySAMPySAM wraps NREL's System Advisor Model (SAM)…
permissive · top 15,000 on PyPI