Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: ph_secondsdiffsec question Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jostim
Groupie
Groupie
Avatar

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: December 18 2007 at 21:12 | IP Logged Quote jostim

I can't get the command ph_secondsdiffsec to work.

I am trying to make a macro that turns off the lights in the house when nobody is home (or asleep). I have a check on all events that show 'human activity' (lights, IR, motion sensors) and store the time of the latest 'human triggered event'. Every 15 minutes I run a macro that checks if the last human activity is more than 1.5 hours ago. If that is the case, PowerHome turns off most lights.
I would like to use the command ph_secondsdiffsec, because it is smart enough to understand that 00:10:00 is later than 23:55:00. However, I can't get the command to work. I am probably missing something obvious again.

Here is the command I can't get to work:

ph_secondsdiffsec (ph_getglobal_t ("TIME"), now ())

Any suggestions?

- jos


__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 19 2007 at 09:07 | IP Logged Quote dhoward

Jos,

Use ph_secondsdiff instead of ph_secondsdiffsec. Apparently, the help file is wrong and the text for ph_secondsdiffsec is really meant for ph_secondsdiff.

ph_secondsdiffsec accepts two double values representing seconds and does the same calculation. In this case, adding 86400.0 to the second parameter if it's less than the first parameter.

HTH,

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

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: December 19 2007 at 22:31 | IP Logged Quote jostim

Dave,

Thanks for your quick answer.   Problem solved.

- jos

__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 

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