Skip to main content

A library for parsing Renogy BLE data

Project description

Renogy BLE

Tests Release

A Python library for communicating with Renogy Bluetooth Low Energy (BLE) devices and parsing their Modbus responses.

Overview

Library for communicating with Renogy devices over BLE using BT-1 and BT-2 Bluetooth modules, plus parsing raw Modbus response data into a flat dictionary.

Currently supported devices:

  • Renogy charge controllers (such as Rover, Wanderer, Adventurer)

Future planned support:

  • Renogy batteries
  • Renogy inverters

Installation

pip install renogy-ble

Usage

There are two common ways to use this library:

  • Parse raw Modbus response bytes (if you already handle BLE I/O elsewhere).
  • Use the built-in BLE client to connect, read, and parse data end-to-end.

Parse Raw Modbus Responses

Use this when you already have the raw Modbus response bytes and the register address you requested.

from renogy_ble import RenogyParser

# Raw BLE data received from your Renogy device
raw_data = b"\xff\x03\x02\x00\x04\x90S"  # Example data

# Parse the data for a specific model and register
parsed_data = RenogyParser.parse(raw_data, device_type="controller", register=57348)

# Use the parsed data
print(parsed_data)
# Example output: {'battery_type': 'lithium'}

Notes:

  • raw_data must include the full Modbus response, including address, function code, byte count, and CRC.
  • Parsed values may be scaled or mapped based on the register map (for example, voltages are scaled to volts).

Connect Over BLE and Read Data

The RenogyBleClient handles Modbus framing, BLE notification reads, and parsing. This example discovers a BLE device, connects, reads the default command set, and prints the parsed data.

import asyncio

from bleak import BleakScanner

from renogy_ble import RenogyBLEDevice, RenogyBleClient


async def main() -> None:
    devices = await BleakScanner.discover()
    ble_device = next(
        device for device in devices if "Renogy" in (device.name or "")
    )

    renogy_device = RenogyBLEDevice(ble_device, device_type="controller")
    client = RenogyBleClient()

    result = await client.read_device(renogy_device)
    if result.success:
        print(result.parsed_data)
    else:
        print(f"Read failed: {result.error}")


if __name__ == "__main__":
    asyncio.run(main())

Custom Commands or Device IDs

You can supply your own Modbus command set or device ID if needed.

from renogy_ble import COMMANDS, RenogyBleClient

custom_commands = {
    "controller": {
        **COMMANDS["controller"],
        "battery": (3, 57348, 1),
    }
}

client = RenogyBleClient(device_id=0xFF, commands=custom_commands)

Features

  • Connects to Renogy BLE devices and reads Modbus registers
  • Builds Modbus read requests with CRC framing
  • Parses raw BLE Modbus responses from Renogy devices
  • Extracts information about battery, solar input, load output, controller status, and energy statistics
  • Returns data in a flat dictionary structure
  • Applies scaling and mapping based on the register definitions

Data Handling

Input Format

The library accepts raw BLE Modbus response bytes and requires you to specify:

  • The device type (e.g., device_type="controller")
  • The register number being parsed (e.g., register=256)

Output Format

Returns a flat dictionary of parsed values:

{
    "battery_voltage": 12.9,
    "pv_power": 250,
    "charging_status": "mppt"  # Mapped from numeric values where applicable
}

Extending for Other Models

The library is designed to be easily extensible for other Renogy device types. To add support for a new type:

  1. Update the REGISTER_MAP in register_map.py with the new device type's register mapping
  2. Create a new type-specific parser class in parser.py (if needed)
  3. Update the RenogyParser.parse() method to route to your new parser

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

References

cyrils/renogy-bt

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

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

renogy_ble-1.2.2b21.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

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

renogy_ble-1.2.2b21-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file renogy_ble-1.2.2b21.tar.gz.

File metadata

  • Download URL: renogy_ble-1.2.2b21.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for renogy_ble-1.2.2b21.tar.gz
Algorithm Hash digest
SHA256 4b8485583e644291a42bdb8e43a4a42aa03e8024cf284f6c73cf5fa3ec2d15aa
MD5 e67bcd3b8b97eaa3213ce667b6a7b982
BLAKE2b-256 3857b5ede9ca33ccca25603291b70abc1748e4837827803b72cef0b4b1e6c9fa

See more details on using hashes here.

File details

Details for the file renogy_ble-1.2.2b21-py3-none-any.whl.

File metadata

  • Download URL: renogy_ble-1.2.2b21-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for renogy_ble-1.2.2b21-py3-none-any.whl
Algorithm Hash digest
SHA256 93df6fa299f83b620f6b209dd2a9b7a8c3cc3be6472d626175c7f8b5f8b14de9
MD5 8363279e0d389cc22cac061e8fa1db2e
BLAKE2b-256 3aee094293f0f6e7706d1245231a3f69c52c87149e6b0a708fcf6f2d54768ef7

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