Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: macro/trigger to xlobby with xsend? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
ficklma1
Groupie
Groupie


Joined: December 08 2007
Location: United States
Online Status: Offline
Posts: 59
Posted: December 26 2007 at 11:10 | IP Logged Quote ficklma1

I have a programming/how to question. How do I set up a trigger and/or macro to trigger when any change to an Insteon device changes and send a command (xsend.exe) with parameters? I know how to do the xsend part from the command line. I just don't know how to integrate it in with a trigger/macro. Also, I'd need to pass the device(id?) or some identifier as a parameter to the xsend.exe, since each button in xlobby is assigned to a different device. I've seen some trigger information posted about a "Insteon Device Chg", but what is the best way to have this send specific device(info) with a xsend.exe command?

Thanks for all of your help.

By the way PowerHome is really cool, I just need to learn/understand the "programming" side more.
Back to Top View ficklma1's Profile Search for other posts by ficklma1
 
cmhardwick
Senior Member
Senior Member
Avatar

Joined: July 08 2006
Location: United States
Online Status: Offline
Posts: 290
Posted: December 26 2007 at 13:16 | IP Logged Quote cmhardwick

Welcome to the PH/xLobby combo I do this myself, even updating the level if it's not full on or off. I'll send you the basis for what I use and you can take it from there. I will post sometime tonight.

__________________
Cicero, Enjoying automation!
Back to Top View cmhardwick's Profile Search for other posts by cmhardwick Visit cmhardwick's Homepage
 
ficklma1
Groupie
Groupie


Joined: December 08 2007
Location: United States
Online Status: Offline
Posts: 59
Posted: December 26 2007 at 14:47 | IP Logged Quote ficklma1

Thank you.
I've added a socketserver.dll to an xlobby plugin, this is the fastes way I could get PH to react to button presses within xlobby. I tried the PH socket command line call from xlobby, but I think the shell to the command line was taking too long, otherwise I would have just used that. I have a semi-working socket server working as a xlobby plugin, very similar to xsend, I just can't seem to get it to not tie up the xlobby session.

FYI...I've been using xlobby for about 3 years now. I'm currently using the last stable "free" version and I'm pleased with the results. I'm currently using some modified PNG graphics from the xface MediaPortal program that has created some really good looking screens. My lighting buttons are black(shiny) and have a blue LED that toggles when I turn my Insteon lights on. I originally used a homegrown SDM socket server to communicate with the PLC, then discovered PH. Wow, all I can say is that PH is one powerful piece of software and I'm only really just scratching the surface, but hoping to get better at triggers, macros, formulas.

Thanks again for your help.

Edited by ficklma1 - December 26 2007 at 14:50
Back to Top View ficklma1's Profile Search for other posts by ficklma1
 
cmhardwick
Senior Member
Senior Member
Avatar

Joined: July 08 2006
Location: United States
Online Status: Offline
Posts: 290
Posted: December 26 2007 at 15:48 | IP Logged Quote cmhardwick

There's probably a better way to work the macros I use, but they work for me

So you are using a xLobby pluggin to send the PH commands directly instead of the command line? is this on the same machine or another machine? I might be interested in that, as some others on xLobby's site might be hehehe. See, now you've started it, opening a whole can of worms . I'm assuming the toggles are handled by button states, correct? such as On and Off states? That's what my macros use, the set button state command for on/off. I use another macro to query the level and if it's not 100% or 0%, it sets text on button showing the level. That's just for me.

__________________
Cicero, Enjoying automation!
Back to Top View cmhardwick's Profile Search for other posts by cmhardwick Visit cmhardwick's Homepage
 
ficklma1
Groupie
Groupie


Joined: December 08 2007
Location: United States
Online Status: Offline
Posts: 59
Posted: December 26 2007 at 20:00 | IP Logged Quote ficklma1

I'm communicating with PH on a different machine. Not sure who had the socketserver.dll here(was it you?), but I incorporated it in a modified xscriptNG plugin. You may be using that plugin already. If not, it's pretty cool. It will let you add either a c# or vb.net script files that can execute xlobby ommands(as well as others, if you incorporate dll's etc.) from within xlobby.

Do you have some macros/trigger/formula example you can share to help me incorporate when an Insteon device is turned on/off via a switch, that will use xsend to update xlobby?
Back to Top View ficklma1's Profile Search for other posts by ficklma1
 
cmhardwick
Senior Member
Senior Member
Avatar

Joined: July 08 2006
Location: United States
Online Status: Offline
Posts: 290
Posted: December 26 2007 at 21:57 | IP Logged Quote cmhardwick

My macro uses the ph_ssrequest and the DCC client from Powerhome (client installed on the xLobby machine) to recieve the command and execute the xsend command.

Here's the information that should help you. The macro can be edited, etc, of course
Code:
trigger:
Action Type: Macro
Action: XLOBBY STAT (name of your macro)
Trigger Type: Insteon Device Chg
Trigger ID: (ALL)
Trigger ID Number: 1
Trigger Value: (Any)
Boolean:[LOCAL9]<>[LOCAL10] (only fires when status actually changes, not just an ACK or other response)

macro:
if ("[LOCAL8]" = "xx.xx.xx",(
if("[LOCAL10]" = "0", (
   ph_ssrequest("###.###.###.###",8500,"xxxxx x","xxxxxx","FORMU LA","ph_run('C:\xsend.exe ~~"command:xlobby:button state set:Garage:Off~~"')")
), (
   ph_ssrequest("###.###.###.###",8500,"xxxxx x","xxxxxx","FORMU LA","ph_run('C:\xsend.exe ~~"command:xlobby:button state set:Garage:On~~"')")))
),"Kitchen")

(forum is adding a space in the word "FORMULA", be sure to remove it.)
Checks local8 which is the address of the switch, if it's the right switch, then it checks local10 which is the level. If it's 0, then it executes the ph_ssrequest to my xLobby server, port 8500 (default) my PH socket server name and password (in quotes, plain text), type of FORMULA (only valid option) then ph_run and the command to change the state to Off, otherwise (not 0) then set it to on. If it's not the right switch at all, it jumps to the next section of my macro. This is in a macro command of "GOTO LABEL". you don't have to do that of course

On your xLobby machine, you'll need the DCC Client (from the downloads page of the the PH site) running and configured. The password is encrypted and cut and pasted from the PH.ini file. Also, xsend.exe must be on the root of C: if you don't want to change the format.

Hope this helps some.

Edited by cmhardwick - December 28 2007 at 08:27


__________________
Cicero, Enjoying automation!
Back to Top View cmhardwick's Profile Search for other posts by cmhardwick Visit cmhardwick's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum