Skip to main content

A python library to access GivEnergy inverters via Modbus TCP, with no dependency on the GivEnergy Cloud.

Project description

GivEnergy Modbus

pypi python Build Status codecov Code style: black

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.

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


Download files

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

Source Distribution

givenergy_modbus-1.0.0.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

givenergy_modbus-1.0.0-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file givenergy_modbus-1.0.0.tar.gz.

File metadata

  • Download URL: givenergy_modbus-1.0.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for givenergy_modbus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 46314f7fc353a65ad5b6560d596961a9e1a27d0cad125d9475d81cbdbd212272
MD5 36fcbd2db3ef95bb1f2ec259088a0c9b
BLAKE2b-256 0c904da19f898edc64f31ee2bd9e6134126127023e0efc398080600cc48a8fb0

See more details on using hashes here.

File details

Details for the file givenergy_modbus-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for givenergy_modbus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e76b37bdc4defdd545c730c5e4798f77eee323ffa295c543598bfebb0b55858c
MD5 09f21f28c39b84c8ebe1d46a0141c90d
BLAKE2b-256 5306feba6d4d3d358157c153ff4cc93cee502c0c3fee9813b1ad1b3b7785dd4f

See more details on using hashes here.

Supported by

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