Skip to main content

bluetti-modbus-lib

Unofficial library for basic communication to Bluetti Power Stations via Modbus.

Based on official documentation https://github.com/bluetti-official/bluetti-modbus-tcp-slave

You have to enable Modbus TCP in the webinterface of your device first.

Relationship to Patrick762's bluetti-modbus-lib

This repository started as a fork of Patrick762/bluetti-modbus-lib and has since diverged significantly (packaging, testing, retry handling, device coverage). Patrick762 is still actively maintaining his own version independently and was asked directly whether he'd like to fold this work back into his project or join bluetti-community - he's not in a position to commit the time to that right now, which is completely fine.

Since the PyPI name bluetti-modbus-lib is his and still actively used, this project is published on PyPI under a different name, bluetti-modbus, to avoid any ambiguity between the two. The GitHub repository itself keeps its original name.

Disclaimer

This library is provided without any warranty or support by Bluetti. I do not take responsibility for any problems it may cause in all cases. Use it at your own risk.

Supported devices and data

  • Balco260
  • EP2000
  • SMeter (Bluetti's AC meter/CT device - untested against real hardware so far)

Field names, units, and Modbus registers come from bluetti-registers - devices/balco260.py, devices/ep2000.py, and devices/smeter.py in this repo are generated from it by import.py, not written by hand.

Architecture

This library does not create or own a Modbus transport itself. It's built on modbus-connection's device-modelling framework: Balco260, EP2000, and SMeter (bluetti_modbus_lib.devices) each take a ModbusUnit supplied by the caller, built from whichever backend and connection the caller already manages. That's the integration surface for embedding this library into another application (a Home Assistant integration, for example).

BluettiModbusClient (bluetti_modbus_lib.modbus.client) is different: it owns and manages its own connection. It exists for the bluetti-modread CLI below and standalone/manual use, not as something another application should build on - doing so would open a second, competing connection to the device instead of sharing one.

Field metadata is deliberately limited to what's true at the Modbus/protocol level - address, type, scale, unit, whether it's writable. It does not carry Home Assistant concepts like entity category, state class, or device class: those describe how a value should be presented in an HA UI, not anything about the register itself, and belong in whichever integration consumes this library, not in the library.

Installation

pip install bluetti-modbus

Installing bluetti-modbus alone only pulls in modbus-connection's backend-neutral interface - enough to use the device classes directly against a ModbusUnit you already have. The bluetti-modread CLI needs a concrete backend, installed via the cli extra:

pip install "bluetti-modbus[cli]"

Sponsoring

If you want to support this project, you can sponsor Patrick762 on GitHub, the original author.

Commands for testing

Commands included in this library should only be used for testing.

Read device data for supported devices

usage: bluetti-modread [-h] [-c HOST] [-p PORT] [-t TYPE]

Read bluetti devices via modbus

options:
  -h, --help            show this help message and exit
  -c HOST, --host HOST  IP-address of the device
  -p PORT, --port PORT  Port of the device
  -t TYPE, --type TYPE  Device type

Example:

bluetti-modread -c 10.2.1.60 -p 502 -t balco260

Example output, captured from a real Balco260 (truncated - bluetti-modread prints one line per field):

d_num_inverters: 1
ac_o_p_total: 84 W
pv_i_p_total: 0 W
ac_o_e_total: 64.7 kWh
d_inverter_status: InverterStatus.GridConnectedOperation
g_i_f: 50.0 Hz
b_v: 27.1 V
b_soc: 100 %
b_cycle_count: 8
b_t_avg: 0 °C
b_i_e: 23420 Wh

Note the two energy fields above: most cumulative energy fields (ac_o_e_total, etc.) are reported in kWh, but the battery charge/discharge ones (b_i_e, b_o_e) are in Wh - both correct as reported by the device, just worth knowing if you're comparing values across fields.

Field names follow the naming convention documented in bluetti-registers.

Download files

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

Source Distribution

bluetti_modbus-0.1.3.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

bluetti_modbus-0.1.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file bluetti_modbus-0.1.3.tar.gz.

File metadata

  • Download URL: bluetti_modbus-0.1.3.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bluetti_modbus-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2370acdf06ca3bb3c3bbc5a426c0aafe6b80f1108da61d0b9b1e460b8a550d91
MD5 eb9ad562a91f26300a2f4e17e7214238
BLAKE2b-256 ba1f8665300c2ee64847df2ec40d6e2a5e30ad102dc955cc3b10651059116e3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bluetti_modbus-0.1.3.tar.gz:

Publisher: python-publish.yml on bluetti-community/bluetti-modbus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bluetti_modbus-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bluetti_modbus-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bluetti_modbus-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 670e5e2f1c887bf86c42eab50c64bda8a5a1bf2b1c0bd6cdef3a343194a5715c
MD5 b1f89a9d66679a9987878ef49b889462
BLAKE2b-256 69228a59f58328dae8604bbbf94b932163e09315419292134adf45c0e06b37ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for bluetti_modbus-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on bluetti-community/bluetti-modbus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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