There is a new requirement for the exec bindging in OH 2.5.2 for a whitelist. I followed the instructions in the binding documentation, but I’m still getting an error.
2020-03-07 14:33:34.234 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'c:\apcupsd\bin\apcaccess -u', but it is not contained in whitelist.
My file exec.whitelist looks like this:
c:\apcupsd\bin\apcaccess -u
Perhaps I misunderstood what was meant by this:
Allowed commands need to be added to the misc/exec.whitelist file in the configuration directory
I placed the file at C:\openHAB2\conf\misc\exec.whitelist
no worries, come back if you can’t get it to work
seems like most folks have an issue with incorrect encoding or saving the file in a different editor to fix LF CR end of line stuff
I trued grabbing the latest jar file for exec, from here https://openhab.jfrog.io/openhab/webapp/#/builds/openHAB2.5.x-Addons/53/1582137534002/published%20/org.openhab.addons.bundles:org.openhab.binding.exec:2.5.2-SNAPSHOT. (I tried the latest one for 2.5.3, and had the same issue as below, so I tried this one since it’s the newest one I could find for 2.5.2.)
It’s throwing an error with a long stack trace, starting with
2020-03-07 16:18:15.378 [ERROR] [org.openhab.binding.exec ] - bundle org.openhab.binding.exec:2.5.2.202002191846 (258)[org.openhab.binding.exec.internal.ExecHandlerFactory(264)] : Error during instantiation of the implementation object
java.lang.IllegalArgumentException: argument type mismatch
Interesting what you said about line endings … I’m in Windoze using VS Code. I’ll look into that. The “touch” fix isn’t helping me. I’m wondering if it’s an issue with the backslashed windows path? Maybe messing up a string comparison?
ummm from what I’ve read you need to enter the commands exactly as they would run in the console (terminal) but the line end thing is usually file made on windows (or with windows editor) then run on Pi but this is OpenHAB installed on Windows correct? But hidden characters at the end of the lines such as carriage returns or new line characters (which are hidden usually) mess things up
Have you ever used notepad++
with it you can see the hidden character and there is a windows version (free software btw)
also spaces at line ends have caused some problems I think
Anyhow… are you sure the bidding is loaded and running, the error almost looks like the binding failing to load… not sure
Also, having to touch the file after start up as been fix already in newest builds
I sorted out the line ending thing. Honestly, I’m not sure if that was it, but I completely replaced the file and it seems to be OK now. I can edit it from VS Code, and it doesn’t seem to matter if my line endings are set to CRLF or just LF. And yes, I’m runing on Windows.
I have had no luck installing the latest jar file; still getting lots of errors in the log. I just wish I didn’t have to remember to touch that whitelist file every time i restart OH.
A simple way I used on my installation to allow everything I have:
# create dir in case it does not exist
mkdir -p /etc/openhab2/misc
# populate whitelist
grep exec /etc/openhab2/things/* |
grep command= |
sed 's/.*command="\(.*\)".*/\1/' > /etc/openhab2/misc/exec.whitelist
# make sure openhab owns the file
chown -R openhab:openhab /etc/openhab2/misc/
Works if you have all your exec things configured in *.things-files and exec like this: