A python library to access GivEnergy inverters via Modbus TCP, with no dependency on the GivEnergy Cloud.
Project description
GivEnergy Modbus
A python library to access GivEnergy inverters via Modbus TCP on a local network, with no dependency on the GivEnergy Cloud. This extends pymodbus by providing a custom framer, decoder and PDUs that are specific to the GivEnergy implementation.
⚠️ This project makes no representations as to its completeness or correctness. You use it at your own risk — if your inverter mysteriously explodes because you accidentally set the
BOOMTIME
register or you consume a MWh of electricity doing SOC calibration: you really are on your own. We make every effort to prevent you from shooting yourself in the foot, so as long as you use the client and its exposed methods, you should be perfectly safe.
- Documentation: https://dewet22.github.io/givenergy-modbus
- GitHub: https://github.com/dewet22/givenergy-modbus
- PyPI: https://pypi.org/project/givenergy-modbus/
- Free software: Apache-2.0
Features
- Reading all registers and decoding them into their representative datatypes
- Writing data to holding registers that are deemed to be safe to set configuration on the inverter
How to use
Use the provided client to interact with the device over the network, and register caches to build combined state of a device:
import datetime
from givenergy_modbus.client import GivEnergyClient
from givenergy_modbus.model.inverter import Model
from givenergy_modbus.model.plant import Plant
client = GivEnergyClient(host="192.168.99.99")
# change configuration on the device:
client.enable_charge_target(80)
# set a charging slot from 00:30 to 04:30
client.set_charge_slot_1((datetime.time(hour=0, minute=30), datetime.time(hour=4, minute=30)))
# set the inverter to charge when there's excess, and discharge otherwise. it will also respect charging slots.
client.set_mode_dynamic()
p = Plant(number_batteries=1)
client.refresh_plant(p, full_refresh=True)
assert p.inverter.inverter_serial_number == 'SA1234G567'
assert p.inverter.inverter_model == Model.Hybrid
assert p.inverter.v_pv1 == 1.4 # V
assert p.inverter.e_battery_discharge_day == 8.1 # kWh
assert p.inverter.enable_charge_target
assert p.inverter.dict() == {
'inverter_serial_number': 'SA1234G567',
'device_type_code': '3001',
'charge_slot_1': (datetime.time(0, 30), datetime.time(7, 30)),
'f_ac1': 49.98,
...
}
assert p.inverter.json() == '{"inverter_serial_number": "SA1234G567", "device_type_code": "3001", ...'
assert p.batteries[0].serial_number == 'BG1234G567'
assert p.batteries[0].v_battery_cell_01 == 3.117
assert p.batteries[0].dict() == {
'bms_firmware_version': 3005,
'design_capacity': 160.0,
...
}
assert p.batteries[0].json() == '{"battery_serial_number": "BG1234G567", "v_battery_cell_01": 3.117, ...'
Credits
This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file givenergy-modbus-0.10.1.tar.gz
.
File metadata
- Download URL: givenergy-modbus-0.10.1.tar.gz
- Upload date:
- Size: 55.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cf4e8b45bd1df5e98d2ec5d5e125092bbbb56c2822501cbf2a63ba15a49b12c |
|
MD5 | 901bdb7eff78ed7a08d87bcfc99e64ee |
|
BLAKE2b-256 | f18e7f52b37d822791792920e66e530fd5a37b8ee673e3244fb4cd1ab31d2cc1 |
File details
Details for the file givenergy_modbus-0.10.1-py3-none-any.whl
.
File metadata
- Download URL: givenergy_modbus-0.10.1-py3-none-any.whl
- Upload date:
- Size: 39.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a497190357680a422cf5a41c48c545ba7d0ca13d6a1eff7d5b58c91d8892984 |
|
MD5 | b96f2eb261f37b93f8f0339868c71e7c |
|
BLAKE2b-256 | db92a94043dd55bbaa215ee52459e919e6b03ad366851f99c85e2022f9b0e8c0 |