From 4f641182305ea4f76463c06fcba3a4046181dc19 Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Thu, 29 Dec 2022 16:28:40 +0000 Subject: [PATCH] Honour main allsky settings for temperature unit --- allsky_pistatus/allsky_pistatus.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/allsky_pistatus/allsky_pistatus.py b/allsky_pistatus/allsky_pistatus.py index 6dc8ca3..55cc267 100644 --- a/allsky_pistatus/allsky_pistatus.py +++ b/allsky_pistatus/allsky_pistatus.py @@ -85,7 +85,18 @@ def pistatus(params, event): vcgm = Vcgencmd() temp = vcgm.measure_temp() - data['AS_CPUTEMP'] = str(temp) + temp = round(temp,1) + tempUnits = s.getSetting("temptype") + if tempUnits == 'B': + data['AS_CPUTEMP_C'] = str(temp) + temp = (temp * (9/5)) + 32 + temp = round(temp,1) + data['AS_CPUTEMP_F'] = str(temp) + else: + if tempUnits == 'F': + temp = (temp * (9/5)) + 32 + temp = round(temp,1) + data['AS_CPUTEMP'] = str(temp) throttled = vcgm.get_throttled() data['AS_THROTTLEDBINARY'] = str(throttled['raw_data'])