rules: fix test for device equality

This commit is contained in:
Peter F. Patel-Schneider 2023-11-05 07:17:31 -05:00
parent e71ed8ac94
commit ffd66e74c2
2 changed files with 3 additions and 3 deletions

View File

@ -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.

View File

@ -1051,8 +1051,7 @@ class Device(Condition):
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}