Author Topic: using a script to launch scenarios  (Read 1006 times)

mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
using a script to launch scenarios
« on: April 15, 2014, 10:02:35 am »
I'd like to be able to trigger my predefined lighting and media scenarios with external scripts

I've read a bit about /usr/pluto/bin/MessageSend

but I'm not sure if that is what I am looking for or if that can only be used to update  status rather than make the events happen

can anyone offer me any advice on how this is best accomplished?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: using a script to launch scenarios
« Reply #1 on: April 15, 2014, 05:00:09 pm »
MessageSend can be used for what you want to do.

MessageSend can send ANY message that DCE can properly consume, this includes commands and events.

For what you want, you'll need the Execute Command Group message of the DCERouter device, passing it the PK_CommandGroup to execute (CommandGroups are the internal name for Scenarios).

-Thom

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3047
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: using a script to launch scenarios
« Reply #2 on: April 16, 2014, 09:50:23 am »
mikeybs,

easiest is: Watch dcerouter.log when you trigger the scenarios from the Orbiter. It will be two messagesend that you can use.

mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
Re: using a script to launch scenarios
« Reply #3 on: April 17, 2014, 08:06:12 am »
here is what I see when I click on one of my lighting scenarios in my web orbiter

it just shows the individual messages to each device, it doesn't show what command group was executed...

will I have to send messages to each device individually?

maybe I need to increase the verbosity of my logs in order to see command group information?


DCERouter.log
08   04/17/14 2:00:21.315      Received Message from 56 (myweb2orbiter / ) to 79 (Ceiling Lights / Home Theater), type 1 id 184 Command:Set Level, retry none, parameters: <0x7a18ab40>
08   04/17/14 2:00:21.315        Parameter 76(Level): 45 <0x7a18ab40>
08   04/17/14 2:00:21.317      Received Message from 56 (myweb2orbiter / ) to 78 (Daybed Lights / Home Theater), type 1 id 184 Command:Set Level, retry none, parameters: <0x7a18ab40>
08   04/17/14 2:00:21.317        Parameter 76(Level): 45 <0x7a18ab40>
08   04/17/14 2:00:21.319      Received Message from 56 (myweb2orbiter / ) to 81 (Lamp / Home Theater), type 1 id 184 Command:Set Level, retry none, parameters: <0x7a18ab40>
08   04/17/14 2:00:21.320        Parameter 76(Level): 50 <0x7a18ab40>
08   04/17/14 2:00:21.321      Received Message from 56 (myweb2orbiter / ) to 80 (Window Lights / Home Theater), type 1 id 184 Command:Set Level, retry none, parameters: <0x7a18ab40>
08   04/17/14 2:00:21.321        Parameter 76(Level): 45 <0x7a18ab40>


mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
Re: using a script to launch scenarios
« Reply #4 on: April 23, 2014, 08:10:59 am »
I'm having a hard time figuring out what the "Execute Command Group message of the DCERouter device" is...

I have found the PK_CommandGroup for all of the items in the CommandGroup table I am interested in.

There are so many tables dealing with devices/commands/command_groups, it is hard to figure out how to connect them all together.

I know that my DCERouter is device 2, but I am not sure how to get a list of the commands it is capable of and their IDs.

I have been able to successfully turn individual lights on/off using MessageSend using the information in dcerouter.log..  I just can't figure out how to execute the command groups.

Any help would be appreciated.  Thank you very much for the assistance provided so far. 

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3047
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: using a script to launch scenarios
« Reply #5 on: April 23, 2014, 08:32:08 am »
Welcome to the club of the seekers :-)

Go into web admin, change your view to the device list (left hand side bottom), and click on the DCERouter device. On the right hand you will find a small button 'Send Command' ... click it, and smile :)

mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
Re: using a script to launch scenarios
« Reply #6 on: April 23, 2014, 04:50:36 pm »
yay!  thank you so much posde

smile I did...

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3047
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: using a script to launch scenarios
« Reply #7 on: April 23, 2014, 10:28:52 pm »
Glad to be of help ... and to produce a smile :)

mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
Re: using a script to launch scenarios
« Reply #8 on: April 24, 2014, 07:21:56 am »
I'd like to be able to run MessageSend from another linux host.  I tried to just copy the binary to the other linux host, but when I try to run it I get:

./MessageSend
-bash: ./MessageSend: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory


Can I compile this on the other linux host without too much difficulty?

Right now I am using ssh keys to execute the MessageSend commands on the linuxmce core, but there is a delay while the ssh login takes place.... it would be nice to have the scenarios execute faster...

mikeybs

  • Veteran
  • ***
  • Posts: 74
    • View Profile
Re: using a script to launch scenarios
« Reply #9 on: April 24, 2014, 07:43:23 am »
figured it out myself... simple recipe

svn checkout http://svn.linuxmce.org/svn/trunk/src/
cd src/MessageSend
make

in case anyone else is interested....

thanks again for all the help... and the smiles :)