# Allow message to pass on the hour

**URL:** <https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897>\
**Category:** General\
**Created:** [10 July 2022 07:44 UTC](https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897 "2022-07-10T07:44:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harveyd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/harveyd/32/31436_2.png) [@harveyd](https://discourse.nodered.org/u/harveyd)\
**Post date:** [10 July 2022 07:44 UTC](https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897/1 "2022-07-10T07:44:36Z")

</div>

Hello All,

I'm currently logging mqtt messages containing temperature and humidity data to an SQLite database. The messages come in every minute. All these messages are saved to a table which I will eventually set up pruning on.

I also have a second table that I only want to store 1 messages every hour. I have setup a limit node to handle this, however this is reset every time I deploy so can end up with multiple messages within an hour.

Is there a simple way to allow a message to pass between on the hour and 1 minute past the hour e.g. 08:00-08:01, 09:00-09:01. My concern with this still would be if the mqtt message failed to send for whatever then no reading for that hour.

Maybe a gate opens on the hour and after the 1st message it closes? Any recommendations would be appreciated.

 ![Screenshot 2022-07-10 at 08.35.43](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c8d3bb5840d95a9d608a846e48a3c52bef59a87.png)

---

<div class="post-metadata">

**Author:** ![harveyd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/harveyd/32/31436_2.png) [@harveyd](https://discourse.nodered.org/u/harveyd)\
**Post date:** [10 July 2022 08:08 UTC](https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897/2 "2022-07-10T08:08:27Z")

</div>

I've simulated something like this which could work.

Any suggestions on something more efficient?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a580e8d9102cabe3a183384ea3a3b803447b3203.jpeg)

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:** [10 July 2022 08:55 UTC](https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897/3 "2022-07-10T08:55:45Z")

</div>

Maybe something like this

```auto
[{"id":"c925fae5.01a53","type":"inject","z":"bf9e1e33.030598","name":"every hour","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"0 0-23 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":560,"wires":[["ef8d58a5.238ea8"]]},{"id":"ef8d58a5.238ea8","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"pass","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":560,"wires":[[]]},{"id":"dd30854.5a92f78","type":"inject","z":"bf9e1e33.030598","name":"mqtt every minute","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/1 0-23 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":660,"wires":[["fedb4145.387a58","8997dfc4.c66288"]]},{"id":"fedb4145.387a58","type":"switch","z":"bf9e1e33.030598","name":"","property":"pass","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":720,"wires":[["4a6280d0.cb8be"]]},{"id":"4a6280d0.cb8be","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"pass","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":720,"wires":[["439694c8.af0c44"]]},{"id":"8997dfc4.c66288","type":"debug","z":"bf9e1e33.030598","name":"minute","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":500,"y":660,"wires":[]},{"id":"439694c8.af0c44","type":"debug","z":"bf9e1e33.030598","name":"hour","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":720,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![harveyd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/harveyd/32/31436_2.png) [@harveyd](https://discourse.nodered.org/u/harveyd)\
**Post date:** [10 July 2022 10:02 UTC](https://discourse.nodered.org/t/allow-message-to-pass-on-the-hour/64897/4 "2022-07-10T10:02:16Z")

</div>

Looks great, will give that a try. Thanks
