Condition Date/Time: only per 5 minutes?

I would like to make it possible to not only use the dropdown for the time per 5 minutes.
It is possible to change that into custom field? Some things need to be on for 6 or 7 minutes in my case.

Can you give a specific example of what you are trying to do?

I mean this:

Clipboard01

I would like to see that the user can set it by hand, so 1 to 59 instead of the dropdown wiht 5,10, 15, etc.

Hello,
I have a similar problem. I have a REACTOR to manage my pool pump.
I calculate the start time and the stop time for my pump depending on the temperature.
It would have been easy for me to have a condition with the possibility of associating it with a calculated time.
I was able to get out of it by doing so:
I do the calculation in RUN LUA and I just write the results in 2 Expression variables.

Then I have a condition that compares the current date to my Expression variables

ok it’s not quite the same thing.
sorry.
But we could not have a Date / Time condition to which we can assign a calculated variable.
thanks for your plugin

You’re going to have to let me think about that a bit. The problem here is that date/time entry allows a number of different formats:

  • Time only: recurring daily at the specified time
  • Day and Time: recurring monthly on the day at the specified time;
  • Month, Day and Time: recurring annually on the date at time;
  • Year, Month, Day and Time: absolute (non-recurring) date and time.

I can easily make the time field an entry field, allowing HH:MM, but what format are you expecting to give the time in from your expression? Better get it right… that’s a lot of rope to hang yourself with.

And that doesn’t address how to deal with date entry. Maybe I could take the “cron” approach, where you can use “*” to mean “any”… so 2020-*-05 means the fifth day of each month in 2020. *-*-01 means the first day of each month. But that’s not exactly user friendly, and new users will not be OK with it, I’m pretty sure.

And of course, whatever the date formatting rules are, that’s how your expression would have to produce it…

Need to think about this…

In fact my calculation is a variable expressed in standard time (type = 1587054602)
so the date / time condition to which we would assign a standard type variable
I know it is not necessarily obvious but I could find another way to achieve this result.
As the accuracy is not absolute to treat the running times of the pump, I took an interval of 10 min to compare the current date to my calculated date

Another question unrelated to the previous one.
I use pusharray in Expression
I add the temperature measurements to the table to get the maximum water temperature for the day.
I would like to reset the board at the end of the day but I don’t know how to do it …
I tried to use the iterate function (tab1, _null) … I didn’t understand the syntax too much
It returns a null array to me but I still have an error at the time and then the array is replenished

OK. Well that didn’t take much thought. :slight_smile:

The way to go about your flexible timing is to use the date-time functions of the expressions to produce a decision, then use an Expression Value condition to test it.

For example, if you want your pool to run from 5:03am to 8:22pm every day, you might do something like this (I’m making each step a separate variable to make it easier to see what’s being done, but you can combine expressions once you get the hang of it, to make things cleaner):

timetable = timepart()
minutes_since_midnight = timetable.hour * 60 + timetable.min
run_pump = minutes_since_midnight >= 303 and minutes_since_midnight < 1222

The first expression gets the current time broken up as a table (see LuaXP Functions). The second expression converts that to a number of minutes since midnight by multiplying the hour by 60 and then adding the minutes. The third expression tests to see if that is between 303, which is 5:03am in minutes since midnight, and 1222, which is 8:22pm in minutes since midnight.

You then use an Expression Value condition to see if run_pump is TRUE.

1 Like

Ok and how to do this very simple thing?

I need a pump running once a day, just to not let it get stuck. And just 2 minutes per day is enough.
How to do that with a Reactor sensor?

To reset the array at midnight, these expressions, exactly in this order:

last_hour = curr_hour
curr_hour = timepart().hour
tab1 = if( last_hour != curr_hour and curr_hour == 0, list(), tab1 )

You will get an error on the first expression the first time it runs, but it will settle in after that.

The first expression captures the previous value of curr_hour in last_hour. The second expression gets the current hour. The third expression sees if the hour has changed and the new hour is midnight, and if so, returns an empty array, otherwise returns the array as it is (assuming tab1 is the name of your array).

Add an Interval condition to ensure that your eval occurs every 24 hours relative to midnight. You don’t need any activity associated with it; its existence is enough to re-evaluate the expressions when it trips.

That’s almost a “how long is a piece of string” question. There are lots of ways to get this done. If you’re stuck even getting started, consider this…

If you use a Date/Time condition with no date, just a time of day and the after operator, then your pump will run every day at that specific time, or if your Vera is down at that moment, as soon after that specific time as possible after it comes back up. If your “is TRUE” activity for the condition group turns on the pump, you’re then halfway home.

Now we just have to get the pump to turn off after two minutes. For that half of the equation, I would use the “Pulse” output mode (see Condition Options in the documentation) on that Date/Time condition, setting the pulse time to 120 seconds (two minutes). Then, set up the is FALSE activity for the condition group to turn off the pump.

It’s so funny that you mention this, because I had the very same thought (i.e. wishing we could pick “00 - 59” from the drop-down instead of just “00/05/10/…”) earlier this week!

+1
:heavy_plus_sign: :one:

I really wish we have a more recent jQuery to play with here, because there are some really nice widgets I could use… Sigh.

thanks it works perfectly

Great, thank you. Sometimes it’s so easy…