Use Schedule Start End from Variable Container

I’m looking for a way to test start and end times that are stored in a Variable Container. Rather than create a PLEG Schedule I’d like to store event start/end times in VC variables and use them to test in PLEG Conditions. This way the times can be changed without requiring a change to PLEG, a restart of Vera, and allow them to be modified by other processes.

Because they are string values they don’t compare well, and especially if it crosses midnight. Any suggestions?

The normal Lua approach would be to convert the date/time strings to Unix epoch time with the [tt]os.time / os.date[/tt] functions, and then do a numeric comparison.

The # operator will provide a numeric timestamp that can be compared with the values in the VC plugin.

When you use numeric operators (==. <, >, >+, <=, -. +) it will convert the string arguments to a numeric value.

ak, thanks very much. Problem is i’m not even remotely familiar with Lua programming so the learning curve is going to be very steep.

[quote=“RichardTSchaefer, post:3, topic:181130”]The # operator will provide a numeric timestamp that can be compared with the values in the VC plugin.

When you use numeric operators (==. <, >, >+, <=, -. +) it will convert the string arguments to a numeric value.[/quote]

Richard, thanks. Does that mean that I can say:

StartTime :: VC_Var1_Value
EndTime “” VC_Var2_Value

CurrentTime #

DoSomething :: StartTime;CurrentTime;EndTime

or some such?

How would the Start/End string be formatted, with or without punctuation (e.g. 01:00:00 or 010000)?

If you have some inputs:

VCMinTime A timestamp bound to some Variable Container Value
VCMaxTime Another timestamp bound to some other Variable Container Value
SomeInput Some other Input you want to compare with

SomeCondition VCMinTime < #SomeInput AND #SomeInput < VCMaxTime