Skip to content

Commit 3bf0483

Browse files
committed
sensors: ignore overflow value
Signed-off-by: Xuefer <xuefer@gmail.com>
1 parent 3294c3d commit 3bf0483

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

python.d/sensors.chart.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
]}
5050
}
5151

52+
LIMITS = {
53+
'temperature': [-127, 1000],
54+
'voltage': [-127, 127],
55+
'current': [-127, 127],
56+
'fan': [0, 65535]
57+
}
58+
5259
TYPE_MAP = {
5360
0: 'voltage',
5461
1: 'fan',
@@ -82,6 +89,11 @@ def _get_data(self):
8289
for sf in sfi:
8390
val = sensors.get_value(chip, sf.number)
8491
break
92+
typeName = TYPE_MAP[feature.type]
93+
if typeName in LIMITS:
94+
limit = LIMITS[typeName];
95+
if val < limit[0] or val > limit[1]:
96+
continue
8597
data[prefix + "_" + str(feature.name.decode())] = int(val * 1000)
8698
except Exception as e:
8799
self.error(e)

0 commit comments

Comments
 (0)