Get the temputre of a raspberry pi and send a ifft trigger

Get together and talk about everything Pi.
1 post Page 1 of 1
Contributors
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

a simple python script to send the raspberrys pi CPU temperature to ifft
Code: Select all
import os
import json
import requests
import time
def getCPUtemperature():

        res = os.popen('vcgencmd measure_temp').readline()
        return(res.replace("temp=","").replace("'C\n",""))

def GetCpuFrequency():
        res = os.popen('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_fr$
        return res

def SendNotificationToDevice():
        temp = float(getCPUtemperature())
        url     = 'https://maker.ifttt.com/trigger/Comp_data/with/key/cMCErA1-M$
        payload = {'value1' : temp }
        headers = {}
        res = requests.post(url, data=payload, headers=headers)
temp = float(getCPUtemperature())
CyrrentCPUFreq = GetCpuFrequency()

print('Current CPU Temp');
print(temp);
1 post Page 1 of 1
Return to “General Discussion”