hjelev / rpi-mqtt-monitor

Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server.
GNU General Public License v3.0
187 stars 43 forks source link

Some more Device_Classes and two digit CPU_Temp #140

Closed amse2000 closed 1 month ago

amse2000 commented 1 month ago

I just added some more device_classes and changed the way to resolve CPU-Temperature, this works on my Raspi 3 Model B (locale DE) maybe this solves #132 Please check on different systems/hardware.

hjelev commented 1 month ago

The cpu temp command don't work properly under Ubuntu, It returns many values like this: awk '{printf ("%.2f",$1/1000); }' /sys/class/thermal/thermal_zone*/temp
57.0020.0026.8526.8526.8526.8560.0060.00

I'll do a fix for the cpu temp - based on your idea, that works with Ubuntu, pls submit this PR w/o it.

amse2000 commented 1 month ago

Your fix is also running on my pi: awk '{ printf ("%.2f\n", $1/1000); }' $(for zone in /sys/class/thermal/thermal_zone*/; do grep -iq "cpu" "${zone}type" && echo "${zone}temp"; done) 54.77