I would like to ask you to be a bit more precise, because I’ve followed your commands, but I have no value shown on my sitemap. Alltrough, I’m a really beginner, so it could be, that I’ve made a mistake…
For example, where should I put the .js file? I’ve made a new JS file in the transforms folder…
It should work. I have not tested it yet myself. However, the exec commands depend on your RPi so those should still work. You can test these from a regular command line first. Both transformations should work as well.
If you need help, please post your confit in the forums and I will see what I can do.
For your information. The new Systeminfo binding also supports CPU temperature. I have only tested this binding with my Mac and not yet with the RPi. But this could be a more sustainable implementation.
I tested the new systeminfo binding, it displays 0° as well. I think is related to the RPi & maybe access rights? I’m using a RPi 3 with Jessie.
Both Linux commands $ cat /sys/class/thermal/thermal_zone0/temp and $ /opt/vc/bin/vcgencmd measure_temp are working and I also added the openhab user to the video group.
And. Have you tried warching the event log? I am aware that the new basic UI has issues with refreshing. Refreshing the browser might help. Or try the classic UI.
Could you please copy your item and sitemap definitions in the thread?
The first thing I noticed was the missing transformation. As far as I
know, you should Always add one; at least a REGEX that matches the
complete contents.
Please try
Number System_Temperature_CPU "Temperature CPU [%.1f C]" <temperature> (System_Temperature_Chart) { exec="<[cat /sys/class/thermal/thermal_zone0/temp:10000:REGEX((.*?))]"
I got it working. I switched on debug log for the exec binding and noticed it does not log anything. I uninstalled the binding, restarted OH and installed the binding again. Fixed.
Hey, rtvb. I see you got that working. I followed your steps but no success on my rpi temperature displaying. Could you give a clue? I did the exect same thing as you mentioned (using the .js file on tranformation). I also tried the first item config you posted (the one with REGEX). I tried the vcgencmd measure_temp command from Raspian. Don t I have to configure a .thing file? Could you help me?
You don’t need a thing if you use the exec1 binding.
Are you sure the vcgencmd command is working on the command line?
If so, and it is not working in openHAB, it might be a permissions issue.
The openHAB user (depending on your installation, but probably is openhab.
That user should be a member of the video group (as per my wiki item).
Can you confirm this?
Tks for the reply. VCGENCMD command is working on command line - when I type vcgencmd measure_temp I get the following return temp=48.3 C. About the permission, when i type getent group video as you suggested I get the following return video:x:44:openhabian.
$ vcgencmd measure_temp
temp=49.4'C
getent group video
video:x:44:openhabian
My sitemap file looks like this:
Frame {
Text item=CPU_Temp
So far, I`ve tried the following item lines under the CPU_Temp.items file:
Number CPU_Temp "Temperature CPU [%.1f °C]" <temperature> (System_Temperature_Chart) { exec="<[cat /sys/class/thermal/thermal_zone0/temp:10000]" }
String CPU_Temp "Temperature CPU [%.1f °C]" <temperature> (System_Temperature_Chart) { exec="<[cat /sys/class/thermal/thermal_zone0/temp:10000]" }
String CPU_Temp "Temperature CPU [%.1f °C]" <temperature> (System_Temperature_Chart) { exec="<[cat vcgencmd measure_temp" }
Number CPU_Temp "Temperature CPU [%.1f °C]" <temperature> (System_Temperature_Chart) { exec="<[cat vcgencmd measure_temp" }
I`d appreciate if you could give me a hand here. Thanks in advance for your help!
rtvb, sorry for my late reply, had some other issues to solve. I still have problemas with my CPU Temperature. But different behavior - now I get “- °C” on sitemap. It follows my files to your evaluation, if possible. Thank you once again!
CPU_Temp.items:
Number CPU_Temp "Temperature CPU [%.1f °C]" <temperature> { exec="<[cat /sys/class/thermal/thermal_zone0/temp:10000:REGEX((.*?))]" }
demo.sitemap:
Text item=CPU_Temp icon="temperature"
Didn’t paste the milli.js, becaues I am using the REGEX transformation. There is no need for REGEX transofrmsation file?
As I mentioned before, openhab and openhabian are both on video group.
Sorry for some dumb question, I am rookie to programming and Openhab as well.
Unfortunately I have the same problem.
No matter what I adjust I get the CPU temperature from my Raspberry not spent in Openhab.
I have tried different methods but without success.
Items:
Number System_Temperature_CPU "CPU temperatuur [%.1f °C]" <temperature> (System) {exec="<[cat /sys/class/thermal/thermal_zone0/temp:30000:JS(milli.js)]" }
Number System_Temperature_CPU02 "CPU temperatuur [%.1f °C]" <temperature> (System) {exec="<[cat /sys/class/thermal/thermal_zone0/temp]" }
Number CPU_Temp "Temperature CPU [%.1f °C]" <temperature> (System_Temperature_Chart) {exec="<[cat /sys/class/thermal/thermal_zone0/temp:10000:REGEX((.*?))]" }
Sitemap:
Frame label="Raspberry"
{
Text item=System_Temperature_CPU
Text item=System_Temperature_CPU02
Text item=CPU_Temp
}
milli.js in transform folder
(function(i){ return i / 1000; })(input)
Exec Binding 2.0.0 is installed.
How can I test if the exec binding works at all?
This is the output on my sitemap: CPU temperatuur - °C
In the console with “cat /sys/class/thermal/thermal_zone0/temp” the temperature is displayed to me.
I have add the user openhab and openhabian to the video group.
Has anyone a solution for me to solve the problem?