Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: trigger on change Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
phil13
Groupie
Groupie
Avatar

Joined: December 19 2004
Location: France
Online Status: Offline
Posts: 60
Posted: December 23 2004 at 05:01 | IP Logged Quote phil13

Is there a way to make a trigger on x10 (IN and OUT) status change ?

I've a infrared detector at night send an X10 ON order each time it detect something. Each time i'm detected, a timeout is initialize to 5 minutes. After 5 minutes without detection, the light is switch off.

In the same time, at each detection, powerhome announce the light switch on (and the alarm if it is activated).

If i stay outside in front of the detector, Powerhome doesn't stop to announce the detection ....

So i'd like to speak only when status change from X to ON.

I've tried when i receive A1ON to do a jump with
if(ph_getx10stat( 'A', 1 )=2,999,1) but it doesn't work, the status has already change before the call of the macro ...

philippe
Back to Top View phil13's Profile Search for other posts by phil13
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 23 2004 at 20:03 | IP Logged Quote dhoward

Phillipe,

Ive looked at the code and thought long and hard on this. You're right, there is no good way to check if something is already on. With the way PowerHome is currently written, it wont be easy to check for the status change, but I see value in the request so Im putting it on the todo list.

In the meantime, to work around your problem, you'll need to use a global variable (or a virtual X-10 house/unit) as a flag to track if the real unit is already on. Initially set the global variable and A1 both to off. Then in the macro that is called when you receive the A1 ON, check the global variable and if its off, set it on and have PowerHome do the announcement. Similarly, you'll need a macro for the A1 OFF so you can set the global to OFF if it is ON.

I know it's a workaround, but should take care of you until I can get the status change triggers in.

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

Joined: December 19 2004
Location: France
Online Status: Offline
Posts: 60
Posted: December 25 2004 at 11:44 | IP Logged Quote phil13

Dave,

I've tried today this solution.
That's works but it is rather "heavy" (i'm not sure it is the good sentence).

As i can also switch on/off my light with powerhome interface, i have also to add a macro for X10 OUT A1 ON and one another for X10 OUT A1 OFF.

So to do a trigger on status change i need 1 virtual device, 4 triggers and 4 macros.

And i have 6 detectors ...

I suppose it is not a problem to have many items in database but it is not easy to input it inside.

So is there a way to code the solution for 1 unit and duplicate it for the 5 others ?

Thanks

And have an merry christmas.

Philippe
Back to Top View phil13's Profile Search for other posts by phil13
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 28 2004 at 16:29 | IP Logged Quote dhoward

Philippe,

To do what you want, you would need a minimum of the 4 triggers (1 each for X-10 OUT A1 OFF, X-10 OUT A1 ON, X-10 IN A1 OFF, and X-10 IN A1 ON) and 1 virtual device to track the change state. You could have a macro per trigger, but you could also get by with just a single macro and pass parameters from the trigger (or the macro could be written to perform actions solely upon the ID of the trigger which is in the [TEMP1] variable).

As far as many items in the database, that wont hurt at all. It's why I wrote PowerHome using a high-performance standalone SQL database engine. Since the tables are well indexed, you could literally have hundreds upon hundreds of triggers and macros without any performance degradation .

Now as far as duplicating, that should be relatively easy as well. For triggers, just right-click on a trigger and select "Duplicate" from the popup menu. It will create a new trigger with an incremented ID. For macros, do the same from the "Macros" screen (not the "Macro Detail" screen). Right-click, and select "Duplicate" from the popup menu. While this may not save a lot of typing for triggers, it can have enormous savings for macros, especially if they are long.

Sorry this response is coming so late and hope you had a Merry Christmas as well.

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