Skip to content

Commit

Permalink
Merge pull request #2789 from nicolargo/2788-sensortype-change-in-res…
Browse files Browse the repository at this point in the history
…t-api-breaks-compatibility-in-404

fix: plugin(sensors) - serialization bug with raw stats
  • Loading branch information
RazCrimson committed May 17, 2024
2 parents 396e78c + 30ec25f commit 3306fa0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions glances/plugins/sensors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


class SensorType(str, Enum):
# Switch to `enum.StrEnum` when we only support py311+
CPU_TEMP = 'temperature_core'
FAN_SPEED = 'fan_speed'
HDD_TEMP = 'temperature_hdd'
Expand Down Expand Up @@ -195,7 +196,7 @@ def __get_alias(self, stats):
else:
return stats["label"]

def __set_type(self, stats, sensor_type):
def __set_type(self, stats: List[Dict[str, Any]], sensor_type: SensorType) -> List[Dict[str, Any]]:
"""Set the plugin type.
4 types of stats is possible in the sensors plugin:
Expand All @@ -206,7 +207,7 @@ def __set_type(self, stats, sensor_type):
"""
for i in stats:
# Set the sensors type
i.update({'type': str(sensor_type)})
i.update({'type': sensor_type})
# also add the key name
i.update({'key': self.get_key()})

Expand Down

0 comments on commit 3306fa0

Please sign in to comment.