Why doesn't Shell execution protocol pass a parameter to raspbian?

26 views
Skip to first unread message

Gary

unread,
Feb 20, 2018, 1:30:51 AM2/20/18
to OpenRemote
Hello...

Here's my setup and sequence of events:

Command:
        Name:              runShell
        Protocol:          Shell execution protocol
        Path:                /home/pi/openremote/bin/ech.sh
        Command       abcd
          parameter:

Button:
        Command:           runShell

Script in /home/pi/openremote/bin/ech.sh :

                #!/bin/sh
                echo "param $1" >> /home/pi/echout
                date >> /home/pi/echout

Run:
        First, one local execution:

                ./openremote/bin/ech.sh wxyz

        Then, three taps on the iPod's button:

                tap tap tap

Results in file echout:

        param wxyz
        Mon Feb 19 22:02:32 PST 2018
        param 
        Mon Feb 19 22:03:24 PST 2018
        param 
        Mon Feb 19 22:03:29 PST 2018
        param 
        Mon Feb 19 22:03:32 PST 2018


Why didn't Shell execution protocol pass  abcd  ???

73,
  Gary

Gary

unread,
Feb 20, 2018, 1:43:45 AM2/20/18
to OpenRemote
*UPDATE*  It works as advertised after a reboot!    Is there a fix in the works?  73, Gary

Stuart Hanlon

unread,
Feb 20, 2018, 2:34:52 AM2/20/18
to openremot...@googlegroups.com
Hi

I don't know if this helps our hinders...

I struggled to get the shell execution command to work, until I put a dummy sensor in.

This is a setup I use in a couple of machines


https://groups.google.com/forum/m/#!topic/openremotecommunity/OoHpROaS8As



##### Excerpt######


Please create a command in designer that looks like this :-

Command name :-

csvmaker

Protocol :-

Shell execution protocol

path :-

#### Note that the path must be the exact path from root to the csvmaker.sh script file.

#### WITHOUT a preceding "."

#### Your path may differ from what is shown here

/opt/OpenRemote-Controller/webapps/jscanvas/csvmaker.sh

command :-

--value=${param}


Polling Interval ;- BLANK


Regular Expression :- BLANK

Sensor name :- (I found I have to create a custom sensor for this to work, which I called "Dummy")

Dummy


Michal Rutka

unread,
Feb 20, 2018, 4:35:19 AM2/20/18
to Stuart Hanlon, OpenRemote
The shell execution protocol has a bug, which causes that after update of the command from the designer the controller needs a cold reboot. This is very old bug, but still there obviously.

Kind regards,
Michal Rutka

> On 20 Feb 2018, at 08:34, Stuart Hanlon <stu...@mdar.co.uk> wrote:
>
> Hi
>
> I don't know if this helps our hinders...
>
> I struggled to get the shell execution command to work, until I put a dummy sensor in.
>
> This is a setup I use in a couple of machines
>
>
> https://groups.google.com/forum/m/#!topic/openremotecommunity/OoHpROaS8As
>
>
>
> me
> Hello Olivier,
>
> Sorry it has taken me a few days to reply, I've been busy working on a client's project.
>
> I'm really hoping that you can get up and running with this simple CanvasJS based solution really quickly.
>
> I'll assume you are running a Linux based OS for your controller.... If you are running a Windows based system then you will have to modify the csvmaker.sh file to turn it into a compatible BATCH (.bat) file. I'm sure it can be done, but I don't know how. Maybe someone else can advise?
>
>
> There are a few steps to follow to get this working.
>
> You need a catch-all command in OpenRemote that a rule can send all the harvested data to, which in turn will pass the data to the Linux script file for conversion into appended csv files.
> (For some reason I needed to map that command to a dummy custom sensor before it worked)
>
> Sensors that produce numeric values, that have been named with the suffix .graph
>
> Custom sensors can be used to map text entries to numeric values.
> For example, I have Velbus devices that produce text outputs like "pressed" & "released"
> I create custom sensors that map these to values.
> 10 = pressed
> 0 = released
>
> A rule to catch all sensors with .graph at the end and push the data to the OpenRemote command.
>
>
> First of all, I suggest that you download and unzip the this file into your webapps folder and test that you can access the graphs that it will create,
>
> your finished webapps folder should have :-
>
> controller
> webconsole
> jscanvas
>
>
>
> Using a web browser, navigate to " http://{controller address}:8688/jscanvas "
>
> You should see a simple 2 frame web page with a selection of graphs, produced from the CSV data. Similar to the PDF file attached,.
>
>
> Once you have confirmed you can access the graphs, double check that the two script files within your jscanvas folder have their executable bits set.
>
> chmod +x csvmaker.sh
>
>
> chmod +x zipcsv.sh
>
>
>
> you can test the csvmaker.sh script works correctly by using this command line instruction
>
>
> ./csvmaker.sh --value=12345 --file=test
>
> You should now have a file in the csv folder called test.csv with a single line in it that has the time and date you actioned the script, a comma and the value 12345
>
> Now copy the jscanvas_v1.drl file into your rules folder, so that when your controller restarts it will add the rule to the knowledge base.
> ../../webapps/controller/rules
>
>
>
> The next part is to get OpenRemote to pass data.
>
> Please create a command in designer that looks like this :-
>
>
>
>
>
> Command name :-
>
> csvmaker
>
> Protocol :-
>
> Shell execution protocol
>
> path :-
>
> #### Note that the path must be the exact path from root to the csvmaker.sh script file.
>
> #### WITHOUT a preceding "."
>
> #### Your path may differ from what is shown here
>
>
>
> /opt/OpenRemote-Controller/webapps/jscanvas/csvmaker.sh
>
>
>
> command :-
>
> --value=${param}
>
>
>
>
> Polling Interval ;- BLANK
>
>
> Regular Expression :- BLANK
>
>
>
> Sensor name :- (I found I have to create a custom sensor for this to work, which I called "Dummy")
>
> Dummy
>
>
> Just because I did, please create a custom sensor names Dummy and link it to the csvmaker command that you created.
>
> --
> You received this message because you are subscribed to the Google Groups "OpenRemote" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openremotecommu...@googlegroups.com.
> Visit this group at https://groups.google.com/group/openremotecommunity.
> To view this discussion on the web visit https://groups.google.com/d/msgid/openremotecommunity/5abe1c0f-19d2-4995-bcf1-60549992b521%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages