Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
/ daly_bms_bt Public archive

BT data retrieval utility for Daly Smart BMS

License

Notifications You must be signed in to change notification settings

gmanic/daly_bms_bt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starting with dreadnought's py-module for the Daly BMS, I found some more snippets on commands and return codes. (thanks to the brave man at https://diysolarforum.com/threads/decoding-the-daly-smartbms-protocol.21898/). I am far from having all of them implemented, and I likely will not implement all of them. As my plan is to use the BT capabilities on my BMS (4S-120A), I'll focus on certain functions.

MQTT is implemented (also gracefully taken from dreadnought) grafana/prometheus functionality might be implemented (grabbing more pieces from around the internet). Because I intend to use it as monitoring-only, and to keep security footprint low, I will not implement setting parameters of the BMS. Use the usual ways to modify (app etc.).

Configuration is via commandline hardcoded so far (especially the BT mac-address of the BMS).

daly_bms_bt.py is the file to run, it'll show some help when called without the required BT mac_address to connect to. The MQTT arguments are also provided on the cmd-line, you can define a loop-wait in seconds, but be aware, that the Daly BT module goes to sleep if not used and neither load/charge are present after approx 1h of inactivity.

Running daly_bms_bt.py can loop endlessly (until a fatal error or CTRL-C [always trying to cleanly shut down BT connection]). Results are printed (json) on STDOUT unless you configure MQTT. In loop mode, BT is disconnected while waiting loop-wait-time. This enables a different app to connect to the BMS while the loop is in its scheduled pause. Error handling should retry to reconnect endlessly as long as the BT connection is not available. I have not tried to connect via CAN/UART-485 at the same time.

Requirements are especially bleak for BT connectivity, paho for MQTT (and some more usually installed modules).

Structure is that daly_bms.py is implementing data functionallity, daly_bms_bluetooth.py is the connection layer to the BMS via bleak (via asyncio, hence this additional layer (extended to dreadnought's initial implementation).

Data model is a little different to accomodate a clear (IMHO) MQTT structure, especially considering using more than one Daly SMART BMS.

Response codes for BMS' error codes are currently disabled, as they throw an error, have not fixed that, yet. I'm not going to intentionally trying to trigger those errors...

I have no prior experience with python, nor asyncio programming, so bear with me. :)

Feel free to re-use (according to MIT licence, as original dreadnought's repo).

Thanks a lot, dreadnought and that writer on diysolarforum.com.

I cannot confirm, as of now, but keep the following in mind:

  • It seems like the Bluetooth BMS Module goes to sleep after 1 hour of inactivity (no load or charging), while the serial connection responds all the time. Sending a command via the serial interface wakes up the Bluetooth module.

Keep in mind: no guarantees, use at your own risk & your mileage might vary.

+++++

As I stopped working on the repo long time ago (changed bms & setup), the repo will be archived

About

BT data retrieval utility for Daly Smart BMS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages