Skip to content

Commit

Permalink
fix cpu temp decimal point (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjelev authored Oct 21, 2024
1 parent 11ab4b6 commit c0dd655
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rpi-cpu2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def check_memory():


def check_cpu_temp():
full_cmd = "cat /sys/class/thermal/thermal_zone*/temp 2> /dev/null | sed 's/\\(.\\)..$//' | tail -n 1"
full_cmd = "awk '{printf (\"%.2f\\n\", $1/1000); }' $(for zone in /sys/class/thermal/thermal_zone*/; do grep -iq \"cpu\" \"${zone}type\" && echo \"${zone}temp\"; done)"
try:
p = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
cpu_temp = p.decode("utf-8").strip()
Expand Down

0 comments on commit c0dd655

Please sign in to comment.