Skip to main content

Python: Asynchronous client for SolarEdge over Modbus

GitHub Release Python Versions Project Stage Project Maintenance License

Build Status Code Coverage OpenSSF Scorecard Open in Dev Containers

Sponsor Frenck via GitHub Sponsors

Support Frenck on Patreon

Asynchronous Python client for SolarEdge inverters over Modbus.

About

This package reads and controls SolarEdge inverters, meters and batteries over Modbus, using the SunSpec register model. It is built for use inside Home Assistant, following the shared-connection approach described in the Modernizing Modbus developer blog.

It is built on top of modbus-connection, a backend-neutral async Modbus toolkit. The library does not own the connection: the consumer opens a ModbusConnection and hands over a ModbusUnit. A site with several inverters creates one SolarEdge per unit, all sharing a single connection.

Because the caller owns the connection, the transport is up to you. Modbus TCP over Ethernet or WiFi is the common path, but the library works just as well over RS485/RTU or an RTU-to-TCP gateway (such as an Elfin-EW11). Anything that hands it a ModbusUnit will do; the register map does not care how the bytes arrive.

Supported out of the box:

  • Inverter: power, energy, per-phase voltage/current, frequency, DC, temperatures, status, grid on/off, vendor status
  • Per-string DC (multiple-MPPT / SunSpec 160): current, voltage, power, energy, temperature per module
  • Up to three meters: power, per-phase measurements, imported/exported energy, apparent (VAh) and reactive (varh) energy
  • Batteries: state of energy/health, power, temperatures, status
  • Control blocks: storage control, export/site limit + external production, dynamic power control, advanced/reactive power control
  • EV charger detection (identity only; SolarEdge exposes no charger telemetry over Modbus)

Enabling Modbus TCP on your inverter

Modbus TCP is off by default. Enable it once on the inverter, then point this library at the inverter's IP address on port 1502.

Inverters with a display (older LCD models):

  1. Long-press OK (the rightmost button) to enter the menu.
  2. Enter the password by pressing Up, Down, OK, Up, Down, OK, Up, Down (12312312).
  3. Go to Communication, select LAN, and enable Modbus TCP.

Inverters set up with SetApp (no display): open the SetApp interface (join the inverter's WiFi access point and browse to http://172.16.0.1, or use the SetApp mobile app), then under Site Communication enable Modbus (TCP).

SolarEdge may drop WiFi-based Modbus in future firmware, so a wired Ethernet connection is the more reliable choice. Instructions adapted from the community home-assistant-solaredge-modbus project.

Installation

pip install solaredged

To install with the optional CLI, which drives the tmodbus backend:

pip install "solaredged[cli,tmodbus]"

As a library, solaredged talks to a ModbusUnit; pick a backend with the matching extra, solaredged[pymodbus] or solaredged[tmodbus], or let your application supply one.

Usage

The consumer owns the connection and hands the library a unit. The example below uses the tmodbus backend, so install it with pip install "solaredged[tmodbus]" first:

import asyncio

from modbus_connection.tmodbus import connect_tcp

from solaredged import SolarEdge


async def main() -> None:
    connection = await connect_tcp("solaredge.local", port=1502)
    try:
        unit = connection.for_unit(1)
        solaredge = await SolarEdge.async_probe(unit)  # detects the layout
        report = await solaredge.async_update()  # one read per sub-system

        print(solaredge.inverter.ac_power, "W")
        print(solaredge.inverter.status)
        for battery in solaredge.batteries:
            print(battery.state_of_energy, "%")
    finally:
        await connection.close()


asyncio.run(main())

async_probe validates the SunSpec header and detects which meters, batteries and control blocks are present, plus whether the firmware serves the grid status extension (not all firmware does). async_update refreshes each sub-system on its own, so a block the device refuses fails only that sub-system: the returned report names what refreshed and carries the error for what did not, while the rest keep their values. Check report.complete when you need to know the poll was whole. A poll where nothing refreshed at all raises instead, the same as a dropped link. The control blocks change only when something writes them, so async_update_readings and async_update_settings refresh the two apart for a caller that wants them on different intervals. Values decode to None when the device reports a point as not implemented, including a lifetime energy of 0 (SunSpec's "not accumulated", transiently reported by some firmware around sleep/wake). on_grid is None on firmware without the extension, and a battery state of energy or health outside 0-100 (reported by initializing batteries) decodes to None as well.

See the examples directory for more.

CLI

The optional CLI reads your inverter straight from the terminal. --host, --port and --unit can also be set via the SOLAREDGED_HOST, SOLAREDGED_PORT and SOLAREDGED_UNIT environment variables.

# Launch the live TUI dashboard
solaredged --host solaredge.local

# Show a one-shot reading
solaredged info --host solaredge.local

# Machine-readable output
solaredged info --host solaredge.local --json

# Dump the raw register map (handy for debugging and fixtures)
solaredged dump --host solaredge.local

Control commands write to the inverter, so only use them on hardware you own. Each one asks for confirmation before writing; pass --yes (or -y) to skip the prompt in scripts.

# Limit active power output to a percentage of nominal
solaredged power-limit 80 --host solaredge.local

# Set the battery storage control mode
solaredged storage-mode MAXIMIZE_SELF_CONSUMPTION --host solaredge.local

# Set the power factor (cos phi) setpoint
solaredged cos-phi 0.95 --host solaredge.local

# Battery: reserve, charge policy, and remote charge/discharge
solaredged backup-reserve 20 --host solaredge.local
solaredged charge-policy ALWAYS --host solaredge.local
solaredged remote-charge 3000 --timeout 1800 --host solaredge.local
solaredged remote-discharge 4000 --host solaredge.local

# Skip the confirmation prompt (for scripting)
solaredged power-limit 80 --host solaredge.local --yes

More controls (export mode/limit, external production, advanced/reactive power control, commit/restore) are available through the library API on the storage_control, export_control, power_control and advanced_power_control components.

Changelog & releases

This repository keeps a change log using GitHub's releases functionality. Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH.

Contributing

Contributions are welcome. See CONTRIBUTING.md for how to get started and what the review expects.

Setting up development environment

The easiest way to start, is by opening a CodeSpace here on GitHub, or by using the Dev Container feature of Visual Studio Code.

Open in Dev Containers

This Python project is fully managed using the Poetry dependency manager, and relies on NodeJS for some of the checks during development.

You need at least:

  • Python 3.12+
  • Poetry
  • NodeJS 24+ (including NPM)

To install all packages, including all development requirements:

npm install
poetry install

As this repository uses the prek framework, all changes are linted and tested with each commit. You can run all checks and tests manually, using the following command:

poetry run prek run --all-files

To run just the Python tests:

poetry run pytest

Authors & contributors

The original setup of this repository is by Franck Nijhof.

For a full list of all authors and contributors, check the contributor's page.

Disclaimer

This project is an independent, community-driven effort. It is not affiliated with, endorsed by, or supported by SolarEdge Technologies. All product names, trademarks, and registered trademarks are property of their respective owners.

The register map is based on SolarEdge's publicly documented SunSpec implementation and the excellent solaredge-modbus-multi community integration. This work is done for interoperability purposes.

Use this software at your own risk. The authors are not responsible for any damage to your equipment, property, or person resulting from the use of this library. Writing control registers changes how your inverter and battery behave; only do so on hardware you own and understand.

License

MIT License

Copyright (c) 2026 Franck Nijhof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for solaredged 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solaredged 0.2.2
File Size Uploaded
solaredged-0.2.2.tar.gz 41.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solaredged 0.2.2
File Interpreter ABI Platform
solaredged-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 82.7 kB

Release files / solaredged-0.2.2.tar.gz

Download URL solaredged-0.2.2.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5ac2eb40c8b2564902a28d64b1a36870a3adec3e565a8a768f8a9e98a1255c2f
BLAKE2b-256 checksum
How to use checksums
68217cce4000bc37f8cac751df83d00e7c5ac5f64c42d1d8009828981350669b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / solaredged-0.2.2-py3-none-any.whl

Download URL solaredged-0.2.2-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
733aa9d4465117315ede91dd4f7ea3fd32525fd773dd6738bbbd78cd5cde19bb
BLAKE2b-256 checksum
How to use checksums
3919b283e81d2020b33becefbc694f34be4cb8726edea1ad3df02a198d5e71da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page