We have moved at community.getvera.com

Author Topic: Random Timer  (Read 424 times)

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Random Timer
« on: January 11, 2019, 08:01:27 am »
Thanks for continually improving this app.
I was wondering if it would be possible to be able to add a ?random? timer in both the conditions and activities.

For example have a random condition able to set a time between (eg 7pm and 9pm) where the event will trigger randomly in between time selected.
And if possible, in activity to be able to select a random delay as well.



Offline rigpapa

  • Moderator
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Random Timer
« Reply #1 on: January 11, 2019, 08:22:21 am »
Thanks for continually improving this app.
I was wondering if it would be possible to be able to add a ?random? timer in both the conditions and activities.

For example have a random condition able to set a time between (eg 7pm and 9pm) where the event will trigger randomly in between time selected.
And if possible, in activity to be able to select a random delay as well.

I could certainly do that, several different ways. Let's back up a moment... what are you trying to accomplish?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Random Timer
« Reply #2 on: January 15, 2019, 07:01:46 am »
I was hoping to achieve the perception of someone being home by randomly turning on the lights on and off, instead of the fixed set time or even sunset - the randomness of life.
For example have a reactor that I could set a time period of between 9pm-11pm and it will trigger randomly once within this period, simulating the randomness of someone living inside.
Mixing a few reactors using the same technique could accomplish sets of lights turning on and off randomly throughout the night like a lived in house.

Then possibly within the actual activity, if there was an option for a random delay of say seconds, minutes or even hours this would help simplify programming as I can have a reactor with many controls in the outputs occurring randomly as well. For example, turn on front light, delay randomly between 10-30 seconds, turn on back light, delay randomly between 10-20mins turn on tv etc etc

For example.


Offline Forzaalfa

  • Full Member
  • ***
  • Posts: 227
  • Karma: +5/-0
Re: Random Timer
« Reply #3 on: January 15, 2019, 07:28:43 am »
There's another app for this, "Deus ex macina" or something?
Vera Plus - RFXtrx433e

Offline rigpapa

  • Moderator
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Random Timer
« Reply #4 on: January 15, 2019, 07:45:56 am »
There's another app for this, "Deus ex macina" or something?

Yeah, this could be somewhat tedious to do. Reactor would allow you to set up an array of devices you could work on, which would simplify things somewhat, and it may be an interesting exercise, but DeusExMachinaII is purpose-built for this and likely a more straight-forward solution.

Currently, Reactor doesn't have a "random" number generator. I could easily add one and post a one-file patch if that's really a direction you want to pursue.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Random Timer
« Reply #5 on: January 15, 2019, 02:58:31 pm »
I?ll give DeusExMachinaII a go again and see how it goes, but was trying to get away from the tedious.

I?ve basically deleted all other logic apps except for reactor as this can complete everything I need so was hoping to have the feature for simplicity reasons.

If a random option happened to be in the next reactor release that would be pretty awesome.

Offline rigpapa

  • Moderator
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Random Timer
« Reply #6 on: January 15, 2019, 03:02:59 pm »
If a random option happened to be in the next reactor release that would be pretty awesome.

I just rolled it in. I'll be publishing the 2.2 Developer Preview release later today (also includes other features), so if you want to roll the dice a bit... (developer previews are working but haven't had the serious testing that I do before full releases).
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Random Timer
« Reply #7 on: January 16, 2019, 07:21:11 am »
Wow you are awesome! You are making this world a better place!
I look forward giving it a go once the update come though.
Thanks.

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Random Timer
« Reply #8 on: February 12, 2019, 01:38:50 am »
Hi Patrick,
I was just wondering where to find the new random feature?
I've noticed there seems to be a new option called 'interval' and was wondering if this was it? If so, can you please provide a quick run down on how to use it?

Thanks.

Offline rigpapa

  • Moderator
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Random Timer
« Reply #9 on: February 12, 2019, 09:12:12 am »
Hi Patrick,
I was just wondering where to find the new random feature?
I've noticed there seems to be a new option called 'interval' and was wondering if this was it? If so, can you please provide a quick run down on how to use it?

Thanks.

The Interval condition type does not do random intervals. It does a fixed interval.

The random() function in expressions is there and works the same as Lua math.random() (that is, no arguments returns a value between 0 and 1, one argument returns a value from 1 to that argument value, and two arguments returns a value between the first and second values). You'll be hard-pressed to use this in any of Reactor's timing, however. None of the timing values accepts expression variables in the current version.

I left this conversation previously thinking that DeusExMachinaII is the better solution for this, and I'm still there.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline bRock

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Random Timer
« Reply #10 on: February 12, 2019, 10:41:57 pm »
Oh OK, this quote led me to think it was included in Reactor, sorry if I miss understood.

If a random option happened to be in the next reactor release that would be pretty awesome.

I just rolled it in. I'll be publishing the 2.2 Developer Preview release later today (also includes other features), so if you want to roll the dice a bit... (developer previews are working but haven't had the serious testing that I do before full releases).
« Last Edit: February 12, 2019, 10:43:37 pm by bRock »

Offline rigpapa

  • Moderator
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Random Timer
« Reply #11 on: February 13, 2019, 10:04:23 am »
Sorry, my reply was a bit misleading/obtuse. Rushing around too much. Let me clarify a bit.

The random() function is in (released) as previously promised. At the moment, the place that would be of most use to you is the "Delay" action, which accepts variables for its delay time and so would allow you to randomly delay subsequent actions in response to a condition. The "interval" condition doesn't (yet) allow variables for its parameters, but I don't think you need that right now.

Quote
I was hoping to achieve the perception of someone being home by randomly turning on the lights on and off, instead of the fixed set time or even sunset - the randomness of life.
For example have a reactor that I could set a time period of between 9pm-11pm and it will trigger randomly once within this period, simulating the randomness of someone living inside.
Mixing a few reactors using the same technique could accomplish sets of lights turning on and off randomly throughout the night like a lived in house.

You can get to this specific simple goal now. If you want me to propose a solution, I will, but I don't want to give you spoilers, either, if you're eager to solve it yourself.

But it still stands, as Forzaalfa asserts, that DeusExMachinaII is probably a better, more general solution for this general problem. While I like the idea of you being able to do anything with Reactor, and I'm always intrigued to see what people come up with and do with it, I'm never going to say that makes Reactor the best tool for every job. As I often say, "to the man holding a hammer, everything starts to look like a nail." We should always be asking if this is the best way to get something done, and I'm a big fan of keeping things as simple as possible, not letting the complexity get out of hand. And perhaps a bit morbidly, I'm always thinking about someone else supporting my configuration if I get hit by a bus and my wife/family has to come to these forums and post for help (anyone who has been on these forums even just a year has probably seen that kind of situation play out). If I had just a couple of lights, sure. But these things have a habit of growing. I control 33 lights spread across almost every room of the house, indoors, outdoors, and garage, when my house is in "ghost" mode, so I use Deus. One plugin, one device, and that configuration was all mouse clicks and done, and any changes are that, too.

But by all means, have at it. You've got your random function, and you can use its result in the Delay action. I'm eager to see what you come up with. You know where to post if you hit a roadblock.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rlsmith46

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Random Timer
« Reply #12 on: March 13, 2019, 08:23:18 pm »
I concur that the capability to randomize on/off events is critical to making a dwelling look occupied when absent for long periods of time.

For simplicity of the user-interface I would hope that Vera would implement a "random" check box everywhere a time trigger was specified.  Clicking the box would expand to indicate the time interval for the random event.

That seems to me to provide a more readable interface on when events will happen - particularly when reviewing items that may have been set some time ago.

( to go a bit over the top as a math junky, it would be very cool to be also able to specify the random time distribution which is used - not just a uniform distribution.  But I don't see much demand for such a statistical finesse)