Kodi raspberry pi internal temperature

Post Reply
dakipro
Posts: 53
Joined: Thursday 17 December 2015 23:24
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Norway
Contact:

Kodi raspberry pi internal temperature

Post by dakipro » Wednesday 25 January 2017 0:26

Hi,
from time to time my Kodi gets a bit hot, so I would like to see its current temperature (or history) in domoticz. I can see the temperature by typing /opt/vc/bin/vcgencmd measure_temp in the console, but could this be somehow converted into a virtual sensor, or maybe integrated into the existing kodi integration?
Or is it already solved and I missed it?
Thanks!
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink

pvm
Posts: 952
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: NL
Contact:

Kodi raspberry pi internal temperature

Post by pvm » Wednesday 25 January 2017 0:31

You can install domoticz on it (as a slave device). Or create a script that parses the output of the command you mention and add it to a virtual sensor in domoticz with a json call
Synology NAS, PI3, ZWave, Xiamo zigbee devices, BTLE plant sensor

User avatar
Egregius
Posts: 2733
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Kodi raspberry pi internal temperature

Post by Egregius » Wednesday 25 January 2017 0:33

Buy the alu Kodi case. It acts as a heat shield.
Mine runs overclocked at 1350Mhz and doesn't go above 60 degrees Celsius.

dakipro
Posts: 53
Joined: Thursday 17 December 2015 23:24
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Norway
Contact:

Re: Kodi raspberry pi internal temperature

Post by dakipro » Thursday 26 January 2017 0:32

Thanks, I manage to google it and make it work somehow :)
I first made a virtual device that can be updated by calling the domoticz url directly

http://192.168.1.1:8080/json.htm?type=c ... &svalue=20

When I checked that the value is updated, I then used the python script I found on the google (changed it a bit)

Code: Select all

#!/usr/bin/python
import subprocess
import time
import os
import urllib2

serverIP = "192.168.1.1:8080"
deviceId = 1

currentTemp = subprocess.check_output(["/opt/vc/bin/vcgencmd","measure_temp"])
currentTemp = float(currentTemp.split("=")[1][:-3])
urllib2.urlopen("http://" + serverIP + "/json.htm?type=command&param=udevice&idx=" + str(deviceId) + "&nvalue=0&svalue=" + str(currentTemp))
(change your IP and your device id)

I saved the script in some "temperaturefordomoticz.py" file, somewhere on pi (I have my in /home/pi/ )
Then I called the script from command line like "python /home/pi/temperaturefordomoticz.py" to make sure that value is being sent to domoticz.

Then I made a cronjob that will send the temperature every 5 min with command
crontab -e

then at the bottom of the file I added
*/5 * * * * python /home/pi/temperaturefordomoticz.py

when you save file, you should see all cron jobs by typing "crontab -l" in command line
(more info on cron here https://debian-administration.org/artic ... _with_cron)
(Also note that Kodi osmc by default doesn't have a crontab installed by default, but can be easily installed either via osmc shop, or googling on how to add cron to raspberry)

I've added this on 3 Pi's I have, and they all work nice, I see them in the domoticz as temperature sensors :)

Hope someone finds this useful
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest