Author |
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 01 2007 at 23:16 | IP Logged
|
|
|
Simple question here, I hope.
I set up a trigger to fire on any Insteon Device Change, which runs a macro. All I'm doing in the macro is writing a user message of the ID/Previous value/new value by building a string using ph_getvar_s(1,7), and 8,9,10.
Problem is, nothing seems to be working, they're coming up empty or 0.
Any suggestions?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 02 2007 at 00:14 | IP Logged
|
|
|
Brian,
Not sure why it's not working. You could post the trigger and the macro and I might be able to spot something.
Anyways, I just gave this a try and it worked, no macro necessary. Just set the trigger to do a Raw Formula with the following formula:
ph_usermessage(ph_getvar_s(1,7) + "|" + ph_getvar_s(1,8) + "|" + ph_getvar_s(1,9) + "|" + ph_getvar_s(1,10))
HTH,
Dave.
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 02 2007 at 09:17 | IP Logged
|
|
|
Hey Dave,
Thx! I went ahead and just put it all in the trigger like so:
insert into triggers values ('TESTTRIGGER','TEST','ph_usermessage(ph_getvar_s(1,7) + "|" + ph_getvar_s(1,8) + "|" + ph_getvar_s(1,9) + "|" + ph_getvar_s(1,10)) ',20,'[ANY]',0,0,'1',1,0,2);
But, I'm getting ||0|0 in the log file. Weird ... or is it user error here?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 02 2007 at 11:28 | IP Logged
|
|
|
Brian,
Ok, caught it this time. Change the [ANY] to [ALL] and it should work. The [ANY] only fires once and does not contain the extended information. The [ALL] fires for all effected Insteon devices and will contain the extended information. Changing this will probably mean that your original macro will also work.
HTH,
Dave.
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 02 2007 at 11:34 | IP Logged
|
|
|
Wow -- that was it! Thanks!
I had zero chance of figuring that one out on my own :)
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 02 2007 at 11:42 | IP Logged
|
|
|
OK, now for another question... is there a way to trap whether or not a change is happening because of a background status scan vs. timed event/button/etc.? It may very well be that PH does the scan, and updates the DB directly if necessary and not trigger any device change, I'm not sure.
(I spend 90% of my time doing useless things like this ... in this case I'm building a simple macro to tell me when powerhome scans a device, and it's value has changed. The system variables may or may not play a part of this, but I'm just learning the nuts and bolts....)
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 03 2007 at 10:52 | IP Logged
|
|
|
Brian,
Yes, PowerHome will fire the Device Chg trigger even if the status changes do to a status scan. If the Device Chg trigger is being fired as a result of a difference detected due to a status scan, then the [TEMP4] variable will contain an 8. The [TEMP4] variable is basically an indicator that will tell you what is causing the change (direct command, group command, ACK, etc). The information is a little dated (the 8 value is not documented), but this thread has some additional info http://power-home.com/forum/forum_posts.asp?TID=1118
HTH,
Dave.
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 03 2007 at 12:38 | IP Logged
|
|
|
Nice Dave, thanks!
I'm going to be the king of useless home automation tasks ;)
By the way, this might make an interesting report. Essentially, a "corrected status" report. I imagine for lamplincs this will be a common occurence, but it may help isolate communication or link issues.
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 03 2007 at 13:28 | IP Logged
|
|
|
Hopefully the last in my series:
I see there's a trigger for Insteon (ACK) -- is there a way to set up a trigger based on a NAK? What I'd like to do is record timestamps and possibly carry out more logic at the time a NAK occurs to help isolate problems. Thx!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: December 03 2007 at 16:23 | IP Logged
|
|
|
Oh.. I like this one. This would simplify my Insteon recovery macros. Right now I trigger on any change.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 04 2007 at 21:45 | IP Logged
|
|
|
Brian,
Unfortunately, no way to trigger off of a NAK. I'll see what can be done about adding one.
Dave.
|
Back to Top |
|
|