From d41417d326571d597237581803d2da1e38f69b94 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Thu, 13 Aug 2026 19:28:09 +0200 Subject: [PATCH] Stop printing a sensor unit that has no reading A discrete sensor reports no value, and the unit was appended regardless, so a watchdog came out as "Watchdog:% " and an event log sensor as "SEL:". The unit belongs to a reading, so only print it when there is one. On the platform this was seen on the units field is itself meaningless for such a sensor, carrying a percent sign and a trailing space from the sdr. --- confluent_client/bin/nodesensors | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_client/bin/nodesensors b/confluent_client/bin/nodesensors index dc1d749b..0130e800 100755 --- a/confluent_client/bin/nodesensors +++ b/confluent_client/bin/nodesensors @@ -144,7 +144,10 @@ def sensorpass(showout=True, appendtime=False): showval = u' {0} '.format(floatformat(sensedata['value'])) else: showval = u' {0} '.format(sensedata.get('value', '')) - if sensedata.get('units', None) not in (None, u''): + # A discrete sensor has no reading for a unit to apply + # to, and printing the unit on its own says nothing + if (showval + and sensedata.get('units', None) not in (None, u'')): showval += sensedata['units'] if sensedata.get('health', 'ok') != 'ok': datadescription = [sensedata['health']]