notifications: fix battery status notification parsing
Fix indicator tooltip (duplicate Solaar line, python list instead of battery status).
This commit is contained in:
parent
3583759d3a
commit
6981555804
|
@ -204,9 +204,10 @@ def _process_hidpp10_notification(device, status, n):
|
|||
def _process_feature_notification(device, status, n, feature):
|
||||
if feature == _F.BATTERY_STATUS:
|
||||
if n.address == 0x00:
|
||||
discharge = ord(n.data[:1])
|
||||
battery_status = ord(n.data[1:2])
|
||||
status.set_battery_info(discharge, _hidpp20.BATTERY_STATUS[battery_status])
|
||||
discharge_level = ord(n.data[:1])
|
||||
discharge_next_level = ord(n.data[1:2])
|
||||
battery_status = ord(n.data[2:3])
|
||||
status.set_battery_info(discharge_level, _hidpp20.BATTERY_STATUS[battery_status])
|
||||
else:
|
||||
_log.warn("%s: unknown BATTERY %s", device, n)
|
||||
return True
|
||||
|
|
|
@ -185,7 +185,7 @@ try:
|
|||
battery_charging = device_status.get(_K.BATTERY_CHARGING)
|
||||
tray_icon_name = _icons.battery(battery_level, battery_charging)
|
||||
|
||||
description = '%s: %s' % (name, device_status)
|
||||
description = '%s: %s' % (name, device_status.to_string())
|
||||
else:
|
||||
# there may be a receiver, but no peripherals
|
||||
tray_icon_name = _icons.TRAY_OKAY if _devices_info else _icons.TRAY_INIT
|
||||
|
@ -279,9 +279,6 @@ def _generate_tooltip_lines():
|
|||
yield '<b>%s</b>: ' % NAME + _("no receiver")
|
||||
return
|
||||
|
||||
yield '<b>%s</b>' % NAME
|
||||
yield ''
|
||||
|
||||
for _ignore, number, name, status in _devices_info:
|
||||
if number is None: # receiver
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue