OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Interval Website & CPU Temp

This topic contains 2 replies, has 0 voices, and was last updated by  Samer 6 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22540

    doczaius
    Member

    A comment on my pictures/post of my installation from mrburns42 regarding temperature extremes prompted me to add some code to the interval program home page to display the CPU temp as a just-in-case/visibility measure. This is the first time I’ve ever touched Python so forgive any amateurishness and please post any improvements.

    Added to ospi.py under Function Definitions:

    def getCPUtemperature():
    res = os.popen('vcgencmd measure_temp').readline()
    return(res.replace("temp=","").replace("'Cn",""))

    Added to ospi.py under Class definitions, home, Get(self):

     homepg += 'n'

    Modified home.js:

    w("Device Time: "+datestr(devt*1000)+"
    ");
    w("CPU Temp: "+(cputemp)+"
    ");

    This displays the temp in Fahrenheit (you can see the calculation above converting from Celcius). A potential expansion/improvement would be to add a setting in options F or C and then of course, display the temp value based on that setting.

    #24853

    virtus
    Participant

    This is a great addition! I hope they merge it. I’d be interested in some logging as well so we can get a better picture of temperature and trends throughout the day/week.

    #24854

    Samer
    Keymaster

    If you are interested in graphing of the CPU temp I highly suggest you explore options such as Cacti. They are wonderful with dealing with this information. You can install Cacti right on the Raspberry Pi or you can have another server do Cacti and use SNMP to poll the RPi.

    By the way, the solution you came up with is awesome!

    #24852

    mattguy
    Member

    I am using salbahra’s awesome web interface, so since my rPi has php on it I made some additions to his code to allow me to have custom pages….one of them being a stats page. Check out my screenshot of the stats –

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Interval Website & CPU Temp