FIX: SensorDataChangeEvent trigger logic

The event should be skipped only if new_data is null or an empty,
list/object, not if it contains
a zero/false-y value.
This commit is contained in:
Fabio Manganiello 2022-01-17 16:38:43 +01:00
parent 6656bb4ce5
commit 0c423e3809
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -175,7 +175,7 @@ class SensorBackend(Backend):
plugin.close() plugin.close()
def process_data(self, data, new_data): def process_data(self, data, new_data):
if new_data: if new_data is not None and data not in ({}, []):
self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__)) self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__))
def run(self): def run(self):