diff --git a/CHANGELOG.md b/CHANGELOG.md index 6674a6b..fc2bf0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.0.1 +* Changed: Corrected descriptions in the full JSON structure +* Changed: Fixed division by zero when Current = 0 during calculation of Time-to-Go or Voltage = 0 during calculation of Current + ## v1.0.0 * Added: A lot of new values that can be set, check the full [JSON structure](https://github.com/mr-manuel/venus-os_dbus-mqtt-battery#json-structure) in the `README.md` for details * Added: Device name can be changed in the `config.ini` diff --git a/dbus-mqtt-battery/dbus-mqtt-battery.py b/dbus-mqtt-battery/dbus-mqtt-battery.py index 65e821b..da04f4e 100644 --- a/dbus-mqtt-battery/dbus-mqtt-battery.py +++ b/dbus-mqtt-battery/dbus-mqtt-battery.py @@ -262,7 +262,7 @@ def on_message(client, userdata, msg): # calculate possible values if missing if 'Current' not in jsonpayload['Dc']: - battery_dict['/Dc/0/Current']['value'] = round( ( battery_dict['/Dc/0/Power']['value'] / battery_dict['/Dc/0/Voltage']['value'] ), 3 ) + battery_dict['/Dc/0/Current']['value'] = round( ( battery_dict['/Dc/0/Power']['value'] / battery_dict['/Dc/0/Voltage']['value'] ), 3 ) if battery_dict['/Dc/0/Voltage']['value'] != 0 else 0 if ( 'Capacity' not in jsonpayload @@ -347,7 +347,7 @@ def __init__( self._dbusservice.add_path('/ProductId', 0xFFFF) self._dbusservice.add_path('/ProductName', productname) self._dbusservice.add_path('/CustomName', customname) - self._dbusservice.add_path('/FirmwareVersion', '1.0.0') + self._dbusservice.add_path('/FirmwareVersion', '1.0.1') #self._dbusservice.add_path('/HardwareVersion', '') self._dbusservice.add_path('/Connected', 1)