28 lines
900 B
Python
28 lines
900 B
Python
"""Sensor readings shared by the LCD, lighting, cooling and the web UI."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class Readings:
|
|
temp: float | None = None # deg C
|
|
load: float | None = None # percent
|
|
clock: float | None = None # MHz
|
|
power: float | None = None # W
|
|
|
|
|
|
@dataclass
|
|
class PowerReadings:
|
|
cpu: float | None = None # W, CPU package (measured)
|
|
gpu: float | None = None # W, graphics card board power (measured)
|
|
other: float | None = None # W, rest of the PC (partly measured, partly estimated)
|
|
parts: dict[str, float] = field(default_factory=dict) # what makes up `other`
|
|
|
|
@property
|
|
def total(self) -> float | None:
|
|
if self.cpu is None or self.gpu is None or self.other is None:
|
|
return None
|
|
return self.cpu + self.gpu + self.other
|