# Duty power cycling a heater

**URL:** <https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172>\
**Category:** General\
**Created:** [16 November 2026 12:48 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172 "2026-11-16T12:48:11Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 12:48 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/1 "2026-11-16T12:48:11Z")

</div>

I want to switch a fan heater on and off with variable on/off times  
e.g set on time for x mins - off time for y mins

Anybody doing this and got a simple flow I could borrow?

---

<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:** [16 November 2026 12:59 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/2 "2026-11-16T12:59:42Z")

</div>

Are you using a smart relay? What sort?

I do it with a smart plug running Tasmota, but the fan heater is only on low, about 500W.

The mqtt message to do it is something like

```auto
{
"topic": "cmnd/plug/backlog",
"payload": "pulsetime 1000; power on" // Switch relay on; turn off again after 15 minutes
}

```

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 13:03 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/3 "2026-11-16T13:03:22Z")

</div>

No - just a standard Zigbee switch controlled via Zigbee2MQTT

I'd like the logic control to be in NodeRED - not to use any in-built device facility so I can re-use it with any smart switch

---

<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:** [16 November 2026 13:11 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/4 "2026-11-16T13:11:05Z")

</div>

I dont have zigbee so I'm no use to you 🙃

I use Tasmota partly because it has a web console so I can fiddle with it outside of NR and MQTT.

And I like the pulsetime approach because it avoids the plug missing a turn off command due to network issues. No chance of boiling the aquarium.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 13:25 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/5 "2026-11-16T13:25:27Z")

</div>

Have a look at my [node-red-contrib-timeprop](https://flows.nodered.org/node/node-red-contrib-timeprop). You can set a cycle time and feed in via messages the current duty cycle required. So for example, if you specified a 60 second cycle time and fed in 0.25 then it would be on for 15 seconds and off for 45.

If you are using this to control the temperature then you might also like to have a look at [node-red-contrib-pid](https://flows.nodered.org/node/node-red-contrib-pid) which will do the closed loop control for you. The output from the PID node can be fed directly into the timeprop node.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 13:32 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/6 "2026-11-16T13:32:19Z")

</div>

I set it to 60 sec cycle - and fed in 0.25 but it seems to just output a 0 every 10 secs

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e369ca61f0d617d30b472531ec3e1043890381d8.png)

```auto
[{"id":"c9dfe61d15540484","type":"debug","z":"c8105042f10dd02a","name":"debug 97","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":412,"y":628,"wires":[]},{"id":"b1494f62db28c009","type":"timeprop","z":"c8105042f10dd02a","name":"","cycleTime":"60","deadTime":0,"triggerPeriod":10,"invert":false,"x":232,"y":628,"wires":[["c9dfe61d15540484"]]},{"id":"92cfbd406d774671","type":"inject","z":"c8105042f10dd02a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0.25","payloadType":"num","x":92,"y":628,"wires":[["b1494f62db28c009"]]},{"id":"9010c21696548891","type":"global-config","env":[],"modules":{"node-red-contrib-timeprop":"2.0.0"}}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 13:57 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/7 "2026-11-16T13:57:08Z")

</div>

That flow is working for me, though it is better if you set the trigger time lower (that controls how often it sends an output). Set it to 5 seconds for example.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 13:57 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/8 "2026-11-16T13:57:55Z")

</div>

Did you remember to click the inject button?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 13:59 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/9 "2026-11-16T13:59:04Z")

</div>

Just outputting every 5 ses now

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/280a4deac818f6befbd6de912097475e14ef9695.png)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 14:00 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/10 "2026-11-16T14:00:31Z")

</div>

Yes but interestingly - it just starts running even if I don't - very strange

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 14:14 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/11 "2026-11-16T14:14:04Z")

</div>

> [@cymplecy](#):
>
> it just starts running even if I don't - very strange

It starts running immediately, assuming an initial input of zero. When you send in a message it should change to the required duty cycle. Is it now working? If not, what happens if you feed in 1? I am sure there is nothing wrong with the node, I see I first released it 10 years ago tomorrow.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 14:15 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/12 "2026-11-16T14:15:47Z")

</div>

If i send in a 1 - it outs a 1 every 5 secs  
[edit] sending in 0.5 - just goes back to outputting a zero every 5 secs

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 14:16 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/13 "2026-11-16T14:16:57Z")

</div>

Try with 0.25 again, did you click the inject node again after deploying the timeprop node?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 14:17 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/14 "2026-11-16T14:17:55Z")

</div>

Just outputs a 0 every 5 secs - I always press the inject 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 14:18 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/15 "2026-11-16T14:18:28Z")

</div>

I think we need someone else to install it and see what happens with them 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 14:22 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/16 "2026-11-16T14:22:21Z")

</div>

This is ridiculous. What version of node-red and nodejs are you using? What is node-red running on.  
What version of the timeprop node is it?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [16 November 2026 14:25 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/17 "2026-11-16T14:25:33Z")

</div>

It is now working - outputing a 0, 9 times in a row and then a 1, 3 times in row. 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2026 14:30 UTC](https://discourse.nodered.org/t/duty-power-cycling-a-heater/102172/18 "2026-11-16T14:30:14Z")

</div>

I generally set the trigger period to about 1% of the cycle time so you get a 1% accuracy in the times.
