From dddd968f82bf31155e295c170ebcce060d8d2cf9 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Wed, 15 Nov 2023 17:40:09 -0500 Subject: [PATCH] simplyprint: unknown temperature fix Omit temperature data for SBCs that Moonraker cannot report. Signed-off-by: Eric Callahan --- moonraker/components/simplyprint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/moonraker/components/simplyprint.py b/moonraker/components/simplyprint.py index a30d7ef..41732a6 100644 --- a/moonraker/components/simplyprint.py +++ b/moonraker/components/simplyprint.py @@ -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)