mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 13:03:02 +02:00
statd: add pwm fan support
Due to their nature we cannot read out the RPM of the pwm fans on the BPi-R3. But we can at least show it's alive, or steering out a signal to the fan. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -652,7 +652,20 @@ class Sensor:
|
||||
else:
|
||||
return f"{self.value} W"
|
||||
|
||||
# Handle PWM fan sensors (reported as "other" type with milli scale)
|
||||
# PWM duty cycle is reported as percentage (0-100)
|
||||
elif self.value_type == 'other' and self.value_scale == 'milli':
|
||||
# Check if this is likely a PWM sensor based on description or name
|
||||
name_lower = self.name.lower()
|
||||
desc_lower = (self.description or "").lower()
|
||||
if 'pwm' in desc_lower or 'fan' in name_lower or 'fan' in desc_lower:
|
||||
percent = self.value / 1000.0
|
||||
return f"{percent:.1f}%"
|
||||
# Fall through for other "other" type sensors
|
||||
|
||||
# For unknown sensor types, show raw value
|
||||
if self.value_type in ['other', 'unknown']:
|
||||
return f"{self.value}"
|
||||
else:
|
||||
return f"{self.value} {self.value_type}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user