diff --git a/platypush/plugins/hid/__init__.py b/platypush/plugins/hid/__init__.py index b3d9498d8..9705c292a 100644 --- a/platypush/plugins/hid/__init__.py +++ b/platypush/plugins/hid/__init__.py @@ -142,6 +142,7 @@ class HidPlugin(RunnablePlugin): path = dev_def['path'] data_size = rule['data_size'] poll_seconds = rule['poll_seconds'] + notify_only_if_changed = rule['notify_only_if_changed'] last_data = None self.logger.info(f'Starting monitor for device {path}') @@ -162,7 +163,7 @@ class HidPlugin(RunnablePlugin): wait() continue - if len(data) and data != last_data: + if not notify_only_if_changed or data != last_data: data_dump = ''.join(f'{x:02x}' for x in data) get_bus().post(HidDeviceDataEvent(data=data_dump, **dev_def)) last_data = data diff --git a/platypush/schemas/hid.py b/platypush/schemas/hid.py index e260fa820..6cb372cae 100644 --- a/platypush/schemas/hid.py +++ b/platypush/schemas/hid.py @@ -68,10 +68,10 @@ class HidMonitoredDeviceSchema(HidDeviceSchema): ) poll_seconds = fields.Float( - missing=0.1, + missing=0, metadata={ - 'description': 'How often we should check this device for new data ' - '(default: 0.1 seconds)' + 'description': 'How often we should wait before data reads ' + '(default: no wait)' }, )