# Auto on - time limited switch

**URL:** <https://discourse.nodered.org/t/auto-on-time-limited-switch/75873>\
**Category:** General\
**Created:** [28 February 2023 13:46 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873 "2023-02-28T13:46:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluescreentt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bluescreentt/32/52541_2.png) [@bluescreentt](https://discourse.nodered.org/u/bluescreentt)\
**Post date:** [28 February 2023 13:46 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/1 "2023-02-28T13:46:11Z")

</div>

Hi

not sure i'm in the right forum but ill try

i am trying to automate a ventilation motor on the roof.  
i want it to be auto on.  
between 06:00 and 22:00  
in this period i want to be able to turn it off for X time and then turn on by auto again.  
if i turn it off after 22:00 before 06:00 it stays off untill 0600 then it turns on again.

it kind of works. if i just restart Node-Red it dont work but if i activate the switch first it works within the timeframe. if i turn it off outside the time frame it do not start again att 06:00

this is what i made.

[flows (2).json](https://discourse.nodered.org/uploads/short-url/tdxkKmuCmQJIarN0YbX1XDhUzIW.json) (1.7 KB)

am i way off or do i almost have it ?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 February 2023 15:42 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/2 "2023-02-28T15:42:02Z")

</div>

I imported your flow into my Node-red but since I don't use Home Assistant this is all I got:

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

Not many people here use HA; you will probably get more help on the HA forum.

However, doing it unencumbered by Home Assistant might look like this

 ![Untitled 6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/285ea5805b29760479b238483f00cc6d79151926.jpeg)

---

<div class="post-metadata">

**Author:** ![bluescreentt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bluescreentt/32/52541_2.png) [@bluescreentt](https://discourse.nodered.org/u/bluescreentt)\
**Post date:** [28 February 2023 19:46 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/3 "2023-02-28T19:46:59Z")

</div>

Thank you for the tip  
but it was to complicated for me ☹

need to read up somewhere

is it possible to write in ladder or boolean in node-red

---

<div class="post-metadata">

**Author:** ![Keesromkes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/keesromkes/32/16634_2.png) [@Keesromkes](https://discourse.nodered.org/u/Keesromkes)\
**Post date:** [28 February 2023 20:34 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/4 "2023-02-28T20:34:31Z")

</div>

[node-red-contrib-stoptimer2 (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-stoptimer2) works pretty well for me, assuming the time X you mentioned is fixed and not variable. There are other nodes that do more with time, but KISS.

---

<div class="post-metadata">

**Author:** ![bluescreentt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bluescreentt/32/52541_2.png) [@bluescreentt](https://discourse.nodered.org/u/bluescreentt)\
**Post date:** [1 March 2023 06:17 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/5 "2023-03-01T06:17:43Z")

</div>

yes the time X is a constant

it also works here if i first activate the switch and then turn it off again then it starts after X time BUT  
if i restart Node-red / the server it will not work  
also if i deploys flow after a reconfigure it will not auto start

---

<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:** [30 April 2023 06:18 UTC](https://discourse.nodered.org/t/auto-on-time-limited-switch/75873/6 "2023-04-30T06:18:08Z")

</div>

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