Jump to content

Better to enable/disable program or have it check flag?


peterd

Recommended Posts

Posted

I have a program which alerts me of a condition. I only want 1 message per day, so the program tests the value of a flag variable (reset @ midnight by another program).

 

Would enabling/disabling the main program be significantly more efficient than using the flag?

 

Thanks,

Peter

 

EDIT: I should mention that the condition I'm checking (back-pressure indicating that a filter needs changing) should only occur once every 12 - 18 months. When it does there may be a period of several days (to several weeks if I were out-of-town) before the filter is changed, During this time, the pressure switch would close & re-open every 5 - 10 minutes when the pump cycles. All the rest of the time the main conditional test (Insteon status = ON) in the program would be false.

 

Do I understand correctly that until the ON event occurs, the program never actually runs?

Posted

Hello Peter,

 

If you use status, then the only time the program runs is if the status changes.

 

As far as your other question, it's really subjective. Both approaches have the same efficiency.

 

With kind regards,

Michel

Posted
[...] Both approaches have the same efficiency.
Thanks, Michel -

I find that the program as I've written it

If
        Status  'Filter Pressure Switch' is On
   And $Filter_Clogged_Msg_Sent_Today is $FALSE

centralizes both conditions in one place and is completely self documenting, so thank you again for variables! :)

 

Peter

Guest
This topic is now closed to further replies.

×
×
  • Create New...