Skip to content

Commit

Permalink
Merge pull request #835 from mr-manuel/dev
Browse files Browse the repository at this point in the history
Changes 2023.10.09
  • Loading branch information
mr-manuel authored Oct 9, 2023
2 parents f603dfb + 0b7405a commit 71c3efe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
## v1.0.x

* Added: Bluetooth: Show signal strength of BMS in log by @mr-manuel
* Added: Configure logging level in `config.ini` by @mr-manuel
* Added: Create unique identifier, if not provided from BMS by @mr-manuel
* Added: Current average of the last 5 minutes by @mr-manuel
* Added: Daly BMS - Auto reset SoC when changing to float (can be turned off in the config file) by @transistorgit
Expand Down
7 changes: 7 additions & 0 deletions etc/dbus-serialbattery/config.default.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
[DEFAULT]

; --------- Set logging level ---------
; ERROR: Only errors are logged
; WARNING: Errors and warnings are logged
; INFO: Errors, warnings and info messages are logged
; DEBUG: Errors, warnings, info and debug messages are logged
LOGGING = INFO

; --------- Battery Current limits ---------
MAX_BATTERY_CHARGE_CURRENT = 50.0
MAX_BATTERY_DISCHARGE_CURRENT = 60.0
Expand Down
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/dbus-serialbattery.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def get_port() -> str:

battery = get_battery(port)
else:
# wait some seconds to be sure that the serial connection is ready
# else the error throw a lot of timeouts
sleep(16)
battery = get_battery(port)

# exit if no battery could be found
Expand Down
13 changes: 11 additions & 2 deletions etc/dbus-serialbattery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# Logging
logging.basicConfig()
logger = logging.getLogger("SerialBattery")
logger.setLevel(logging.INFO)

PATH_CONFIG_DEFAULT = "config.default.ini"
PATH_CONFIG_USER = "config.ini"
Expand All @@ -38,10 +37,20 @@ def _get_list_from_config(


# Constants
DRIVER_VERSION = "1.0.20230927dev"
DRIVER_VERSION = "1.0.20231009dev"
zero_char = chr(48)
degree_sign = "\N{DEGREE SIGN}"

# get logging level from config file
if config["DEFAULT"]["LOGGING"] == "ERROR":
logging.basicConfig(level=logging.ERROR)
elif config["DEFAULT"]["LOGGING"] == "WARNING":
logging.basicConfig(level=logging.WARNING)
elif config["DEFAULT"]["LOGGING"] == "DEBUG":
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)

# save config values to constants

# --------- Battery Current limits ---------
Expand Down

0 comments on commit 71c3efe

Please sign in to comment.