Fix string identifier format

This commit is contained in:
2025-12-27 15:17:03 +01:00
parent a6c5a2cd54
commit 0ec10f765d
3 changed files with 4 additions and 59 deletions

View File

@@ -36,6 +36,7 @@ class SerialReader:
while self._run_event.is_set():
line = self.serial.readline()
if line:
print("Generic method")
data = line.decode('utf-8', errors='ignore')
self._notify(data)
@@ -47,4 +48,4 @@ if __name__ == "__main__":
reader = SerialReader("/dev/ttyUSB1", 57600)
reader.subscribe(callback)
reader.start()
reader.start()

View File

@@ -21,7 +21,7 @@ class LoraLightSensorReader(SerialReader):
match = self.json_pattern.search(line)
if match:
try:
data = json.loads(match.group())
data = match.group()
self._notify(str(data))
except json.JSONDecodeError:
print("Received invalid JSON:", match.group())
print("Received invalid JSON:", match.group())