Skip to main content

Get information from Deye Microinverter

Project description

inverter

tests codecov inverter-connect @ PyPi Python Versions License GPL-3.0-or-later

Get information from Deye Microinverter

The whole thing is just a learning exercise for now. We will see.

quickstart

overview

  • clone the sources
  • Bootstrap and create default user settings by just call ./cli.py edit-settings
  • Change the settings for your needs
  • ...use the commands... ;)

Currently just clone the project and just start the cli (that will create a virtualenv and installs every dependencies)

Note: Please enable https://www.piwheels.org/ if you are on a Raspberry Pi !

e.g.:

~$ git clone https://github.com/jedie/inverter-connect.git
~$ cd inverter-connect
~/inverter-connect$ ./cli.py --help

The output of ./cli.py --help looks like:

Usage: ./cli.py [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help      Show this message and exit.                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ debug-settings           Display (anonymized) MQTT server username and password                  │
│ edit-settings            Edit the settings file. On first call: Create the default one.          │
│ print-at-commands        Print one or more AT command values from Inverter.                      │
│ print-values             Print all known register values from Inverter, e.g.:                    │
│ publish-loop             Publish current data via MQTT for Home Assistant (endless loop)         │
│ read-register            Read register(s) from the inverter                                      │
│ set-time                 Set current date time in the inverter device.                           │
│ test-mqtt-connection     Test connection to MQTT Server                                          │
│ version                  Print version and exit                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

most important commands

publish-loop

Help from ./cli.py print-values --help Looks like:

Usage: ./cli.py publish-loop [OPTIONS]

 Publish current data via MQTT for Home Assistant (endless loop)
 The "Daily Production" count will be cleared in the night, by set the current date time via
 AT-command.

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --ip             TEXT                     IP address of your inverter [required]              │
│ *  --port           INTEGER                  Port of inverter services [default: 48899]          │
│                                              [required]                                          │
│ *  --inverter       TEXT                     Prefix of yaml config files in                      │
│                                              inverter/definitions/                               │
│                                              [default: deye_2mppt]                               │
│                                              [required]                                          │
│    --verbosity  -v  INTEGER RANGE [0<=x<=3]  Verbosity level; Accepts integer value e.g.:        │
│                                              "--verbose 2" or can be count e.g.: "-vv"           │
│                                              [default: 1; 0<=x<=3]                               │
│    --help                                    Show this message and exit.                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

print-values

Help from ./cli.py print-values --help Looks like:

Usage: ./cli.py print-values [OPTIONS]

 Print all known register values from Inverter, e.g.:
 .../inverter-connect$ ./cli.py print-values 192.168.123.456

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --ip             TEXT                     IP address of your inverter [required]              │
│ *  --port           INTEGER                  Port of inverter services [default: 48899]          │
│                                              [required]                                          │
│ *  --inverter       TEXT                     Prefix of yaml config files in                      │
│                                              inverter/definitions/                               │
│                                              [default: deye_2mppt]                               │
│                                              [required]                                          │
│    --verbosity  -v  INTEGER RANGE [0<=x<=3]  Verbosity level; Accepts integer value e.g.:        │
│                                              "--verbose 2" or can be count e.g.: "-vv"           │
│                                              [default: 1; 0<=x<=3]                               │
│    --help                                    Show this message and exit.                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Example output of print-values call:

print-values


print-at-commands

Help from ./cli.py print-at-commands --help Looks like:

Usage: ./cli.py print-at-commands [OPTIONS] [COMMANDS]...

 Print one or more AT command values from Inverter.
 Use all known AT commands, if no one is given, e.g.:
 .../inverter-connect$ ./cli.py print-at-commands 192.168.123.456
 Or specify one or more AT-commands, e.g.:
 .../inverter-connect$ ./cli.py print-at-commands 192.168.123.456 WEBVER .../inverter-connect$
 ./cli.py print-at-commands 192.168.123.456 WEBVER WEBU
 e.g.: Set NTP server, enable NTP and check the values:
 .../inverter-connect$ ./cli.py print-at-commands 192.168.123.456 NTPSER=192.168.1.1 NTPEN=on
 NTPSER NTPEN
 wait a while and request the current date time:
 .../inverter-connect$ ./cli.py print-at-commands 192.168.123.456 NTPTM
 (Note: The prefix "AT+" will be added to every command)

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --ip             TEXT                     IP address of your inverter [required]              │
│ *  --port           INTEGER                  Port of inverter services [default: 48899]          │
│                                              [required]                                          │
│    --verbosity  -v  INTEGER RANGE [0<=x<=3]  Verbosity level; Accepts integer value e.g.:        │
│                                              "--verbose 2" or can be count e.g.: "-vv"           │
│                                              [default: 1; 0<=x<=3]                               │
│    --help                                    Show this message and exit.                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Example output of print-at-commands call:

print-at-commands


read-register

Help from ./cli.py read-register --help Looks like:

Usage: ./cli.py read-register [OPTIONS] REGISTER LENGTH

 Read register(s) from the inverter
 e.g.: read 3 registers starting from 0x16:
 .../inverter-connect$ ./cli.py read-register 0x16 3
 e.g.: read the first 32 registers:
 .../inverter-connect$ ./cli.py read-register 0 32
 The start address can be pass as decimal number or as hex string, e.g.: 0x123

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --ip             TEXT                     IP address of your inverter [required]              │
│ *  --port           INTEGER                  Port of inverter services [default: 48899]          │
│                                              [required]                                          │
│    --verbosity  -v  INTEGER RANGE [0<=x<=3]  Verbosity level; Accepts integer value e.g.:        │
│                                              "--verbose 2" or can be count e.g.: "-vv"           │
│                                              [default: 1; 0<=x<=3]                               │
│    --help                                    Show this message and exit.                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Example output of read-register call:

read-register


start development

For development, we have a separate CLI, just call it:

~/inverter-connect$ ./dev-cli.py --help

The output of ./dev-cli.py --help looks like:

Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help      Show this message and exit.                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ check-code-style            Check code style by calling darker + flake8                          │
│ coverage                    Run and show coverage.                                               │
│ create-default-settings     Create a default user settings file. (Used by CI pipeline ;)         │
│ fix-code-style              Fix code style of all inverter source code files via darker          │
│ install                     Run pip-sync and install 'inverter' via pip as editable.             │
│ mypy                        Run Mypy (configured in pyproject.toml)                              │
│ publish                     Build and upload this project to PyPi                                │
│ safety                      Run safety check against current requirements files                  │
│ test                        Run unittests                                                        │
│ tox                         Run tox                                                              │
│ update                      Update "requirements*.txt" dependencies files                        │
│ update-test-snapshot-files  Update all test snapshot files (by remove and recreate all snapshot  │
│                             files)                                                               │
│ version                     Print version and exit                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

credits

Others before me have done good work. In particular, I have learned a lot from the following projects:

The included definitions yaml files are from:

https://github.com/StephanJoubert/home_assistant_solarman/tree/main/custom_components/solarman/inverter_definitions

various links

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

inverter-connect-0.7.0rc2.tar.gz (69.8 kB view details)

Uploaded Source

Built Distribution

inverter_connect-0.7.0rc2-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file inverter-connect-0.7.0rc2.tar.gz.

File metadata

  • Download URL: inverter-connect-0.7.0rc2.tar.gz
  • Upload date:
  • Size: 69.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for inverter-connect-0.7.0rc2.tar.gz
Algorithm Hash digest
SHA256 e63605025fa37c393723b72526103f2802b841245e7719ef0f5964774f488498
MD5 1e8d588cebcd0f85a59f8df5f0f05337
BLAKE2b-256 a8664f5e5d24eae3cb9625341276cefff7044c3d2f687c4a18f95901b635572d

See more details on using hashes here.

Provenance

File details

Details for the file inverter_connect-0.7.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for inverter_connect-0.7.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbde89b3919444c9fe8c4ebe0239c33ba0a8b4d8e4706ae045694a9968e8aa54
MD5 ab384f1e745ae46d10bbcfebd9aaf176
BLAKE2b-256 0002dfa522ad037b336f545e7eef0a6461a34119797b0e6026d8a52720482442

See more details on using hashes here.

Provenance

Supported by

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