Skip to content

Commit

Permalink
Update hub.py
Browse files Browse the repository at this point in the history
Updated battery logic based on testing with my blind to update for hex_bytearray
  • Loading branch information
unregist committed Jan 29, 2024
1 parent d8717b9 commit a885b37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/tuiss2ha/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,17 @@ async def battery_callback(self, sender: BleakGATTCharacteristic, data: bytearra
decimals = self.split_data(data)

if decimals[4] == 210:
if len(decimals) == 5:
if len(decimals) == 7:
_LOGGER.debug(
"%s: Please charge device", self.name
) # think its based on the length of the response? ff010203d2 (bad) vs ff010203d202e803 (good)
self._battery_status = True
elif decimals[5] > 10:
elif decimals[5] >= 10:
_LOGGER.debug(
"%s: Please charge device", self.name
) # think its based on the length of the response? ff010203d2 (bad) vs ff010203d202e803 (good)
self._battery_status = True
elif decimals[5] <= 10:
elif decimals[5] < 10:
_LOGGER.debug("%s: Battery is good", self.name)
self._battery_status = False
else:
Expand Down

0 comments on commit a885b37

Please sign in to comment.