executeCommandLine not working

Hi, Im using this rules code

rule "TV"
when
      Item TV changed
then 


        if(TV.state == ON){
                exexuteCommandLine("/path/tvon.sh")
         }else{
                 executeCommandLine("/path/tvoff.sh")
         }
end

But when i click the switch, its not turning on
i did chmod +x on scripts and its still not working.
When i run it on normal command line it works. How to fix that?

Well, there’s a typo in that one.

If you look at other posts about having trouble with executeCommandLine(), you will see it is useful to look in your openhab.log and see if any errors are reported at run time.

If that does not help enough, checking the results can go further

var xresults = executeCommandLine((Duration.ofSeconds(10), "/path/tvoff.sh")
logInfo("test", "results " + xresults)

I think you’ll have to give the full path, though.

Results gives me “failed to open vchiq instance”

Fixed it by giving video permission to openhab user, thanks for your help :slight_smile:

1 Like