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.2.tar.gz (12.1 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.2-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bluetti_modbus-0.1.2.tar.gz
  • Upload date:
  • Size: 12.1 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.2.tar.gz
Algorithm Hash digest
SHA256 79ba6327a3e4bee974d4ddd7b50d6b05c9c156402238f4cbe9d949ccd582a0eb
MD5 90a92e7db6adb746c7654f3125c7ecfb
BLAKE2b-256 e3b623a27906079b054646bdca7821d16b2dc02844b7b8e593bd8e7970fb2a8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bluetti_modbus-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: bluetti_modbus-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 344f503cf4af404dee6244065a00bf4082d1d6945ce83b6b7fa8443077e6d2b0
MD5 c1c97e6a7f64fb71f13950b9cb2241f6
BLAKE2b-256 e846ca4e431317bf7ab4c061d10c7c58e50deba865b6ca4682c12cfedcff4db7

See more details on using hashes here.

Provenance

The following attestation bundles were made for bluetti_modbus-0.1.2-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

0.1.3

2 files

This release

0.1.2 This release

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