Sign inSign up

ricariel/solarflow-topic-mapper

By ricariel

•Updated 3 days ago

A tool to connect to Zendure's Solarflow hub to retrieve telemetry data

Image
0

10K+

ricariel/solarflow-topic-mapper repository overview

⁠Solarflow Bluetooth Manager

A tool that talks to a Zendure Solarflow hub over Bluetooth Low Energy to read telemetry and to control which MQTT broker the hub reports to — Zendure's cloud, or one of your own.

Fork of reinhard-brandstaedter/solarflow-bt-manager⁠. See Fork Changes⁠ for what differs.

Note

Work in progress. Reconfiguring the hub's network settings over BLE is not a supported operation — use at your own risk.

⁠Supported Devices

DeviceSF_PRODUCT_ID
Hub 120073bkTV (default)
Hub 2000A8yh63
AIO 2400yWF7hV
ACE 15008bM93H

Set SF_PRODUCT_ID for anything other than the Hub 1200.

⁠Why Take the Hub Off the Cloud

  • Finer control than the app offers, for example arbitrary output limits.
  • No dependency on a cloud service, and no round-trip latency.
  • Usage data stays local.
  • Direct integration with a home automation system.

⁠Requirements

  • A Bluetooth LE capable machine with Python 3 — a Raspberry Pi in range of the hub is the usual choice.
  • pip3 install -r src/requirements.txt (bleak, paho-mqtt)

The script scans for a Bluetooth device whose name starts with Zen and connects to the first one it finds. With several Zendure devices in range, which one it picks is not predictable.

⁠Operating Modes

⁠Proxy Mode

The hub keeps its cloud connection for device data, but live telemetry is collected over Bluetooth by this tool and republished to your own broker. The app keeps working, including schedules.

This needs the tool running permanently as a service on a BLE-capable machine within range. The Bluetooth link can drop and not recover on its own; recovering means dropping the connection on either side.

⁠Offline Mode

The hub is reconfigured to talk to your MQTT broker instead of Zendure's. It stays on WiFi but no longer reaches the cloud at all.

Nothing needs to run locally afterwards except the broker. In exchange the app shows no telemetry and cannot control the hub — every setting change has to be made by publishing the right MQTT message.

Hub in offline mode

⁠Usage

⁠Reading Hub Information
python3 src/solarflow-bt-manager.py -i

Connects, prints the GATT services, the device ID and the serial number, then exits after a few seconds. Note down the device ID — the disconnect and reconnect steps need it.

⁠Telemetry to a Local Broker
python3 src/solarflow-bt-manager.py -i -b <broker-host>:1883

Telemetry is published under solarflow-hub/telemetry.

Note

While the Bluetooth connection is up, the hub reports telemetry **only** over Bluetooth. Nothing goes to the cloud in parallel, so the app shows no data — though it can still control the hub.
⁠Disconnecting the Hub from the Cloud

The hub's WiFi connection is reinitialised and pointed at a different broker:

export WIFI_PWD="..."
export SF_DEVICE_ID="..."
export SF_PRODUCT_ID="73bkTV"
export MQTT_USER="..."
export MQTT_PWD="..."
python3 src/solarflow-bt-manager.py -d -w <wifi-ssid> -b <broker-host>

Afterwards the hub publishes under /<product-id>/<device-id>/#.

Native Zendure MQTT topics in a broker

Once the hub is offline it can be driven by solarflow-control⁠ and solarflow-statuspage⁠ in offline mode.

Notes on this step:

  • The hub authenticates with its own built-in credentials, not the ones above, so the target broker has to accept them — in practice that means allowing anonymous connections.
  • For the AIO 2400, reset the network connection manually first by holding the connection button for about three seconds.
  • It can help to move the hub to a different WiFi network before joining the target network.
⁠Reconnecting the Hub to the Cloud

Needed for firmware updates, among other things:

export WIFI_PWD="..."
export SF_DEVICE_ID="..."
export SF_PRODUCT_ID="73bkTV"
python3 src/solarflow-bt-manager.py -c -w <wifi-ssid>

⁠Options and Environment

OptionPurpose
-iPrint hub information and exit
-dDisconnect the hub from the Zendure cloud
-cReconnect the hub to the Zendure cloud
-b <host[:port]>Local MQTT broker; port defaults to 1883
-w <ssid>WiFi SSID the hub should join
-u / -pMQTT user and password
-hUsage
VariablePurpose
SF_DEVICE_IDDevice ID, from the -i output. Required for -d.
SF_PRODUCT_IDProduct ID, defaults to 73bkTV
WIFI_SSID, WIFI_PWDWiFi credentials for the hub
MQTT_USER, MQTT_PWDBroker credentials
GLOBAL_INFO_POLLING_INTERVALSeconds between full status polls, default 60

-d refuses to run unless SSID, broker, WiFi password, device ID and product ID are all present.

⁠Topic Mapper

src/solarflow-topic-mapper.py subscribes to the hub's native report topic and republishes it in a flatter, more readable structure.

VariablePurpose
SF_DEVICE_ID, SF_PRODUCT_IDIdentify the topic to subscribe to
MQTT_HOST, MQTT_PORTBroker, port defaults to 1883
MQTT_USER, MQTT_PWDBroker credentials
Topics after the mapper flattened them

This is obsolete with current versions of solarflow-control⁠, which reads the native topics directly.

The Dockerfile packages only the topic mapper, not the BT manager — the manager needs host Bluetooth access and is meant to run outside a container. Its Python dependencies come from src/topic-mapper-requirements.txt, not from src/requirements.txt, which also lists bleak for the BT manager.

docker build -t solarflow-topic-mapper .

⁠Fork Changes

fabrice.patch records the change carried on top of upstream: for SF_PRODUCT_ID=A8yh63 (Hub 2000) the product class is zenh1_72 rather than upstream's zenh. The hardware revision determines the right value; zenh1_76 is the alternative and is kept as a comment in the source.

The product class ends up in the BLE payload that reconfigures the hub. A wrong value means the hub ignores the command.

⁠Donations

From the upstream author: if you are happy with the solarflow tools and they help you, donations are welcome — so that destroying the only Solarflow system while hacking on its internals does not end the project.

Donate

Tag summary

Content type

Image

Digest

sha256:dd33990c1…

Size

65.1 MB

Last updated

3 days ago

docker pull ricariel/solarflow-topic-mapper