skillfed

pysma

Library to interface an SMA Solar devices

pysma v1.1.6 75.4K downloads/30d#14,722 on PyPI65
Permissive license MIT Active released

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 pysma

uv

uv add pysma

poetry

poetry add pysma

Installing 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

Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

SMA inverter monitoringsolar energy data APISMA WebConnect librarysolar inverter telemetryhome automation solar integration
solar-energyhome-automationasync-io

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

pysmappee

Wrapper library for the Smappee energy…

permissive · top 15,000 on PyPI

goodwe

Connects to GoodWe solar inverters over local…

permissive · top 15,000 on PyPI

pysml

Reads and parses Smart Message Language (SML)…

permissive · top 15,000 on PyPI

pyenphase

Provides a Python library to communicate with…

permissive · top 15,000 on PyPI

growattServer

Retrieves photovoltaic system information from…

permissive · top 15,000 on PyPI

huawei-solar

Provides a Python interface to read and write…

agpl · top 15,000 on PyPI

sense-energy

Provides Python access to the Sense Energy…

permissive · top 15,000 on PyPI

dlms-cosem

A Python library for implementing DLMS/COSEM…

permissive · top 15,000 on PyPI

systembridgeconnector

Provides a connector client for the System…

permissive · top 15,000 on PyPI

NREL-PySAM

PySAM wraps NREL's System Advisor Model (SAM)…

permissive · top 15,000 on PyPI