This page last changed on Jun 17, 2015 by niedejb.

Coming here for help as I have struggled to get a batch file to run from the Shell Execution Protocol portion of Openremote.

Full path: C:\\Users\\Public\\OpenRemote\\bin
lifx6.bat

Log file returns:
[DEBUG 2015-06-15 18:15:58,872 (Shell): Found cached ShellExe command with id: 568
DEBUG 2015-06-15 18:15:58,872 (Shell): Will start shell command: C:\\Users\\Public\\OpenRemote\\bin
lifx6.bat and use params: null]

I have restarted the machine running the controller per some of the search guidance with no luck.

The batch file runs with no issues when I open it via windows (executes the power toggle to the LIFX light), but it doesn't execute when I use openremote (I use a button in the design to trigger the command).

Batch file syntax:

[@echo off

echo curl "https://api.lifx.com/v1beta1/lights/all/toggle" -H "authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx" --data "selector=all" --compressed>fjaf3892ajofw3298a8.ps1
powershell.exe -ExecutionPolicy Bypass -File "fjaf3892ajofw3298a8.ps1"
del fjaf3892ajofw3298a8.ps1]

Struggling with what I'm missing here, but I feel like I'm close....any tips on what I'm doing wrong?

Thanks in advance,

Jeremy


command data.jpg (image/jpeg)
lifx6.jpg (image/jpeg)
bat.jpg (image/jpeg)

I think you must set a polling interval for this command to work

Posted by pz1 at Jun 17, 2015 07:55

I'm not a windows guru, but IMHO *bat file is not a correct program for executing. For similar task on a linux machine I put /bin/sh as Path: and shell script name as Command parameter:. Therefore, I think that for windows you should probably put cmd.exe, with whole path is you want to be sure, in the Path: and lifx6.bat as Command parameter.

Posted by aktur at Jun 17, 2015 09:56

In the past I did run .bat files with the shell execution protocol under Windows 7
(Example documented here)

Posted by pz1 at Jun 17, 2015 10:49

Set the polling interval to 500 with no luck...appreciate the help though.

Posted by niedejb at Jun 19, 2015 23:22

I changed the path to: C:\Users\Public\OpenRemote\webapps\controller\cmd.exe and the path to lifx.bat:

Log shows success (I guess...not really sure):

[DEBUG 2015-06-19 17:21:56,121 (Shell): Found cached ShellExe command with id: 568
DEBUG 2015-06-19 17:21:56,121 (Shell): Will start shell command: C:\Users\Public\OpenRemote\webapps\controller\cmd.exe and use params: lifx6.bat]

...But the batch file doesn't execute/toggle the light with the above set up either.

Any other tips?

Posted by niedejb at Jun 19, 2015 23:38

But the cmd.exe is a windows system program and its path should be somewhere in the system folder.

Posted by aktur at Jun 20, 2015 06:48

At the time, the Shell Execution protocol proved to be unreliable. (system hangs). So I did change to a cron scheduler. That is running fine for quite a while now.

Posted by pz1 at Jun 20, 2015 08:35

Back with a "fix":

Full path in the above:
C:\Users\Public\OpenRemote\bin\lifx6.bat

Confirmed that the .bat file MUST be in the "\OpenRemote\bin" folder or it will not work.

My issue turned out to be an issue with security certificate for the cURL command. Once I put the right cert in the above directory with curl.exe (which is called from my batch file) everything worked.

Posted by niedejb at Jul 12, 2015 01:36
Document generated by Confluence on Jun 05, 2016 09:33