Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Samil Power inverter tool

Project description

Samil Power inverter tool

Get model and status data from Samil Power inverters over the network.

Supported inverter series

  • SolarRiver TL
  • SolarRiver TL-D
  • SolarLake TL

If you have a SolarLake TL-PM series inverter, check out this fork! -> semonet/solar

If you just need PVOutput.org uploading, you can also try the old version.

Features

  • View inverter data
  • Upload to PVOutput.org
  • Publish to MQTT broker

Requirements

  • Python 3
  • Inverter needs to be in the same network

Installation

The package can be installed from PyPI:

$ pip install samil

On Ubuntu:

$ sudo apt install python3-pip
$ pip3 install --user samil

Usually samil can then be found at ~/.local/bin/samil. Often that directory is already in PATH, so you can call it using samil. You might need to relogin or add that directory to PATH.

Usage

$ samil --help
Usage: samil [OPTIONS] COMMAND [ARGS]...

  Samil Power inverter command-line tool.

Options:
  --debug    Enable debug output.
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  monitor  Print model and status info for an inverter.
  mqtt     Publish inverter data to an MQTT broker.
$ samil monitor --help
Usage: samil monitor [OPTIONS]

  Print model and status info for an inverter.

  When you have multiple inverters, run this command multiple times to
  connect to all inverters.

Options:
  --interval FLOAT RANGE  Status interval.  [default: 5.0]
  --interface TEXT        IP address of local network interface to bind to.
  --help                  Show this message and exit.
$ samil mqtt --help
Usage: samil mqtt [OPTIONS]

  Publish inverter data to an MQTT broker.

Options:
  -h, --host TEXT     MQTT broker hostname/IP address.  [default: localhost]
  -p, --port INTEGER  MQTT broker port.  [default: 1883]
  --client-id TEXT    Client ID used when connecting to the broker. If not
                      provided, one will be randomly generated.

  --tls               Enable SSL/TLS support.
  --username TEXT     MQTT username.
  --password TEXT     MQTT password.
  --interface TEXT    IP address of local network interface to bind to.
  --help              Show this message and exit.

Info

The protocol used by these inverters is described here.

The following units are used for the status values:

  • Voltage in volts
  • Current in amperes
  • Energy in kilowatt hours
  • Power in watts
  • Temperature in degrees Celcius
  • Operating time in hours

This project was originally a fork of zombiekipling/solriv but is now completely rewritten to implement new requirements.

As a library

You can use this project as a library. For documentation you will need to read through the source code.

Example to get started:

from samil import InverterListener

with InverterListener() as listener:
    # Search for an inverter
    inverter = listener.accept_inverter()

with inverter: 
    # Use with statement to automatically close the connection after use

    # Model info
    model = inverter.model()
    model["serial_number"]  # E.g. DW413B8080
    # ... (see source code)

    status = inverter.status()
    status["output_power"]  # E.g. 513 Watt
    # ... (see source code)

Development info

Development installation:

pip install -e .
pip install -r dev-requirements.txt

Lint code: flake8

Run testcases: python -m unittest

License

MIT

Project details


Download files

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

Files for samil, version 2.0.0.post2
Filename, size File type Python version Upload date Hashes
Filename, size samil-2.0.0.post2-py3-none-any.whl (11.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size samil-2.0.0.post2.tar.gz (11.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page