From 8d9d82e6e2167a883cfc209888bd403d08408a3f Mon Sep 17 00:00:00 2001 From: Patrick Salecker Date: Fri, 14 May 2021 19:54:59 +0200 Subject: [PATCH] Version 0.1.0 --- .gitignore | 3 ++ Makefile | 5 ++++ README.md | 44 +++++++++++++++++++++-------- daly-bms-cli.py => bin/daly-bms-cli | 0 setup.py | 26 +++++++++++++++++ 5 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile rename daly-bms-cli.py => bin/daly-bms-cli (100%) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2bc2e4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +dist/ +dalybms.egg-info/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9cae2e8 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +package-build: + python3 setup.py sdist bdist_wheel + twine check dist/* +package-upload: + twine upload dist/* diff --git a/README.md b/README.md index 4b2abe7..e62f3b2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,40 @@ -# python-daly-bms - This is a Python module for reading data from Daly BMS devices. It supports serial as well as Bluetooth connections. Not all commands that the BMS supports are implemented yet, please take a look at the examples below to see if it serves your needs. +## Installation + +### From PyPI + +``` +pip3 install dalybms +``` + +### From Git + +``` +git clone https://github.com/dreadnought/python-daly-bms.git +cd python-daly-bms +sudo python3 setup.py install +``` + +### Dependencies + +For *serial* connections: +``` +pip3 install pyserial +``` + +For *bluetooth* connections: +``` +pip3 install bleak +``` + ## CLI -`./daly-bms-cli.py` is a reference implementation for this module, but can also be used to test the connection or use it in combination with other programming languages. The data gets returned in JSON format. It doesn't support Bluetooth connections yet. +`daly-bms-cli` is a reference implementation for this module, but can also be used to test the connection or use it in combination with other programming languages. The data gets returned in JSON format. It doesn't support Bluetooth connections yet. ### Usage ``` -# ./daly-bms-cli.py --help +# daly-bms-cli --help usage: daly-bms-cli.py [-h] -d DEVICE [--status] [--soc] [--mosfet] [--cell-voltages] [--temperatures] [--balancing] [--errors] [--all] [--check] [--retry RETRY] @@ -35,7 +61,7 @@ optional arguments: Get the State of Charge: ``` -# ./daly-bms-cli.py -d /dev/ttyUSB0 --soc +# daly-bms-cli -d /dev/ttyUSB0 --soc { "total_voltage": 57.7, "current": -11.1, @@ -45,7 +71,7 @@ Get the State of Charge: Get everything possible: ``` -# ./daly-bms-cli.py -d /dev/ttyUSB0 --all +# daly-bms-cli -d /dev/ttyUSB0 --all { "soc": { "total_voltage": 52.5, @@ -113,11 +139,7 @@ Get everything possible: ### Bluetooth -- Of Bluetooth connections you need to have `bleak` installed. It's also recommended to have a recent BlueZ installed (>=5.53). - - ``` - pip3 install bleak - ``` +- It's also recommended to have a recent BlueZ installed (>=5.53). The Bluetooth connection uses `asyncio` for the connection, so the data is received asynchronous. diff --git a/daly-bms-cli.py b/bin/daly-bms-cli similarity index 100% rename from daly-bms-cli.py rename to bin/daly-bms-cli diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0372b3a --- /dev/null +++ b/setup.py @@ -0,0 +1,26 @@ +import pathlib +from setuptools import setup + +HERE = pathlib.Path(__file__).parent +README = (HERE / "README.md").read_text() + +setup( + name="dalybms", + version="0.1.0", + description="Client for Daly BMS", + long_description=README, + long_description_content_type="text/markdown", + url="https://github.com/dreadnought/python-daly-bms", + author="Patrick Salecker", + author_email="mail@salecker.org", + license="MIT", + classifiers=[ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + ], + packages=["dalybms"], + scripts=["bin/daly-bms-cli"], +) \ No newline at end of file