# How to trigger based on entity time in Node Red

**URL:** <https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010>\
**Category:** General\
**Created:** [1 August 2020 10:41 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010 "2020-08-01T10:41:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danielmurtagh](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Danielmurtagh](https://discourse.nodered.org/u/Danielmurtagh)\
**Post date:** [1 August 2020 10:41 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/1 "2020-08-01T10:41:43Z")

</div>

Hi All,

This might be a simple question but I am really struggling to find the right search terms to find an answer, so I am hoping someone can point me in the right direction.

I am new to both Home Assistant and Node Red and I have just started using Node Red for my HA automations. Its awesome!

I want to understand how I can use node red to run a sequence at a time specified in an entity. I have created some helpers in HA that allow me to specify time variables that I use to trigger automations. I am using a value template in HA automations to trigger the automation when the current time equals the helper time.

 ![7bba9b8878f5e48b631b6513647c072b0489588c](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d6b8f96b5a74865888f91de6e0a22c242121084.jpeg)

My question is, how would I achieve the same thing in Node Red?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 August 2020 10:50 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/2 "2020-08-01T10:50:51Z")

</div>

You can achieve this a few ways.

But one way I would do this is using node-red-contrib-cron-plus.

You can set a time by injecting a message into the Cron node.

It also has built in examples (use the node red import menu) demonstrating most of its features.

There is a dashboard demo I did showing how you might achieve it.

---

<div class="post-metadata">

**Author:** ![Danielmurtagh](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Danielmurtagh](https://discourse.nodered.org/u/Danielmurtagh)\
**Post date:** [2 August 2020 09:25 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/3 "2020-08-02T09:25:02Z")

</div>

Hi Steve-Mcl,

Thanks for the reply! I have been taking a look at your suggestion today but to be honest I'm finding it a little hard to follow.... I'm really a novice. Are you able to give me a few pointers in the right direction for how I could use cron-plus for this?

I also was tinkering with this flow (included below) last night but unfortunately, I couldn't get it to work. I am not sure if I am on the right track with this approach, but any feedback would be appreciated.

Thanks for your help.

```auto
[{"id":"792130b3.d1564","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"8f4623af.41fff","type":"inject","z":"792130b3.d1564","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":160,"wires":[["a8f66c20.b0e9f"]]},{"id":"2ca077b6.619ef8","type":"poll-state","z":"792130b3.d1564","name":"","server":"666b1cf9.686414","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"1","updateIntervalUnits":"seconds","outputinitially":true,"outputonchanged":true,"entity_id":"input_datetime.graterontime","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":210,"y":260,"wires":[["36875f48.dc894"]]},{"id":"1ea04f7b.6df4e1","type":"function","z":"792130b3.d1564","name":"","func":"var trueMsg = {payload: \"true\"};\nvar falseMsg = {payload: \"false\"};\n\nif('msg.currentTime' == 'msg.triggerTime') {\n return [trueMsg];\n} else {\n return [falseMsg];\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800,"y":200,"wires":[["a67a8f29.4ee33"]]},{"id":"a67a8f29.4ee33","type":"debug","z":"792130b3.d1564","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":200,"wires":[]},{"id":"a8f66c20.b0e9f","type":"simpletime","z":"792130b3.d1564","name":"","mydate":false,"myymd":false,"myyear":false,"mymonth":false,"mymonthn":false,"mydom":false,"mydoy":false,"myday":false,"myhourpm":false,"myhour":false,"mytime":true,"mytimes":true,"myminute":false,"myminutes":false,"mysecond":false,"mymillis":false,"myepoch":false,"myrawdate":false,"mypm":false,"x":350,"y":160,"wires":[["102a4d7c.bcbf03"]]},{"id":"9c5ae0f.88cf22","type":"debug","z":"792130b3.d1564","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"currentTime","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":100,"wires":[]},{"id":"9b4b3075.55fa5","type":"debug","z":"792130b3.d1564","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"triggerTime","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":320,"wires":[]},{"id":"36875f48.dc894","type":"change","z":"792130b3.d1564","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"triggerTime","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":260,"wires":[["9b4b3075.55fa5","1ea04f7b.6df4e1"]]},{"id":"102a4d7c.bcbf03","type":"change","z":"792130b3.d1564","name":"","rules":[{"t":"move","p":"mytimes","pt":"msg","to":"currentTime","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":160,"wires":[["1ea04f7b.6df4e1","9c5ae0f.88cf22"]]},{"id":"666b1cf9.686414","type":"server","z":"","name":"Home Assistant","addon":true}]

```

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [2 August 2020 13:57 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/4 "2020-08-02T13:57:38Z")

</div>

Have you looked at the NR red Add-on for HA that presents webhooks and entitiy states/reflections ?

Have a look at this thread

> **[Node-red-contrib-home-assistant-websocket](https://community.home-assistant.io/t/node-red-contrib-home-assistant-websocket/71032/538)**
>
> That’s it 🙂 Thanks for sharing! That wasn’t obvious from the docs.

Its a long read but well worthwhile - lots of good examples and explanation of how he hooks entity states and changes etc

Craig

---

<div class="post-metadata">

**Author:** ![Danielmurtagh](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Danielmurtagh](https://discourse.nodered.org/u/Danielmurtagh)\
**Post date:** [5 August 2020 09:06 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/5 "2020-08-05T09:06:17Z")

</div>

Thanks Craig! I’ll check it out.

---

<div class="post-metadata">

**Author:** ![Danielmurtagh](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Danielmurtagh](https://discourse.nodered.org/u/Danielmurtagh)\
**Post date:** [9 August 2020 04:37 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/6 "2020-08-09T04:37:56Z")

</div>

Thanks for your time @Steve-Mcl and @craigcurtin. I also received some advice from the HA community on this issue and [this](https://community.home-assistant.io/t/how-to-trigger-based-on-entity-time-in-node-red/212082/2?u=danielmurtagh) ended up being the best solve for me.

Thanks for your assistance, I really appreciate it!

---

<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:** [23 August 2020 04:37 UTC](https://discourse.nodered.org/t/how-to-trigger-based-on-entity-time-in-node-red/31010/7 "2020-08-23T04:37:58Z")

</div>

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