21:04:55.653 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from UNINITIALIZED to INITIALIZING
21:04:55.665 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from INITIALIZING to ONLINE
21:05:00.263 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Switch_Bright_50' received command ON
21:05:00.289 [INFO ] [arthome.event.ItemStatePredictedEvent] - Switch_Bright_50 predicted to become ON
21:05:00.312 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from OFF to ON
21:05:00.327 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from NULL to ON
21:05:00.413 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from ON to OFF
21:05:00.426 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from ON to OFF
21:05:00.434 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_exit changed from NULL to 0
21:05:00.440 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_output changed from NULL to
21:05:00.447 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_lastexecution changed from NULL to 2019-05-22T21:05:00.414+0100
21:06:07.092 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from UNINITIALIZED to INITIALIZING
21:06:07.122 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from INITIALIZING to ONLINE
21:06:13.452 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Switch_Bright_50' received command ON
21:06:13.471 [INFO ] [arthome.event.ItemStatePredictedEvent] - Switch_Bright_50 predicted to become ON
21:06:13.490 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from OFF to ON
21:06:13.502 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from NULL to ON
21:06:13.595 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from ON to OFF
21:06:13.621 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from ON to OFF
21:06:13.638 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_exit changed from NULL to 1
21:06:13.650 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_output changed from NULL to 50: -c: line 0: unexpected EOF while looking for matching `''
50: -c: line 1: syntax error: unexpected end of file
50: -c: line 0: unexpected EOF while looking for matching `''
50: -c: line 1: syntax error: unexpected end of file
21:06:13.663 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_lastexecution changed from NULL to 2019-05-22T21:06:13.578+0100
21:53:47.914 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from UNINITIALIZED to INITIALIZING
21:53:47.952 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from INITIALIZING to ONLINE
21:53:55.764 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Switch_Bright_50' received command ON
21:53:55.783 [INFO ] [arthome.event.ItemStatePredictedEvent] - Switch_Bright_50 predicted to become ON
21:53:55.809 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from OFF to ON
21:53:55.833 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from NULL to ON
21:53:55.924 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from ON to OFF
21:53:56.008 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from ON to OFF
21:53:56.033 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_exit changed from NULL to 1
21:53:56.050 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_output changed from NULL to 50: -c: line 0: unexpected EOF while looking for matching `"'
50: -c: line 1: syntax error: unexpected end of file
50: -c: line 0: unexpected EOF while looking for matching `"'
50: -c: line 1: syntax error: unexpected end of file
21:53:56.066 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_lastexecution changed from NULL to 2019-05-22T21:53:55.914+0100
21:10:21.378 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from UNINITIALIZED to INITIALIZING
21:10:21.397 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'exec:command:brightness50' changed from INITIALIZING to ONLINE
21:10:29.162 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Switch_Bright_50' received command ON
21:10:29.184 [INFO ] [arthome.event.ItemStatePredictedEvent] - Switch_Bright_50 predicted to become ON
21:10:29.262 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from OFF to ON
21:10:29.280 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from NULL to ON
21:10:29.296 [INFO ] [smarthome.event.ItemStateChangedEvent] - Switch_Bright_50 changed from ON to OFF
21:10:29.308 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_run changed from ON to OFF
21:10:29.319 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_exit changed from NULL to 127
21:10:29.331 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_output changed from NULL to 50: “echo: command not found
50: “echo: command not found
21:10:29.342 [INFO ] [smarthome.event.ItemStateChangedEvent] - exec_command_brightness50_lastexecution changed from NULL to 2019-05-22T21:10:29.230+0100
I don’t use the Exec binding so I’m probably not going to be of much additional help. Often problems like this can be addressed by putting the commands in a shell script. You can also try to escape the quotes (i.e. \")+.
You need to replace the spaces with @@, it’s starting a new command before ‘echo’ because of the space
I did find a couple of bugs with the exec binding (don’t have them to hand) but for a simple command like that should be ok.
Failing that you could use a rule and executecommandline which doesn’t suffer from some of the bugs (see my rule file under the topic ‘lightwave binding updated’ for lots of examples). It also shows you the @@ syntax.
rule "Send command via rule"
when
Item ExecSwitch received command ON
then
executeCommandLine("sudo@@bash@@-c@@echo \"10\" >> /sys/class/backlight/rpi_backlight/brightness",5000)
end
I haven’t dabbled too much in it but from what I understand you can use the execute command line (exec v1) and remove the exec v2 thing and also the channel from your switch item (you’ll just end up with errors otherwise). Or you can try and integrate the syntax I showed you into the v2 thing and remove the execute command line rule
You should also be able to have the 10 or any other value as an input parameter in the exec v2 binding
When you execute a command from the command line, you are running in a shell and get to take advantage of all the features and capabilities built into that shell. You don’t have a full shell when you run from openHAB.
Often putting the command inside a shell script can address this.
Also make sure the Exec binding is configured correctly. You don’t present the full log line so I can’t tell what the error is coming from. It appears like it can’t find the xvfb-run command.
Thanks. So should I create a shell script which runs this command? I can’t really send you more logs, because there are no errors. This is what I just posted is the Output channel…
Well that is a pretty key piece of information. Then the error is coming from the command, not from the Exec binding.
I would try putting it in a shell script. If that doesn’t work all I can offer is to keep trying stuff. The Exec binding is one of the more challenging ones to get working correctly. You can replace the spaces with @@ for example. The double quotes might need to be escaped. There might be something else going on which is making it so that the openhab user cannot see the path to the command (e.g. running OH in Docker).
Hi! hm. unfortunately that does not work on a mac. the first command (adduser) is not supported by the mac bash-terminal. i’ll try to goolge my way to success once more
@rlkoshak So I have just revisited this as I wanted to migrate my exec v1 to exec v2 and I’ve found what the initial problem was:
When using the exec v2 thing if you have a header which has a space in then it doesn’t work.
For example:
-H Authorisation:Bearer Token
Now if I execute the same command in ssh and wrap it in apostrophes as so:
-H ‘Authorisation:Bearer Token’
Then it works
However this doesn’t work in the binding.
I’ve tried so many variations of wraps in quotes/apostrophes/escaped quotes/escaped apostrophes and also replacing the space with @@ but nothing works.
I don’t know how to file the issue or even find out why but with so many apis requiring authorisation like this now it’s stopping the exec binding from being utilised.
If anyone has come across this before and has a way of getting round it then it would be most appreciated.