SSH to Openhab

Hello, I’ve openhab 2.4, RespberryPi 3+b , and I wanted to make a info panel that include RespberryPi temp/cpu I created a file that include both info in 1 file.
result for the command:
I want to create on my .item file a Number type, that include that info.
how can I do it?

Why don’t you use the systeminfo binding?:

1 Like

lol thank you , did not know about those bindings.

I’ts spam my logs, Can I change it , that it will not send info to my logs?

What messages are you talking about?
Something like:
2019-04-14 16:00:32.009 [vent.ItemStateChangedEvent] - CPU_Load changed from 2.2 to 1.9
is a normal log entry each time the value changes. You can define in the thing and channel settings how often that value is looked at.

1 Like

Yeah I know, ok, I see thank you.

I think I understand the way you want to go. To tinker with Scriptexecution, Transformation, Rules, etc. you have to do the following steps:

  1. Install Exec-Binding (2.x)

  2. Install Regex-Transformation-Service

  3. .things File like this:

Thing exec:command:cpu_temp "OH2-PI Temperatur" @ "Arbeitszimmer" 
					[command="/bin/bash /etc/openhab2/scripts/", interval=120, timeout=30, transform="REGEX((.*?))"]

The sequence of the value-lookup(logging) can tuned/fixed here as @opus said

  1. bash-Script in the scripts-Folder ( and look for correct owner and rights (chown and chmod) and that it’s executable
INPUT=$(/bin/cat /sys/class/thermal/thermal_zone0/temp)
TEMP=$(echo "scale=2; $INPUT / 1000" | bc)
echo $TEMP

  1. Items in your .items-File
Group  Chart_Sys_Temp (Home)
String CPU_Temp               "OH2_CPU Temp-String [%s °C]"         <temperature> (Chart_Sys_Temp)    { channel="exec:command:cpu_temp:output"}
Number CPU_Temp_num           "CPU-OH2-Pi Temperatur [%.1f °C]"     <temperature> (Chart_Sys_Temp)

  1. .rules File
rule "OpenhabPi Temperature String to Number"
    Item CPU_Temp changed
    CPU_Temp_num.postUpdate(Float::parseFloat(String::format("%s",CPU_Temp.state).replace(' ','')))

  1. .sitemap File
    Default item=CPU_Temp_num           valuecolor=[>=50="red",>=47="blue",>=45="orange",>=43="lime",>=40="teal",<4="silver"]

But if you want to use the more comfortable way, use the Systeminfo-Binding as @george.erhan explained.

Btw: If you don’t want to see every change of an item in the logger you can set the log in the Console from Info to Warning using the command

 log:set warn smarthome.event

as shown here: