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?
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?
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
{
"topic": "cmnd/plug/backlog",
"payload": "pulsetime 1000; power on" // Switch relay on; turn off again after 15 minutes
}
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
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.
Have a look at my 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 which will do the closed loop control for you. The output from the PID node can be fed directly into the timeprop node.
I set it to 60 sec cycle - and fed in 0.25 but it seems to just output a 0 every 10 secs
[{"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"}}]
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.
Did you remember to click the inject button?
Yes but interestingly - 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.
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
Try with 0.25 again, did you click the inject node again after deploying the timeprop node?
Just outputs a 0 every 5 secs - I always press the inject ![]()
I think we need someone else to install it and see what happens with them ![]()
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?
It is now working - outputing a 0, 9 times in a row and then a 1, 3 times in row. ![]()
I generally set the trigger period to about 1% of the cycle time so you get a 1% accuracy in the times.