Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Timed Event or Triggers Disable/Enable Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: May 14 2013 at 06:42 | IP Logged Quote GadgetGuy

PROGRAMMING TIP
There are times when one wants to disable All Trigger
Events or Timed Events for the duration of a critical
macro, so that the macro is not impacted.

This is equivalent to turning Interrupts on/off in a
real-time system, when a time/state critical operation is
being executed and must not be interfered with.

At this time (May 2013) there are no PH commands to
disable/enable all Triggers, but the same result may be
obtained using the following PH Direct SQL formulas . . .

(Enables all Triggers)
   
Code:
ph_directsql("update triggers set status = 1")


(Disables all Triggers)
   
Code:
ph_directsql("update triggers set status = 0")



To similarly Enable/Disable Timed Events, use the
ph_timedeventsctrl function.

To Disable all Timed Events, you would use:
    
Code:
ph_timedeventsctrl(“off”,0)


And to Enable all Timed Events (and execute past
due
events) use:
    
Code:
ph_timedeventsctrl(“on”,1)



Whenever Triggers or Events are Disabled, be SURE to re-
enable them ASAP as soon as done. If these functions are
ever left Disabled, your PH functionality will pretty
much cease!

It is probably a good programming practice to always
Enable both Triggers and Events in your PH Initialization
routines.

Edited by GadgetGuy - May 14 2013 at 08:04


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: May 14 2013 at 07:13 | IP Logged Quote smarty

Nice tip....

Thanks!!

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 

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