From 435838636260e4cf76314f270bd7b00836c17a85 Mon Sep 17 00:00:00 2001 From: DewGew Date: Sat, 10 Feb 2024 19:31:54 +0100 Subject: [PATCH] Update trait.py --- modules/trait.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/trait.py b/modules/trait.py index d06ecbb..e3a91f7 100644 --- a/modules/trait.py +++ b/modules/trait.py @@ -126,9 +126,9 @@ def query(custom_data, device, user_id): response["currentArmLevel"] = state['Data'] if 'action.devices.traits.EnergyStorage' in device['traits']: - if state['BatteryLevel'] != 255: + if state['BatteryLevel'] is not None: battery = state['BatteryLevel'] - if battery is not None: + if battery != 255: if battery == 100: descriptive_capacity_remaining = "FULL" elif 50 <= battery < 100: @@ -148,7 +148,7 @@ def query(custom_data, device, user_id): response['online'] = True - if domain not in ['Group', 'Scene'] and state['BatteryLevel'] != 255: + if domain not in ['Group', 'Scene'] and state['BatteryLevel'] is not None and state['BatteryLevel'] != 255: if state['BatteryLevel'] <= 10: # Report low battery below 10% response['exceptionCode'] = 'lowBattery'