Jump to content
C4 Forums | Control4

rek

c4Forums Member
  • Posts

    48
  • Joined

  • Last visited

Everything posted by rek

  1. In that tiny circle, I never doubted for a second it was Keith Richards and some other dude, seriously. Just assumed you were a Stones fan. Color me properly educated.
  2. I did enough playing to confirm the date and time functions should do what I wanted. But I haven't got around to incorporating them into my project, yet.
  3. Nice - that does it all! Any other cool tricks with Variable Manipulator besides math. and os.?
  4. In thinking about it @alanchow, I have a much better idea and a simpler request for the Variable Manipulator driver. Support DAY{}, TIME{}, DATE{} for the current date/time in the Create String action, like in the Advanced Announcements driver. Support something like EPOCHSECONDS{}. It would set your NUMBER variable to the number of seconds since some epoch of your choosing. I think that's it. A script could then stash away a pretty date/time string in any format they wanted for their own use later. A script could also capture EPOCHSECONDS whenever they wanted and do their own math to get elapsed days, hours, mins, secs.
  5. Is there a way to access or use date/time information from within scripts? All I've found so far are the conditionals available from the Scheduler agent. Forgive the contrived examples but this is the sort of thing I'm thinking: Include current date/time pieces in a string, for any number of reasons. Store the current date/time away in a variable. Later on, extract date/time pieces to use. For example, a keypad button announces "The recirc pump power was last cycled on Saturday Feb. 12th". Do some simple date/time math. "The recirc pump power was last cycled 4 days ago". Then there's all the various postings here about calculating elapsed days, using repeating timers every x minutes to increment a variable to compute "how long", figuring out time until sunset, etc. As I type this, I realize this is a variation on a frequent topic and there probably isn't really a solution (correct me if I'm wrong). So, I'm turning this into a wish list for the Variable Manipulator driver from @alanchow. Support DAY{} TIME{} DATE{} for the current date/time in the Create String action, like in the Advanced Announcements driver. Add a new one, DATETIME{}. It replaces with current date and time info in whatever format is reasonably easy to work against later. Support some basic operations against a string PARAM (in the format returned above). Maybe just the same DAY{} TIME{} DATE{} are available when creating a string. Support some basic date/time math with two string PARAMs (or maybe one PARAM and the current date/time). Maybe just DAYSDIFF{} and HOURSDIFF{} are available when creating a string or number. I'm sure I've missed or oversimplified something but I think this would address my use cases. And then my solution to the time-until-sunset problem would be something like: Scheduler Event Every Day at Sunset Create SunsetString from current DATETIME{} When your_event_here Create AnnouncementString "The next sunset will be in HOURSDIFF{SunsetString} hours at TIME{SunsetString}" // should be off by less than a minute
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.