Skip to content

Commit

Permalink
rules: fix test for device equality
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Nov 5, 2023
1 parent e71ed8a commit a7bbd2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 1 addition & 2 deletions lib/logitech_receiver/diversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit a7bbd2f

Please sign in to comment.