Author |
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: May 28 2009 at 09:43 | IP Logged
|
|
|
It would be interesting to have counter variables. Something that could be fired by triggers, macros etc... but would not be part of a macro.
For example my youngest always 'forgets' to switch her lights off. A trigger could fire [COUNTER01] independently of any other processes. Then when [COUNTER01] reaches 300sec, it triggers a switch off or a macro etc...
I do that today with a counting macro but I wish to do that with several switches and I hate having 10 macros running just for the sake of counting :)
These Counting variables would be also very usefull in a lot of situations.
Any idea if it's possible?
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: May 28 2009 at 10:40 | IP Logged
|
|
|
veropierre,
I do something similar now but with a single macro called using parameters. I imagine you could do something similar like this:
Code:
10 Wait [LOCAL1]
20 Formula Immediate ph_devicecontrol("[LOCAL2]")
|
|
|
This can then be called from a trigger with a ph_macroparm function where the time delay is in LOCAL1 and a device control string is in [LOCAL2]. You could even expand upon this with a [LOCAL3] in a case statement to have the [LOCAL2] be a device control string, a macro to execute, a raw formula to execute, etc.
When a macro is "waiting", its not actually running or consuming resources. When a wait is called, the macro's current state is stored into a blob and written to the database. A query is performed to see when the next macro is due to "wake up" and a single timer is started to countdown to that time. So you can essentially have hundreds of macros waiting with no performance degradation.
Let me know if this won't work and we can see what it would take to get counters into the system .
Dave.
|
Back to Top |
|
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: May 28 2009 at 11:24 | IP Logged
|
|
|
That should work, I'll try tonight.
Nevertheless I would having banks of counter variables if it's not too complicated to implement.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: May 28 2009 at 20:01 | IP Logged
|
|
|
You could do this with two triggers per thing to be counted.
You could set up one trigger to increment a GV and another to do something when the GV hits the desired "trigger" value.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: June 02 2009 at 20:47 | IP Logged
|
|
|
Pierre,
Never one to deny any possible useful features, could you elaborate a little more on your counter variables and how they would be implemented so I better understand if its doable?
Thanks,
Dave.
|
Back to Top |
|
|
veropierre Groupie
Joined: May 06 2009 Location: United States
Online Status: Offline Posts: 47
|
Posted: June 03 2009 at 13:30 | IP Logged
|
|
|
Thanks for the opportunity!
I can imagine something like this in a macro:
Macro
10 do that
...
90 set_counter [Counter0] (start counting)
100 do this
...
150 set_counter [Counter1] (start counting)
...
etc
Using triggers we can then:
on [Counter0] = xx (number or variable) --> action )insteon, run script, resume macro, run apps, run macro...)
Doing so we would be able to run n counters with no macro running.
Any thoughts?
__________________ 37 Insteon Switches + 14 Lamp Modules + 7 ControLinc + 2 RemoteLinc + 3 Insteon Thermostats + 8 Zones Sprinklers + several X10 + Power Home 2.1.4 = Happy Camper
|
Back to Top |
|
|
spou Newbie
Joined: July 28 2007 Location: Canada
Online Status: Offline Posts: 33
|
Posted: June 22 2009 at 06:56 | IP Logged
|
|
|
I can see it also as a event counter, and when the said
counter reach a given value, a macro could be executed.
I would add a feature that could reset the counter if no
"touching" the counter has been done in a given
timeframe.
For example, I'm trying to guess when a thunderstorm is approaching. I have my own weather station that sends
data each minute.
Using this counter thing, I could count the numbers of
gust higher than 30 km/h in a 15 minutes time frame. By
also checking over the amount of rain, and the
temperature change in that same time frame, PH could then guesstimate the possibility of a thunderstorm, and act
upon it.
However, all that rain and wind could be part of a simple
rainy day, so if there was no gust > 30 in the last 15
minutes, just reset the gust counter to zero.
Same concept if I would like to use a lighting detector.
It could also be used as a "wrong password" counter:
{wrongpsw} > 3, execute macro "sound alarm", reset after
5 minutes
Just my 2 cents...
Spou
|
Back to Top |
|
|