Author |
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: October 30 2006 at 21:37 | IP Logged
|
|
|
I'm trying to get a time stamp for the last time that the overall x10 state may have changed (by "overall" I mean any x10 device may have changed).
The way I thought to do this was to have a macro that sets a global variable to the current time whenever and X10 command comes in or out.
Unfortunately there does not seem to be a way to set a trigger on any X10 in.
Can anyone think of an efficient way to get the last time any X10 device changed state? I say efficient because I'm not willing to call ph_getx10dt for each device.
Suggestions? Thanks, Tony
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: October 31 2006 at 11:06 | IP Logged
|
|
|
Tony,
You could do it with triggers, but you would need 32 total (1 for each housecode for both "X10 in" and "X10 Out"). It doesnt hurt to have alot of triggers. Most people thinks it will slow the system but due to the database design, it's actually quite efficient. However, it will be a PITA to create them all.
If you go this route, I would trigger on "Any (Before Buffer)" and "Addressed". You could then have each of these triggers update global variable with the current date and time.
You can also just get the latest timestamp of an X10 device change by using the following formula:
Code:
ph_sqlselectinto(1,"select max(lastchange) from x10devices") |
|
|
When this formula runs, the [LOCAL1] variable will contain the most recent X10 device status change datetime (alot better than calling ph_getx10dt for each device ).
HTH,
Dave.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: October 31 2006 at 20:36 | IP Logged
|
|
|
Just posted a long reply that caused an internal server (HTTP return 500) error and got lost.
Short jist was perfect answer! Thanks.
Also is there any documentation of the ph database structure? What tables are where? Etc.
Thanks, Tony
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 03 2006 at 17:33 | IP Logged
|
|
|
Tony,
In the appendix of the manual are the table list and structures but it's out of date. Check this thread for methods using the PowerHome Multi-Editor http://power-home.com/forum/forum_posts.asp?TID=926
HTH,
Dave.
|
Back to Top |
|
|