• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

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

User avatar
benji_19994
VIP - Donator
Posts: 156

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

Wed Nov 18, 2015 10:51 am

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);

Post Reply

Return to “General Discussion”