simplyprint: unknown temperature fix

Omit temperature data for SBCs that Moonraker
cannot report.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-11-15 17:40:09 -05:00
parent 7337c6f762
commit dddd968f82
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 3 additions and 1 deletions

View File

@ -813,10 +813,12 @@ class SimplyPrint(Subscribable):
mem_pct = sys_mem["used"] / sys_mem["total"] * 100
cpu_data = {
"usage": int(cpu["cpu"] + .5),
"temp": int(proc_stats["cpu_temp"] + .5),
"memory": int(mem_pct + .5),
"flags": self.cache.throttled_state.get("bits", 0)
}
temp: Optional[float] = proc_stats["cpu_temp"]
if temp is not None:
cpu_data["temp"] = int(temp + .5)
diff = self._get_object_diff(cpu_data, self.cache.cpu_info)
if diff:
self.cache.cpu_info.update(cpu_data)