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):
|
def _process_feature_notification(device, status, n, feature):
|
||||||
if feature == _F.BATTERY_STATUS:
|
if feature == _F.BATTERY_STATUS:
|
||||||
if n.address == 0x00:
|
if n.address == 0x00:
|
||||||
discharge = ord(n.data[:1])
|
discharge_level = ord(n.data[:1])
|
||||||
battery_status = ord(n.data[1:2])
|
discharge_next_level = ord(n.data[1:2])
|
||||||
status.set_battery_info(discharge, _hidpp20.BATTERY_STATUS[battery_status])
|
battery_status = ord(n.data[2:3])
|
||||||
|
status.set_battery_info(discharge_level, _hidpp20.BATTERY_STATUS[battery_status])
|
||||||
else:
|
else:
|
||||||
_log.warn("%s: unknown BATTERY %s", device, n)
|
_log.warn("%s: unknown BATTERY %s", device, n)
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -185,7 +185,7 @@ try:
|
||||||
battery_charging = device_status.get(_K.BATTERY_CHARGING)
|
battery_charging = device_status.get(_K.BATTERY_CHARGING)
|
||||||
tray_icon_name = _icons.battery(battery_level, 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:
|
else:
|
||||||
# there may be a receiver, but no peripherals
|
# there may be a receiver, but no peripherals
|
||||||
tray_icon_name = _icons.TRAY_OKAY if _devices_info else _icons.TRAY_INIT
|
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")
|
yield '<b>%s</b>: ' % NAME + _("no receiver")
|
||||||
return
|
return
|
||||||
|
|
||||||
yield '<b>%s</b>' % NAME
|
|
||||||
yield ''
|
|
||||||
|
|
||||||
for _ignore, number, name, status in _devices_info:
|
for _ignore, number, name, status in _devices_info:
|
||||||
if number is None: # receiver
|
if number is None: # receiver
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue