Announcement

Collapse
No announcement yet.

Feature Request: Read Raspberry Pi Temperatures

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Feature Request: Read Raspberry Pi Temperatures

    It would be really nice if we could read the temperatures from any RPi that RaspberryIO is running on. It seems that this should be relatively easy to include into the existing plugin. I would suggest that if you add this you also allow the user to specify either degrees F or C.

    Reading temps is quite easy especially from the bash level but it's also easy to read directly from the hardware. Here is an example of the code to read the temps at the bash level.

    Code:
    #!/bin/bash
    gpu=$(/opt/vc/bin/vcgencmd measure_temp | awk -F "[=\']" '{print $2}')
    cpu=$(</sys/class/thermal/thermal_zone0/temp)
    cpu=$(echo "$cpu / 100 * 0.1" | bc)
    cpuf=$(echo "(1.8 * $cpu) + 32" |bc)
    gpuf=$(echo "(1.8 * $gpu) + 32" |bc)
    echo "$(date) @ $(hostname)"
    echo "-------------------------------------------"
    echo "GPU => $gpu'C ($gpuf'F)"
    echo "CPU => $cpu'C ($cpuf'F)"
    For now I'm using MQTT to read this but for most users it would be much simpler to be able to get it through RaspberryIO if they are already using it.
    HomeSeer Version: HS3 Standard Edition 3.0.0.548
    Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    Number of Devices: 484 | Number of Events: 776

    Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
    3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
    4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
    3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

    Z-Net version: 1.0.23 for Inclusion Nodes
    SmartStick+: 6.04 (ZDK 6.81.3) on Server

    #2
    Originally posted by Timon View Post
    It would be really nice if we could read the temperatures from any RPi that RaspberryIO is running on. It seems that this should be relatively easy to include into the existing plugin. I would suggest that if you add this you also allow the user to specify either degrees F or C.

    Reading temps is quite easy especially from the bash level but it's also easy to read directly from the hardware. Here is an example of the code to read the temps at the bash level.

    Code:
    #!/bin/bash
    gpu=$(/opt/vc/bin/vcgencmd measure_temp | awk -F "[=\']" '{print $2}')
    cpu=$(/class/thermal/thermal_zone0/temp)
    cpu=$(echo "$cpu / 100 * 0.1" | bc)
    cpuf=$(echo "(1.8 * $cpu) + 32" |bc)
    gpuf=$(echo "(1.8 * $gpu) + 32" |bc)
    echo "$(date) @ $(hostname)"
    echo "-------------------------------------------"
    echo "GPU => $gpu'C ($gpuf'F)"
    echo "CPU => $cpu'C ($cpuf'F)"
    For now I'm using MQTT to read this but for most users it would be much simpler to be able to get it through RaspberryIO if they are already using it.
    Is this CPU temp or some kind of ambient temp on the Pi? Can't imagine the latter would be accurate with the CPU nearby and the Pi often inside some enclosure.

    Sent from my SM-N975U1 using Tapatalk

    Comment


      #3
      These are the CPU temps. The only way to get ambient temperatures is to add a sensor off of the I2C ports. That would also be nice but it would require a more open interface on RaspberryIO. At that point moving to MQTT is a more open interface to use.
      HomeSeer Version: HS3 Standard Edition 3.0.0.548
      Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
      Number of Devices: 484 | Number of Events: 776

      Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
      3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
      4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
      3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

      Z-Net version: 1.0.23 for Inclusion Nodes
      SmartStick+: 6.04 (ZDK 6.81.3) on Server

      Comment

      Working...
      X