Running an Action after a sensor trigger between 2 times only ONCE

Hi there,

Hope you clever minds can help me figure this one out for me. My goal is:
In the morning between 7:30-8:30, if my sensor triggers motion, then my kettle goes on.
After that the rule cancels and waits until the next morning to start again.
I know there are private boolean's that can cancel an action so the kettle doesnt keep going off between the morning time because it's triggered by the motion sensor, but I have struggled to achieve that.

Kindly help me do this.
Otherwise I love Hubitat as a product

Thanks

There are more than one way to do this, but here is what I would do using Rule Machine. I’m assuming that someone will turn off the switch manually, otherwise, that command could be added.

Is this something that you think you would be able to try, or do you need some pointers?

Welcome to the community!

4 Likes

Here's an option

Required Expression
Private Boolean is True

Trigger
Motion

Actions to Run
Set Private Boolean to False
Set Private Boolean to True --> Delayed 1:00:00
Stuff to do...

Since your time window for triggering via motion is 1 hours scheduling the PB back to True an hour later should be fine.

Edit: What Sebastien said...

2 Likes

Thank you so much for the very quick response + Print Screens.
Your reply is spot on, Once the water is cooked, it switches automatically off based on power rating, so I am all good there.

Where I struggle a bit in your printscreens is finding that delayed option for 1 hour. I don't know what function or trigger it is since I don't see anything like that in the "define Action" part?

Lastly, should I save the rule, I see in the Apps - Rule machine - my rule followed by the message "Required expression false". Is this not blocking the rule anyhow?

Thank you for your support

1 Like

There's an action section for Private boolean, it'll look like this. You can set it for any rule but select This Rule for the rule that you're in.

You can change the PB in the variable section. Just select the value and change it.

1 Like

excellent, I will try this tomorrow and report back.

Wish you a great evening.

1 Like

Good day,

So I created and recreated this rule 2 times and I believe I've matched your examples good, however it is not working as intended still.
The issue I am having is, in the morning it goes on at the right time triggered by the sensor. But it keeps going on when ever motion is triggered. This means, even if I switch of the switch it goes on just as soon as someone passes the sensor.
Do you know why is that?

Post screenshots of your rule so others can see what’s going on.

I would love to add screenshots but I keep getting this message when I try: "Sorry, you can't embed media items in a post." I can't even add links to a post to share my screenshots. Am I missing something?

I think new community members are not allowed to post pictures or links.

Maybe @bobbyD can change your settings so you can post.

That is correct. There is a grace period while the system validates the new user is not a spam robot. To bypass the grace period, a user can join the new owners group:

https://community.hubitat.com/g/owners

2 Likes

Thanks for the explanation. This is a weird concept. I cannot receive help with my purchased product because at the moment I am considered a second class or third class client?

The requirements are very minimal and could be easily achieved: a user must view at least 5 threads, or read 30 posts on one thread, or spend 10 minutes reading other posts.

1 Like

I've taken your advise. Thank you for it. I have now managed to publish my screenshot.

Going over my notes, I think I made a mistake in the cancel delayed Action. I've now corrected that to be part of the private boolean. I will try first thing tomorrow to see what it does.

You could just update the RE time to something that'll be true soon to see if it works before you need it to. You could also turn on logging and unplug the kettle from the outlet and just monitor the outlet turning on/off as expected.

Just be aware that if your motion sensor goes active before an 7:30 and stays active past 7:30 it won't turn on at 7:30. The motion will need to go inactive then active again. You could restructure your rule to account for this case, which would also eliminate the private boolean and time required expression.

Trigger Event:
When time is 7:30 AM

Actions to Run:
Wait for Expression: MOTION SENSOR 1 motion active --> timeout: 1:00:00
IF (MOTION SENSOR 1 motion active)  On: KETTLE

Wait for Expression looks at the state of the sensor. If MS 1 is active at 7:30 or goes active between 7:30 and 8:30 the kettle will turn on.
Since there is only one action to run after the wait, I'm using a simple condition IF (XXX) Action as opposed to IF (XXX) THEN which should be (needs to be) closed with an END-IF.

It is a protection against spambots that Discourse (the forum software this community runs on) offers. As @bobbyD explained, a minimal amount of activity here that demonstrates you’re a human, or simply joining the hub owners group, is all that’s needed to gain the privileges to post images or links.

No one is second or third class except @hubby. He’s just annoying.

2 Likes

I think this is a new requirement - you are saying that once you turn off a certain switch, you want the light to stop turning on? Can you tell us more about that switch?

It might be that a new Required Expression needs to be added to the list: “Switch is on”

I think the issue was that in the posted rule the delay wasn't applied to setting the PB back to true. If would set to False then True immediately. I think the OP acknowledged it and said it was corrected but waiting for the morning to be sure. I think the switch is what's controlling the outlet for the kettle.

1 Like