Feature/rpi power status (#147)

* rpi power status
This commit is contained in:
Masoko
2024-10-24 21:28:28 +03:00
committed by GitHub
parent 92363e65df
commit f23929f0a2

View File

@@ -94,18 +94,17 @@ def check_memory():
def check_rpi_power_status(): def check_rpi_power_status():
full_cmd = "vcgencmd get_throttled | awk -F= '{print $2}'" try:
power_status = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0] full_cmd = "vcgencmd get_throttled | cut -d= -f2"
throttled = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
if power_status: throttled = throttled.decode('utf-8').strip()
if power_status == "0x0":
power_status = "OK" if throttled == "0x0":
return "OK"
else: else:
power_status = "KO" return "KO"
else: except Exception as e:
power_status = "NA" return "Error: " + str(e)
return power_status
def check_cpu_temp(): def check_cpu_temp():