Logging the timestamp when sprinkler is triggered

I’m still working on my Sprinkler Reactor Sensor. My goal is to keep track of the last time the Reactor Sensor had the sprinkler relay run.

I am guessing my solution would be to log the current timestamp to an Expression Variable every time it runs the sprinkler? From there, I’m guessing this needs to be triggered any time the Condition goes true / the Activity runs.

ADDITIONAL DETAILS that hopefully make sense

  • I don’t think I should have it log timestamp every time the sprinkler device gets turned on, because maybe I flip that on manually and I wouldn’t want that to count as the sprinkler running.
  • I don’t think I can use the “Reactor Sensor Last Trip” because there are a couple conditions at play within there. Running the Sprinkler Relay is just one of the sub conditions.

Am I on the right track? Tried to do a little searching, found these two threads. But they seem to tackle grabbing that info from a device, rather than a condition within a Reactor Sensor.

Thank you!!

Device not updating. Possible use case - #12 by rigpapa - Reactor - Ezlo Community
Need assistance detecting no updates from a device - Reactor - Ezlo Community

Two questions to help clarify your goal:

  1. Are you simply wanting a record of some kind letting you know a particular .isTRUE Activity group ran within Reactor?

If so, setting an Expression equal to:

runTime  :=  strftime("%c")

would give you access to the current Vera system time in the {runTime} variable. But you may not even need that, because…

  1. Is it OK if that record comes in the form of an email message?

…by including a [NOTIFY] action in your Activity group, set to [SMTP Email] mode, you could generate a simple message stating:

The sprinkler routine was activated just now.

…and the “timestamp” could effectively be the time that the message reached your in-box. In that case, no need for Expression variables!

Thank you… I think this is what I’m looking for :slight_smile: I would rather do this than the email.

Do I need to replace %c with the name of the particular Condition?

No the %c signifies system time – a common Unix expression borrowed by the LuaXP language – which Reactor will evaluate as needed (kind of a “substitution within a substitution”).

But if you are not going to send yourself a notification, do you intend to go looking inside Reactor’s “Expressions” panel every time you want to know when a particular routine ran?

Maybe that’s the part we need to hash out a bit more here.

OK thank you

My goal is to be able to peek in there and reference last time it ran. Would also be nice to use that value in the Reactor Sensor by saying, for example, IF LastRuntime was 2 days ago or more AND forecast doesn’t call for rain tomorrow THEN run sprinkler in the morning. (This is a made-up example, but would generally like to use the Expression Value in that way)

I’m thinking I should do this?

CurrentTime := strftime(“%c”)
LastRunTime := (null)
And in the sprinkler Activity, Set Variable : LastRunTime = {CurrentTime}

You are definitely on the right path here. A little testing should get you all the way!

Excellent-- thanks so much for help!

1 Like