From ffd66e74c20031f7a38ad456673f4a10312cad1e Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Sun, 5 Nov 2023 07:17:31 -0500 Subject: [PATCH] rules: fix test for device equality --- docs/rules.md | 3 ++- lib/logitech_receiver/diversion.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 410c7043e7..014399209e 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -116,8 +116,9 @@ or the window's Window manager class or instance name starts with their string a `Device` conditions are true if a particular device originated the notification. `Active` conditions are true if a particular device is active. -`Device` and `Active` conditions take one argument, which is the Serial number or Unit ID of a device, +`Device` and `Active` conditions take one argument, which is the serial number or unit ID of a device, as shown in Solaar's detail pane. +Some older devices do not have a useful serial number or unit ID and so cannot be tested for by these conditions. `Host' conditions are true if the computers hostname starts with the condition's argument. diff --git a/lib/logitech_receiver/diversion.py b/lib/logitech_receiver/diversion.py index cb6f27b25e..b0e5b2ead7 100644 --- a/lib/logitech_receiver/diversion.py +++ b/lib/logitech_receiver/diversion.py @@ -1051,8 +1051,7 @@ def __str__(self): def evaluate(self, feature, notification, device, status, last_result): if _log.isEnabledFor(_DEBUG): _log.debug('evaluate condition: %s', self) - dev = _Device.find(self.devID) - return device == dev + return device.unitId == self.devID or device.serial == self.devID def data(self): return {'Device': self.devID}