Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: sending x10 commands multiple times Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
npavkov
Groupie
Groupie


Joined: February 29 2004
Location: United States
Online Status: Offline
Posts: 91
Posted: January 27 2005 at 22:03 | IP Logged Quote npavkov

Dave, is there a way to send the same x10 command multiple times (one right after the other) to turn on or turn off a lite?? I have one x10 switch that controls my front door lites that SOMETIMES does not perform the command I send to it, although I can send the same command again and it works fine. This is the only x10 device that I have this problem with. I think that if I can get PH to send the same command 3 times with 1 sec intervals that that would make this x10 device more reliable..... Activehome does contain this option for that reason. is that option already available in PH?.... Thanks Nick
Back to Top View npavkov's Profile Search for other posts by npavkov
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 28 2005 at 12:34 | IP Logged Quote dhoward

Nick,

PowerHome does not have this built in...however, it is easy enough to setup using a trigger and a virtual X-10 device.

Say for example that your actual X-10 device is at A1. Create a matching virtual X-10 device at Z1 (you can use any virtual address). Next, create a couple of triggers for Z1 on and Z1 off. In each of these triggers, set a formula to turn on/off A1 3 times. To turn on, you could use the following formula:

ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0)

Now control the troublesome device by using Z1.

*************************************

If you feel adventuresome, you can also do it another way and not have to control via a virtual X-10 device. You'll need to create two triggers for each command you wish sent multiple times and a global variable.

Lets say were working with A1. The first thing we'll do is declare a global variable and call it A1ONCOUNT.

Next, we need a trigger which we'll call A1ON. The ID is important (to be explained below). Have this trigger fire when A1 On is sent. The action will be the following formula:

ph_disabletrigger("A1ON") + ph_setglobal_a("A1ONCOUNT",0) + ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0)

Next create the second trigger which will be called A1ON1. The important thing about this trigger is that the ID (A1ON1) comes after A1ON when sorted alphanumerically. When multiple triggers exist for the same command, they are fired in order based upon their ID. This trigger will also be set to fire when A1 On is sent. The action will be the following formula:

if(ph_addtoglobal("A1ONCOUNT",1) = 3,ph_enabletrigger("A1ON"),0)

Now, whenever you send an A1 On command, the command will be repeated an additional two times.

How does it work?

Whenever an A1 On command is sent, the A1ON trigger will be fired first. The very first function then disables the A1ON trigger to prevent it from firing on subsequent A1 On commands. The rest of the formula then initializes our A1ONCOUNT variable to 0 and queues up two more A1 On commands.

As soon as the A1ON trigger is done firing, the A1ON1 trigger will fire. It adds 1 to our A1ONCOUNT variable and then checks to see if we've seen a total of 3 A1 On commands. At this point, we've only seen the initial A1 On command which essentially triggers the other two. This trigger then terminates.

Sometime in the near future, the X-10 controller rolls around to sending the two queued up A1 On commands. The A1ON trigger does not fire because it has been disabled. The A1ON1 trigger will fire a couple of more times and will increment our A1ONCOUNT variable to 3 at which it will then enable the A1ON trigger. Were now set to repeat the process when the next A1 On command comes along.

**********************************

After pondering this a little more, you can do this just using a single trigger and global. We'll use the same global A1ONCOUNT and a single trigger called A1ON. Set the trigger to fire on A1 On commands and make the action the following formula:

case({A1ONCOUNT} when 0 then ph_setglobal_a("A1ONCOUNT",1) + ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0) else if(ph_addtoglobal("A1ONCOUNT",1) = 3,ph_setglobal_a("A1ONCOUNT",0),0))

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
npavkov
Groupie
Groupie


Joined: February 29 2004
Location: United States
Online Status: Offline
Posts: 91
Posted: January 28 2005 at 13:14 | IP Logged Quote npavkov

dave, Thanks for the info..... However could I not just use this command to turn on/off the actual x10 device like a1, without using the virtual x10 device????

ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0)

currently I use this command "ph_x10btn("A",1,2,0)" to control a1 on/off. Could I use the command above instead of the one I am using????
Thanks again for your help.....Nick
Back to Top View npavkov's Profile Search for other posts by npavkov
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 28 2005 at 13:37 | IP Logged Quote dhoward

Nick,

Take a look at the end of my message...it will show you how to do it using just 1 trigger and 1 global without having to play games with virtual X-10 devices. It will send the 3 on's no matter how the first one originates. If you use the internal palm pad, the X-10 status screen, the webserver, etc., it will send the three commands.

Now, if you are just interested in sending 3 on's from within code, then certainly...the ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0) + ph_x10btn("A",1,2,0) will do the trick.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward'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