Rules with fraction of minute

looking for a way to add events happening in less than a minute. e.g. I don't want to waste energy with turning off my lights 1 minute after motion stops. I want to do it 30 sec after motion stops. is there a way to add time variable with e.g. 30 sec or 10 sec?
or I'm just too picky :slight_smile:
the reason of the 1 minute is maybe because of the minimum polling time? not sure.

RM allows for delays as short as 1 sec... so on the rule side RM has you covered. Now if the device is not responding fast enough for you that is different. Most motion detectors are battery powered and their sluggish response times are to help preserve battery life. Some will allow you to adjust the sensitivity and response time, how depends greatly on make and model and come at the cost of battery life.

I'm actually using simple automation rule


I can't add time less than a minute. am I missing something ?

You may need to switch to RM to get seconds...

thanks! will give it a try.

can you pls help me with RM,
I want two rules one is 7:00-18:00 if motions sensor detects motion => turn lights on to 90% and if motion stops turn off after 30 sec. but only in this timeframe.
I wasn't been able to specify this.
this I was only been able to solve with simple automation rules but that one I can't turn off after 30sec.
the second RM rule is outside of this timeframe , so 18:00-7:00 same thing just lights on 10% .
I can't see how can I specify the time window for the triggered event.

It really only needs to be 1 rule,
if time is 700-1800 and motion is active then set light to 90% and cancel delay
Else if time is 700-1800 and motion is inactive then set light to off delay 30sec
Else if time is 1801 - 659 and and motion is active then set light to 10%
End if

thank you. sounds super easy I just don't know how to click it together.gui is extremely complicated
starting with the dimmer , if dimmer shows motion then turn lights on to 90% and IF mode is day - is how I tried but...

RM is powerful so it’s not the easiest to use. I’ve had to walk away from it myself, but if you tackle the learning curve early you can do some pretty cool stuff. It will be worth the frustration.

1 Like

absolutely agree.

getting there.... I think I'm half done. thanks @sidjohn1

@sidjohn1 has it right! Not the most intuitive thing but once you figure it out it's quite powerful. If you get stuck, do a screen shot of your rule and post it.

you guys are super nice. The great product is one thing , but the helpful community makes this product really cool.
So I got to this level:


but its not turning off. its night time now, its nicely turns on , dims the level to 10% but when motion stops , its not turning off after 30 sec.
any ideas?
in the meantime figured out that else / if and else-if are not the same expressions so tried with this too:


its not even turning on.

There are two problems I can see:

  1. [EDIT: This is what you figured out as I was typing.] You are using ELSE and another (nested) IF THEN, but you really want a single ELSE-IF. Basically, you want this:
IF (X) THEN
  Do something
ELSE-IF (Y) THEN
  Do something else
END-IF

and not:

IF (X) THEN
  Do something
ELSE
  IF (Y) THEN
    Do something

(The indentation is a clue, by the way: anything indented is contained inside the conditional is indented. You have multiple conditionals, all nested, with more indentation meaning more nesting.)

  1. Your delayed actions are never cancelled: if motion becomes active again, that previously-scheduled "dim"/off action (from the inactivity) is still going to execute. You can solve this by adding a few "Cancel Delayed Actions" actions to your "on" (or "dim," I suppose) half of each conditional--the ones that catch motion becoming active again.

It should also be noted that your rule has no triggers, so it will never run unless you do so manually (or call it from another rule). You probably want "motion changed" as your trigger, based on what I can see in your actions (and the Simple Automation Rules app this is replacing), but it's really up to you and what you want the rule to actually do. If you're expecting motion to turn on the light now and it isn't, that's why.

On a related note, I'm not sure if Simple Automation Rules lets you put in "0" for the number of minutes, but if so, that might work and be easier than all of this. But, of course, that's not 30 seconds. It may get you close, though--most sensors have some "timeout period" before they'll send an "inactive" event, usually longer than 30 seconds, and many even let you configure what this period is. So changing things on the sensor side might work either way. Have you verified how long the sensor takes to report inactivity? Either of these ideas might be easier--this seems like a lot of effort with minimal returns (are these low-power LEDs?) to avoid 30 seconds of a light staying on. :smiley:

thanks for your help here!!! you really took so much effort to answer me, and I really appreciate it. Well, I'm a guy with a big solar panel on my balcony as POC to supply part of my household :slight_smile: -- in ireland -- so yes, I'm a bit addicted on saving energy. though probably you're right it does not worth the effort. its rather that I can do it (or not) :slight_smile: and really this just need to be written once.
I will check "cancel delayed actions" I wasn't been aware of this.
thanks again! will give it a try tomorrow as its almost midnight. :slight_smile:
regards,

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.