Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Newbie help needed with formula or trigge Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
groston
Newbie
Newbie
Avatar

Joined: November 05 2007
Location: United States
Online Status: Offline
Posts: 16
Posted: November 01 2008 at 19:30 | IP Logged Quote groston

All,

I have a very simple set of commands programmed in PH. Basically, my devices turn on/off at fixed times or relative to sunrise/set. To accomplish this, I have timed events, with each event firing a macro that makes the specific device turn on/off.

I would like to 'get fancy'. I would like one of my devices to come on at sunset (know hoe to do this) and turn off at the later of 9:00 pm or 30 minutes after sunset. I suspect that formula is needed, but it seems that a trigger is needed as well. (Why? Because it seems as if the formula is a simple timed event, then this cannot be accomplished.)

Kindly provide some suggestions for doing this.

p.s. Still running V1.02.4.12. Tried the V2.0.0 beta, but got a pile of errors after launching, so backed down to the previous version.

__________________
Gerald P. Roston
gerry (at) pairofdocs (dot) net
Back to Top View groston's Profile Search for other posts by groston Visit groston's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: November 02 2008 at 12:55 | IP Logged Quote grif091

Add this as a Formula in the Macro that turns On the light you want to turn Off at 21:00 or Sunset+30 minutes, whichever is later. You mentioned you already had Macros to turn the devices On and Off so I create a timed event which invokes a Macro. Change MXXXX to the name of the macro that turns Off the device. After running the macro containing this Formula, select Control, PowerHome Status to view the newly created timed event. This was created and tested on PH 2.0.0 but I don't think any of this is based on 2.0.0 function.

ph_createtimedevent(0,"MXXXX",datetime(date(today()),if (relativetime(21:00:00,0) > relativetime(00:30:00,[SUNSET]),relativetime(21:00:00,0),relativetime(00:30:00,[SUNSET]))))

Edited by grif091 - November 11 2008 at 16:31


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
groston
Newbie
Newbie
Avatar

Joined: November 05 2007
Location: United States
Online Status: Offline
Posts: 16
Posted: November 11 2008 at 15:41 | IP Logged Quote groston

grif091,

Thanks for the help. Seems there is a missing ), but after playing around, I figured this out. Works exactly as needed.

__________________
Gerald P. Roston
gerry (at) pairofdocs (dot) net
Back to Top View groston's Profile Search for other posts by groston Visit groston's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: November 11 2008 at 16:45 | IP Logged Quote grif091

There sure is, sorry. I fixed my original post. If you put anything that you get off a forum under the Formula Builder it is an easy way to verify results. Not all formulas can be tested this way but the Formula Builder also has the nice feature of pairing up constructs as you move the cursor across the formula. The first open paren would have been highlighted in red as the cursor was moved to that position indicating there was not a corresponding closing paren. Might save you some pain the next time I make a mistake in a post.

Edited by grif091 - November 11 2008 at 16:47


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 

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