# Can anybody tell me what node i can use to switch on a relay for 3 seconds

**URL:** <https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653>\
**Category:** General\
**Created:** [29 September 2021 06:31 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653 "2021-09-29T06:31:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparky/32/65054_2.png) [@sparky](https://discourse.nodered.org/u/sparky)\
**Post date:** [29 September 2021 06:31 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/1 "2021-09-29T06:31:24Z")

</div>

good day  
can anybody tell me what node i can use to switch on a relay for 3 seconds

---

<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:** [29 September 2021 06:32 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/2 "2021-09-29T06:32:59Z")

</div>

Trigger node (and something to start the flow like a UI button or inject node)

E.g.

Inject \> trigger \> your-relay-node

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [29 September 2021 06:39 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/3 "2021-09-29T06:39:25Z")

</div>

Here is how I control one of my blinds by activating a relay that simulates a press on the remote control button

```auto
[{"id":"2ae520f2e33428fd","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"bb898f1fbb7cf2f6","type":"delay","z":"2ae520f2e33428fd","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":460,"y":180,"wires":[["1006b2767f798513"]]},{"id":"039e470f5f32386d","type":"mqtt out","z":"2ae520f2e33428fd","name":"Relais 6","topic":"cmnd/ESP-Stores/POWER3","qos":"","retain":"","broker":"702ec46.d6e003c","x":740,"y":160,"wires":[]},{"id":"1006b2767f798513","type":"function","z":"2ae520f2e33428fd","name":"OFF","func":"msg.payload = 'OFF'\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":180,"wires":[["039e470f5f32386d"]]},{"id":"59a7628d3f584be7","type":"function","z":"2ae520f2e33428fd","name":"ON","func":"msg.payload = 'ON'\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":160,"wires":[["039e470f5f32386d","bb898f1fbb7cf2f6"]]},{"id":"332531dab392cc3e","type":"switch","z":"2ae520f2e33428fd","name":"Store Sud","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":160,"y":180,"wires":[["59a7628d3f584be7"],[]]},{"id":"702ec46.d6e003c","type":"mqtt-broker","name":"MQTT-Debian64","broker":"192.168.1.160","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<div class="post-metadata">

**Author:** ![sparky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparky/32/65054_2.png) [@sparky](https://discourse.nodered.org/u/sparky)\
**Post date:** [29 September 2021 07:21 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/4 "2021-09-29T07:21:56Z")

</div>

I'm new to this and i'm trying to automate my house please give more detail on how to use this sring of code

---

<div class="post-metadata">

**Author:** ![sparky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparky/32/65054_2.png) [@sparky](https://discourse.nodered.org/u/sparky)\
**Post date:** [29 September 2021 07:25 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/5 "2021-09-29T07:25:34Z")

</div>

thank you but please tell me how to set up (Inject \> trigger \> your-relay-node) im new to this and trying to automate my house as a project

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [29 September 2021 07:27 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/6 "2021-09-29T07:27:41Z")

</div>

open your flow editor, go to the top right menu, click on "Import" and paste the example I gave you. Then you can study how it works by opening each node. This is very telling by itself.

---

<div class="post-metadata">

**Author:** ![sparky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sparky/32/65054_2.png) [@sparky](https://discourse.nodered.org/u/sparky)\
**Post date:** [29 September 2021 07:45 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/7 "2021-09-29T07:45:26Z")

</div>

ok thank you i will try  
now im having a problem opening node-red it cant connect to server

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [29 September 2021 08:11 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/8 "2021-09-29T08:11:52Z")

</div>

what happens when you run the node-red-start command from the console? Please put a screenshot

---

<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:** [28 November 2021 08:12 UTC](https://discourse.nodered.org/t/can-anybody-tell-me-what-node-i-can-use-to-switch-on-a-relay-for-3-seconds/51653/9 "2021-11-28T08:12:45Z")

</div>

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