Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: ph_modifytimedevent Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: June 01 2009 at 09:52 | IP Logged Quote judetf

Can the ph_modifytimedevent be used to change the frequency of a timed event?

I currently have a macro event that I want to have run every minute, just between 4:30pm and 5pm. I know I could use the boolean field to control that, but I prefer to have timed events be disabled when I don't need them to run.

I have accomplished this at the moment by having a static timed event run at 4:30 that enables the every-minute event, then another that runs at 5 to disable it.

But it would be more elegant, I think, to have the macro that actually runs do the work for itself. I'd like to have it set to run daily at 4:30, then when it runs the first time the macro would change the frequency of the timed event to be every minute, and then build logic into the macro so that after 5pm it resets the frequency to be daily at 4:30.

Possible?
Thanks!
jtf
Back to Top View judetf's Profile Search for other posts by judetf
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: June 01 2009 at 10:46 | IP Logged Quote judetf

Okay, I solved for this differently, so no answer needed.

But in solving for it, I think I may have uncovered another bug with the ph_modifytimedevent code. No matter what I did, I was unable to use that code to change either the start date or the reference date to be anything other than today's date. I could not set it to be tomorrow...

For the curious, the way I resolved my design was to leverage the 'daily macro' that I have run every day for basic cleanup/setup functions. I added the creation of a timed event to run my macro. The timed event is set for 4:30pm, and set to run every minute. I then have the macro itself delete the timed event after 5pm. Then the whole thing will reset itself tomorrow morning when the daily macro runs.

jtf
Back to Top View judetf's Profile Search for other posts by judetf
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 02 2009 at 22:26 | IP Logged Quote dhoward

jtf,

The ph_modifytimedevent should have no problem with updating the reftime and starttime. I just verified this on my system and it worked perfectly. It might have been a problem with the reftime parameter or the flags parameter. This is what I used:

ph_modifytimedevent("WATERHEATOFF",0,2009-06-03 20:00:00,4)

I used a literal timestamp above but any of the PH datetime functions should provide a suitable timestamp. The flags parameter I had set as 4 which means to update the reftime and calculate a new starttime based upon the reftime.

HTH,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

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