No output - bash script calling C program via SSH

Platform information:

  • Hardware: Synology DS215j, 800MHz, 2 core, 512MB
  • OS: DSM 6.2.3-25426 Update 2
  • Java Runtime Environment: Java8 installed
  • openHAB version: 4.2.7

Issue of the topic:
What I want to do:

  • Create a weather station
  • Read data from a Raspberry Pi
  • Based on this tutorial: Source

What works so far:

  • basicaly everything except the display of the actual vaule

This is different to the turorial
Things configuration:

Thing exec:command:weatherstation_temperature "Temperatur" [command="ssh pi@ temp", transform="REGEX((.*?))", interval=60, timeout=10, autorun=true]
Thing exec:command:weatherstation_humidity "Luftfeuchtigkeit" [command="/volume1/SmartHome/openHAB/conf/scripts/",    transform="REGEX((.*?))", interval=60, timeout=10, autorun=true]

Tried two ways, one direct with ssh and one by using a bash script

out=$(ssh pi@ ./weatherSensor temp)
echo $out

So as I sad, all the Things, Items, Graphs are working, but the actual number (e.g. temperature) is not displayed.
If I execute the script by hand it will return the result (e.g. 22.17)

Sadly the log file has no recent entrys, and I was not able to figure out why it stopped filling it.

I hope I included all the information needed, otherwise please ask.

Thank you for your efforts.

Kind regards, nuTux

Whats your item configuration?

You only show the thing. However Things are not displayed in the sitemap. You have to link your things to items. However I assume you did that since you are saying that

For your items: Try a label transormation.As a example see my definition for a temperature item:

Number    RPi2Helper_Temperatur    "CPU Temperatur [%.1f °C]"   

Another idea is to get the measurements via a cronjob on the maschine you are executing the command on ( See this example:




    curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "$state" "http://$OHIP:8080/rest/items/$item/state"

state=$(vcgencmd measure_temp | sed 's/temp=//' | sed "s/'C//" )

cronjob which runs the script once per minute and sends the temp to the OH server:

pi@rpi2helper:~ $ crontab -l
* * * * * /home/pi/OpenHAB-Config/scripts/RPi2/Status\ an\ OpenHAB\ senden/

I recommend this method since you are not getting any errors if the OH server can’t connect to Furthermore you dont have to deal with SSH Keys. (I assume you have SSH Keys, right? Otherwise your implemented solution can’t work)

There is a space missing in the first thing between the IP and the command.
Are you sure that the ssh command is executed as it is being started as user openhab and needs to have the openhab public key iimported into authorized_keys of user pi while I assume that your manual test was executed as user pi.
Besides that the command is in the whitelist ?
Any error message in the openhab.log file ?

Ok so first of all, thats what I’m seeing.

Thats why I assume, that everything else is working (since I got all of it from a tutorial).

Is the time running the script not defined by the interval=60 command in the Thing?

So this is the item configuration

Group Weatherstation_Chart (System, Charts)
Number Weatherstation_Chart_Period "Periode" (System)
Number Weatherstation_Temperature "Temperatur [%.1f °C]" <temperature> (Weatherstation_Chart) 
Number Weatherstation_Humidity    "Luftfeuchtigkeit [%.1f %%]" <humidity> (Weatherstation_Chart)
Number Weatherstation_Pressure    "Luftdruck [%.1f hPa]" <pressure> (Weatherstation_Chart)
String temperature_out { channel="exec:command:weatherstation_temperature:output" }
String humidity_out    { channel="exec:command:weatherstation_humidity:output" }
String pressure_out    { channel="exec:command:weatherstation_pressure:output" }

This the rule

rule "Weatherstation Temperature"
		Item temperature_out received update
			( ( Float::parseFloat(temperature_out.state.toString) as Number ) * 10 ) / 10

rule "Weatherstation Humidity"
		Item humidity_out received update
			( ( Float::parseFloat(humidity_out.state.toString) as Number ) * 10 ) / 10
rule "Weatherstation Pressure"
		Item pressure_out received update
			( ( Float::parseFloat(pressure_out.state.toString) as Number ) * 10 ) / 10

As I said before, the log has no entries since yesterday… could I have turned it off accidentally?

Where can I check the whitlist of the command?


  • the space was a copy error, sorry
  • yes the ssh keys are working
  • files are owned by openhab user and ar executable

Regards nuTux

The whitelist is the file /etc/openhab2/misc/exec.whitelist
In case there is no entry for your command in the whitelist and no entry in the log file then it looks like the command is not executed.

Ok, so I found the log file which is updated regularly.
It seems that on the synology install, the whole folder structure is quite different…

2020-11-17 22:52:26.448 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute '/volume1/SmartHome/openHAB/conf/scripts/', but it is not contained in whitelist.
2020-11-17 22:52:26.449 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute '', but it is not contained in whitelist.
2020-11-17 22:52:26.488 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'ssh pi@ ./weatherSensor temp', but it is not contained in whitelist.

So it is a problem with the white liste.

Now I just need to find the misc folder…

You also may try to add the path to the executable ( ssh ) in the exec command line as well as in the bash script. This would help in case the exec environment does not have a search path included.

I would expect it next to the items, things folder.

Hm, there was nothing… so I created it.

But I couldn’t find any information about how this whitlist file is organized…

to I just add the command


path to command


full command

ssh pi@ ./weatherStation temp

so it is. for security reasons there is no default content / file available.

The documentation of the binding at the top in the binding-configuration section


For security reasons all commands need to be whitelisted. Allowed commands need to be added to the misc/exec.whitelist file in the configuration directory. Every command needs to be on a separate line.


/bin/echo “Hello world!”
/usr/local/bin/apcaccess status
php ./configurations/scripts/script.php %2$s

Linux: Note that the commands are executed in the context and with the privileges of the process running the Java Virtual Machine. On a Linux system the system user openhab needs to have the privileges needed to execute your intended command. It is advised to test the correct operation of the command in the scope of the openhab user on the command line first:

sudo -u openhab

It is not advised to run the virtual machine as superuser/root.

I think it can’t be more complete and it is in the right place - the doc of the binding. Even not necessary to search in the forum which also delivers a set of hits:

Could be that you didn’t find anything in case you misspelled ( missing e ) it

Hm ok, so I thought it didn’t work with the examples which were provided in the doc…

The log file always tells me

Tried to execute '/bin/echo '42.2'', but it is not contained in whitelist.

So could it be that on the Syonology install the directories are different?
Is there a way to find out where it looks for the whiteliste file?

I know placed the misc folder in the conf folder which seems to make sense, but all the commands I tried it told me that it was not present in the whiteliste…

/bin/ssh pi@ ./weatherSensor temp
/bin/echo '42.2'

I thought the echo example should work, but not even that…

What is the path of the directory where you put your rules into ?
What is the path of the directory where you put the exec.whitelist into ?

So rules are:

and whiteliste


I would expect that this fine.
How did you create, edit the file ? Did you create/edit it with a windows editor or in a linux environment ? Could be that it is a problem of line feeds/carriage return which are different / depending on the OS.

I created it, logged in as the user which will execute it (openhab). Directly with vim on the linux system (synology NAS). So I think that should be fine…