From ab20a6ae123673f48b6d835aae266da620247ebb Mon Sep 17 00:00:00 2001 From: sh4un <97253929+sh4un-dot-com@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:14:46 -0500 Subject: [PATCH] fix: update health monitoring on serial data receive and send; change default serial protocol to json_newline Signed-off-by: sh4un <97253929+sh4un-dot-com@users.noreply.github.com> --- ammb/meshcore_handler.py | 9 ++++++++- examples/config.ini.example | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ammb/meshcore_handler.py b/ammb/meshcore_handler.py index ea94c31..c0e81b0 100644 --- a/ammb/meshcore_handler.py +++ b/ammb/meshcore_handler.py @@ -254,7 +254,10 @@ class MeshcoreHandler: if raw_data: self.logger.debug("Serial RAW RX: %r", raw_data) - + # Update health on every receive + self.health_monitor.update_component( + "external", HealthStatus.HEALTHY, "Serial RX received" + ) # Decode using the selected protocol handler decoded_msg: Optional[Dict[str, Any]] = ( self.protocol_handler.decode(raw_data) @@ -433,6 +436,10 @@ class MeshcoreHandler: self._is_connected.clear() if send_success: + # Update health on every successful send + self.health_monitor.update_component( + "external", HealthStatus.HEALTHY, "Serial TX sent" + ) self.to_serial_queue.task_done() else: self.logger.error( diff --git a/examples/config.ini.example b/examples/config.ini.example index fc217dd..20dd003 100644 --- a/examples/config.ini.example +++ b/examples/config.ini.example @@ -40,7 +40,7 @@ SERIAL_BAUD_RATE = 9600 # (Use this if your device talks Text/JSON) # raw_serial: Reads raw binary/text bytes and forwards them as Hex. # (Use this for MeshCore Companion Mode or binary protocols) -SERIAL_PROTOCOL = raw_serial +SERIAL_PROTOCOL = json_newline # Use json_newline for text/JSON, raw_serial for binary/hex # --- MQTT Transport Settings ---