Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rules: fix test for device equality #2173

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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