settings: don't add non-existant key in raw xy processing

This commit is contained in:
Peter F. Patel-Schneider 2022-10-12 15:49:51 -04:00
parent 255c315ce1
commit 67c1d7e778
1 changed files with 7 additions and 6 deletions

View File

@ -1448,12 +1448,13 @@ class RawXYProcessing:
def start(self, key): def start(self, key):
device_key = next((k for k in self.device.keys if k.key == key), None) device_key = next((k for k in self.device.keys if k.key == key), None)
self.keys.append(device_key) if device_key:
if not self.active: self.keys.append(device_key)
self.active = True if not self.active:
self.activate_action() self.active = True
self.device.add_notification_handler(self.name, self.handler) self.activate_action()
device_key.set_rawXY_reporting(True) self.device.add_notification_handler(self.name, self.handler)
device_key.set_rawXY_reporting(True)
def stop(self, key): # only stop if this is the active key def stop(self, key): # only stop if this is the active key
if self.active: if self.active: