Newbie Rule Help

I wrote a few paragraphs, what I did, what I want, how I did it, what worked, what didn't. But it's too long to read. Nobody will read if I post a novel. I want to dumb it down, but I want to learn how to do what I want. I do tons of IF THIS and THAT or THISOTHER, THEN in my job, so I thought I'd have a handle on this, but nope.

Simply put: I want a light to flash when kids are on the stairs, for as long as they are on the stairs.

I set up an action without a rule, ACTION: FLASH LIGHTS that I can reuse for a multitude of triggers ( kids on stairs, people on my doorstep, etc.). All it does is set the light brightness to 100 for 1 second, then down to zero for 1 second.

Trigger: When motion sensor goes active. Then the lights flash.

But it's a 1 time thing , it flashes, then turns off, but the motion sensor is still active. In otherwords, the sensor triggers ACTIVE on motion, but won't go back to INACTIVE for about 15-18 seconds. I can tell it to repeat, but then it wants to know how long the routine is and how many times to repeat. can repeat this 100 times, but I want it to stop as soon as the motion sensor goes inactive.

As I write this, it sounds so simple. I've done so many combos of if/then repeat that I think I've just overly confused myself. Would appreciate a pointer from a vet.

I've never been successful with getting a light to flash. It does seem simple, but I've given up. Perhaps someone will post a rule here that will clarify. I don't need this particularly, but it would be nice to know how to do it. ~following~

1 second might be too fast. could try doing the delay to 2 seconds. but you could try

Trigger: Motion Sensor Active

Action: Repeat every 00:00:02 (cancellable)
            If (Motion Sensor Active=True) THEN
                Flash lights
                Stop Repeating Actions
         END REPEAT

As @april.brandt said, flashing lights can be finicky, and as I'm finding with some rules where I'm trying to do a quick on/off, sometimes it doesn't go as intended

The flashing of the light seems to me to be the simplest part. I tell it to set the brightness of the bulb to 100, delay 1 sec, then set the brightness to 0.

If I have a repeat on that, it flashes nicely. The problem for my situation is getting the repeating of the on/off to stop with the change of the status of the motion sensor.

I'm a noob, so I can be so wrong.

Just know the way I wrote the rule out it will continue until the motion sensor clears. This can result in the lights flashing for the additional 15-18 seconds until it goes back to INACTIVE. If you're ok with this, then running it in repeat should be fine

I hear what you're saying about flashing. Sometimes mine flashed faster or slower, I thought it was my crummy rule logic. I'll try your suggestions dadarkgtprince and reply back tomorrow. Thanks for your support.

Yeah, that's the other question.... can we make it poll the sensor quicker? 18 seconds is a long time. In a perfect world, it'f catch motion, poll every 3 seconds until it cleared... It's all battery life and programming, I reckon.

Does your sensor have a refresh option? If so, you can maybe call that in the beginning of the action

This seems to be working! It's not perfect, but I'm laughing enough that it's working. I need to add some other logic, but this seems to be working. I didn't know about the cancellable/stoppable logic, I need to review further. I knew this had to be simpler than I was making it.

I was looking for a refresh option, I thought that was polling was, "polling the status," but I think I was wrong.

This isn't perfect, it maybe my lights, they dont want to obey colors and brightness, but I think your suggestions are working, thanks very much.

1 Like

Polling would be to poll the device itself where as refresh would be to update the status.

Glad it's working better :slight_smile:

Ooo, this is a fun problem. :slight_smile: What lights/bulbs do you have (brand and model), and how are they paired (directly to Hubitat, through Hue Bridge via Integration, etc.)?

Also, as for refresh(), while a neat idea, it might not actually help. I just tried with an Iris v2 sensor, and refresh() does nothing for motion--it's likely that the sensor's firmware just determines how long it reports "active," and it sends a Zigbee report as soon as this changes, so refreshing won't speed that up. (The command itself does indeed work, as it forces an updated temperature reading.) Additionally, calling it too often is likely to drain batteries, and for Z-Wave devices it's likely it will do nothing at all, at least not until the device wakes up next time, which might only be once or twice a day (unless the motion sensor supports beaming, and I'm not sure I've seen any that do)--both, of course, assuming you're on battery power, so your luck there might be different if not. Many Z-Wave sensors have configurable "timeout" intervals, so one of those set to as low as you want might be the best option, but in my experience, they tend to be slower to detect motion, so it's a trade off. Regardless, with any motion sensor, you're likely to get at least a few "extra" seconds of detected activity, often up to 30-60 seconds or even more, depending on the device.