# Trigger a flow if an action is repeated multiple times with in a set period of time

**URL:** <https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341>\
**Category:** General\
**Created:** [11 May 2023 00:00 UTC](https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341 "2023-05-11T00:00:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbs179](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dbs179/32/79738_2.png) [@dbs179](https://discourse.nodered.org/u/dbs179)\
**Post date:** [11 May 2023 00:00 UTC](https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341/1 "2023-05-11T00:00:27Z")

</div>

Hi all,

I'm using Node Red with my Home Assistant and have a question I haven't been able to figure out. I want to change the profile of my Blue Iris NVR when motion is detected on a camera or cameras multiple times with in a set period of time.

I have the camera motions in Home Assistant and know how to get their states in Node Red, but I don't know to only trigger the next action (changing the Blue Iris Profile) if the state changes several times with in two minutes.

Any help would be much appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 May 2023 08:04 UTC](https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341/2 "2023-05-11T08:04:42Z")

</div>

Here is a low code example if true is received 3 or more times within 120 seconds the message is passed

```auto
[{"id":"9e8b475e121dbc44","type":"inject","z":"b9860b4b9de8c8da","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":1220,"wires":[["273f7fa9926adcd2"]]},{"id":"273f7fa9926adcd2","type":"join","z":"b9860b4b9de8c8da","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"120","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":330,"y":1220,"wires":[["f3112e493a231754"]]},{"id":"f3112e493a231754","type":"switch","z":"b9860b4b9de8c8da","name":"","property":"$count($$.payload)","propertyType":"jsonata","rules":[{"t":"gte","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":1220,"wires":[["315ace8e8c6cecae"]]},{"id":"315ace8e8c6cecae","type":"debug","z":"b9860b4b9de8c8da","name":"debug 288","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":1220,"wires":[]}]

```

[How to import a flow](https://nodered.org/docs/user-guide/editor/workspace/import-export)

---

<div class="post-metadata">

**Author:** ![dbs179](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dbs179/32/79738_2.png) [@dbs179](https://discourse.nodered.org/u/dbs179)\
**Post date:** [11 May 2023 12:20 UTC](https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341/3 "2023-05-11T12:20:39Z")

</div>

> [@E1cid](#):
>
> 120 seconds the message is passed

Thank you, this is exactly what I was looking for!!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 July 2023 12:20 UTC](https://discourse.nodered.org/t/trigger-a-flow-if-an-action-is-repeated-multiple-times-with-in-a-set-period-of-time/78341/4 "2023-07-10T12:20:49Z")

</div>

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