Recommended scheduling for roller-shutters

What is the recommended way to handle relays to control multiple length roller-shutters?

This "trivial" task is getting more and more complex as I start to dig into it.

Details:

1 Start / Stop + 1 Direction relay for each roller engine. (8+8 total)
Need to wait 0.2 sec to first set direction before powering,
and turn off direction relay 0.2 sec after movement stops.

Needed basic functions:

  • Full Up / Down (10 or 22sec depending small roller or bit)
  • Half Up/Dw
  • Stop
  • Toggle mode (down >> stop >> up >> stop >> down ...)
  • ALL up / down / half ... / stop / schedule ...
  • Some UP [1,2,5,6,7] at sunrise (not the bedroom 2)

Later (wish):

  • Some Half-UP at sunrise if temp > 25 & not cloudy .... etc
  • luminance meter + temp + sun-posiotion based "shadowing" functions

Ok, not too difficult with the standard nodes supplied.

Incoming message.

Detect direction and switch accordingly.

Set direction relay.

Delay

Set power relay.

Delay for blinds to open/close

Set power relay (OFF)

delay

Set direction relay (OFF/release)

The sun times is easy to get from big-timer node (external)

See if you can get a flow with what I showed you here.

For now, don't worry if it is (or seems to be) complex.
You have to start somewhere and anywhere is better than only having a concept of what you want to do.

Here is my Current Flow so far:

[{"id":"e8546434.671928","type":"inject","z":"2c9fbd1d.903c7a","name":"UP (Off =1)","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["81c20494.7c8478","3375bca8.71d844"]],"icon":"font-awesome/fa-angle-double-up"},{"id":"7df15971.965ac","type":"inject","z":"2c9fbd1d.903c7a","name":"DW (On=0)","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["81c20494.7c8478","7731bbcf.67c2ac"]],"icon":"font-awesome/fa-angle-double-down"},{"id":"81c20494.7c8478","type":"delay","z":"2c9fbd1d.903c7a","name":"0.2sec ON","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":410,"y":180,"wires":[["25070ce0.ad105c"]]},{"id":"25070ce0.ad105c","type":"trigger","z":"2c9fbd1d.903c7a","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"7","extend":true,"units":"s","reset":"","bytopic":"all","name":"Start-wait-Stop","x":600,"y":180,"wires":[["de8c3f6d.538bf8"]]},{"id":"7731bbcf.67c2ac","type":"trigger","z":"2c9fbd1d.903c7a","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"5","extend":true,"units":"s","reset":"","bytopic":"all","name":"Down-Wait-Off","x":420,"y":140,"wires":[["3375bca8.71d844"]]},{"id":"e179059b.3a7838","type":"inject","z":"2c9fbd1d.903c7a","name":"STOP","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"0.3","x":390,"y":100,"wires":[["80662aeb.fdc588","de8c3f6d.538bf8"]],"icon":"font-awesome/fa-ban"},{"id":"80662aeb.fdc588","type":"trigger","z":"2c9fbd1d.903c7a","op1":"","op2":"true","op1type":"nul","op2type":"bool","duration":"0.4","extend":false,"units":"s","reset":"","bytopic":"all","name":"Stop2 direction","x":600,"y":100,"wires":[["3375bca8.71d844"]]},{"id":"3375bca8.71d844","type":"gpio out","z":"2c9fbd1d.903c7a","name":"Relay16 - Pin17","state":"OUTPUT","pin":"17","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"22aaadef.1e643a","x":860,"y":120,"wires":[]},{"id":"de8c3f6d.538bf8","type":"gpio out","z":"2c9fbd1d.903c7a","name":"Relay08 - Pin09","state":"OUTPUT","pin":"9","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"22aaadef.1e643a","x":860,"y":180,"wires":[]},{"id":"37b8a598.23bad2","type":"comment","z":"2c9fbd1d.903c7a","name":">> TODO","info":"","x":220,"y":220,"wires":[]},{"id":"179be049.5ef688","type":"inject","z":"2c9fbd1d.903c7a","name":"Half-UP","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":86.19999694824219,"y":80.19999694824219,"wires":[[]],"icon":"font-awesome/fa-angle-up"},{"id":"fee04ba5.99cc28","type":"inject","z":"2c9fbd1d.903c7a","name":"Half-DW","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":220,"wires":[[]],"icon":"font-awesome/fa-angle-down"},{"id":"1d066d01.ac2f9b","type":"comment","z":"2c9fbd1d.903c7a","name":">> TODO","info":"","x":200,"y":80,"wires":[]},{"id":"a229c9b8.cc2be8","type":"comment","z":"2c9fbd1d.903c7a","name":"TODO: Cancel running timers if...","info":"If changed suddenly direction or clicking STOP\nAll waiting timers should be canceled","x":150,"y":280,"wires":[]},{"id":"2232fa8f.f1705e","type":"comment","z":"2c9fbd1d.903c7a","name":"TODO: Copy this flow 8x & set other relay numbers","info":"","x":210,"y":320,"wires":[]},{"id":"d5c68557.90b8c","type":"sunpos","z":"2c9fbd1d.903c7a","name":"","lon":"","lat":"","start":"sunrise","startoffset":0,"end":"sunset","endoffset":0,"x":520,"y":280,"wires":[[]]},{"id":"5215109a.2d80e","type":"comment","z":"2c9fbd1d.903c7a","name":"TODO: create \"ALL\" buttons for all 5 cases","info":"","x":180,"y":360,"wires":[]},{"id":"22aaadef.1e643a","type":"nodebot","z":"","name":"RedonyNanoFirmata USB0","username":"","password":"","boardType":"firmata","serialportName":"/dev/ttyUSB0","connectionType":"local","mqttServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":"","uuid":"","token":"","sendUuid":""}]

@Trying_to_learn Thanks for the quick answer, but the "simple" way is not working, because it can NOT cancel running delays and triggers.

Currently I'm investigang following methods to decide what would be best to solve this:

  • using contexts with unique IDs to remember "current / last state"
  • insert switches to decide if the original command has been ovveriden to drop execution of timer-based triggers
  • maybe creating timer-arrays as here ?
  • how to make more complex JSONATA templates + messages to store multiple infos like:
    {
    name: "livingroom",
    time-to-full-roll: 22,
    half-roll: 5,
    last_direction: "DW",
    current_state: "rolling"
    }

Is it possible, somehow to use "events" to notify [1,2,5] to "go full Up" ?

Sorry, I didn't look at the actual flow. I was writing my own take.

Please have a look at this. No special nodes.

Zoom it so the entire flow is visible and press any of the buttons: FWD, REV, Half UP, Half DOWN.

Watch the payloads come out and check you are happy.

Then try the STOP button.

[{"id":"67b8edc1.d9b56c","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n//  turn on motor.\n//\n\n//  Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":3540,"wires":[["73bfac2e.59945c","a15221f4.3216f","ffe6301b.8d0e18"]]},{"id":"5fccfc50.27513c","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3540,"wires":[["67b8edc1.d9b56c"]]},{"id":"73bfac2e.59945c","type":"delay","z":"703c61ac.837e1","name":"Blinds in motion","pauseType":"delayv","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":550,"y":3670,"wires":[["59be7d4b.bd03b4"]]},{"id":"a15221f4.3216f","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":3590,"wires":[]},{"id":"ffe6301b.8d0e18","type":"debug","z":"703c61ac.837e1","name":"Delay","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"delay","targetType":"msg","statusVal":"delay","statusType":"auto","x":750,"y":3490,"wires":[]},{"id":"331c955a.aa41da","type":"function","z":"703c61ac.837e1","name":"Set DIRECTION per payload","func":"msg.direction = msg.payload;\n//\n//  Set GPIO pin depending on message\n//\n\n\n//  Set message for next stage.\nmsg.payload = \"ON\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":3400,"wires":[["5fccfc50.27513c","1657da4.0f9a2a6"]]},{"id":"3de03a0c.65d78e","type":"inject","z":"703c61ac.837e1","name":"STOP!","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":3670,"wires":[["5fccfc50.27513c","73bfac2e.59945c","5ee8fd36.fcbb9c"]]},{"id":"59be7d4b.bd03b4","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n//  turn on motor.\n//\n\n//  Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":3670,"wires":[["b30f2d87.b92e58","969983b8.09ceb"]]},{"id":"b34615ab.8fc07","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3380,"wires":[["331c955a.aa41da"]]},{"id":"938a1080.8df348","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":340,"y":3420,"wires":[["331c955a.aa41da"]]},{"id":"1657da4.0f9a2a6","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"direction","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":3590,"wires":[]},{"id":"a5b1d077.a568a8","type":"inject","z":"703c61ac.837e1","name":"Half up","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3290,"wires":[["331c955a.aa41da"]]},{"id":"371313bb.963e8c","type":"inject","z":"703c61ac.837e1","name":"Half down","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":350,"y":3330,"wires":[["331c955a.aa41da"]]},{"id":"5ee8fd36.fcbb9c","type":"change","z":"703c61ac.837e1","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":3710,"wires":[["59be7d4b.bd03b4"]]},{"id":"b30f2d87.b92e58","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":3810,"wires":[]},{"id":"969983b8.09ceb","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3760,"wires":[["73f3ab00.97045c"]]},{"id":"73f3ab00.97045c","type":"function","z":"703c61ac.837e1","name":"Release direction control","func":"msg.payload = \"Release\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":3760,"wires":[["68a163af.22f8f4"]]},{"id":"68a163af.22f8f4","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":3810,"wires":[]}]

I wrote it like this (blocky) to not confuse you with what was happening.

The function nodes need work to actually do anything.
You could nearly just connect the GPIO nodes to the function nodes.

I'll leave that part to you.
But do you see what I am doing?

Update:

This is a slightly bigger/better flow.

The stuff on the right is now better explained where it goes and what it does.

You will have to check the 1 and 0 are correct. But it isn't rocket science.

[{"id":"67b8edc1.d9b56c","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n//  turn on motor.\n//\n\n//  Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":3540,"wires":[["73bfac2e.59945c","a15221f4.3216f","ffe6301b.8d0e18","57c6aa4d.2463a4"]]},{"id":"5fccfc50.27513c","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3540,"wires":[["67b8edc1.d9b56c"]]},{"id":"73bfac2e.59945c","type":"delay","z":"703c61ac.837e1","name":"Blinds in motion","pauseType":"delayv","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":550,"y":3670,"wires":[["59be7d4b.bd03b4"]]},{"id":"a15221f4.3216f","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":3590,"wires":[]},{"id":"ffe6301b.8d0e18","type":"debug","z":"703c61ac.837e1","name":"Delay","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"delay","targetType":"msg","statusVal":"delay","statusType":"auto","x":750,"y":3490,"wires":[]},{"id":"57c6aa4d.2463a4","type":"function","z":"703c61ac.837e1","name":"","func":"if (msg.motor == \"ON\")\n{\n    msg.payload = 1;\n} else\nmsg.payload = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1130,"y":3540,"wires":[["1212ec0a.d8ebcc"]]},{"id":"331c955a.aa41da","type":"function","z":"703c61ac.837e1","name":"Set DIRECTION per payload","func":"msg.direction = msg.payload;\n//\n//  Set GPIO pin depending on message\n//\n\n\n//  Set message for next stage.\nmsg.payload = \"ON\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":3400,"wires":[["5fccfc50.27513c","1657da4.0f9a2a6","160b4919.847b87"]]},{"id":"3de03a0c.65d78e","type":"inject","z":"703c61ac.837e1","name":"STOP!","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":3670,"wires":[["5fccfc50.27513c","73bfac2e.59945c","5ee8fd36.fcbb9c"]]},{"id":"59be7d4b.bd03b4","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n//  turn on motor.\n//\n\n//  Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":3670,"wires":[["b30f2d87.b92e58","969983b8.09ceb","57c6aa4d.2463a4"]]},{"id":"1212ec0a.d8ebcc","type":"debug","z":"703c61ac.837e1","name":"TO GPIO PIN for motor ON/OFF","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1380,"y":3540,"wires":[]},{"id":"b34615ab.8fc07","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3380,"wires":[["331c955a.aa41da"]]},{"id":"938a1080.8df348","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":340,"y":3420,"wires":[["331c955a.aa41da"]]},{"id":"1657da4.0f9a2a6","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"direction","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":3590,"wires":[]},{"id":"a5b1d077.a568a8","type":"inject","z":"703c61ac.837e1","name":"Half up","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3290,"wires":[["331c955a.aa41da"]]},{"id":"371313bb.963e8c","type":"inject","z":"703c61ac.837e1","name":"Half down","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":350,"y":3330,"wires":[["331c955a.aa41da"]]},{"id":"160b4919.847b87","type":"function","z":"703c61ac.837e1","name":"","func":"if (msg.direction == \"FWD\")\n{\n    msg.payload = 1;\n} else\nmsg.payload = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1140,"y":3400,"wires":[["e8fd2650.75467"]]},{"id":"5ee8fd36.fcbb9c","type":"change","z":"703c61ac.837e1","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":3710,"wires":[["59be7d4b.bd03b4"]]},{"id":"b30f2d87.b92e58","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":3810,"wires":[]},{"id":"969983b8.09ceb","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3760,"wires":[["73f3ab00.97045c"]]},{"id":"e8fd2650.75467","type":"debug","z":"703c61ac.837e1","name":"TO GPIO PIN for direction control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1390,"y":3400,"wires":[]},{"id":"73f3ab00.97045c","type":"function","z":"703c61ac.837e1","name":"Release direction control","func":"msg.payload = \"Release\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":3760,"wires":[["68a163af.22f8f4","160b4919.847b87"]]},{"id":"68a163af.22f8f4","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":3810,"wires":[]}]
1 Like

Oh, when you post flows like that:

Replace the GPIO nodes with a debug node.

No one is going to load that node to test the flow.

The debug will suffice to see what is going on.

How about we get the idea working.

Then work on making it able to handle multiple instances.
Because once you get the idea working for one, it is easy to reproduce it multiple times over for multiple instances. All you need to do is add just a bit more code.

This is getting in to the realm of subflows. But baby steps at the beginning.

Thank you for all the time you're trying to help me and the examples!!
I've investigated many hours long trying to understand your concept, still I can not find evidence your solution would CANCEL the running delay/timer if giving a new order.

What happens if you press the STOP! node?

That resets the delays and resets the controls to the relays.

You MUST press the STOP! button if you want things to stop, or you want to do something else before that event has concluded.

Can you see how the messages are sent when you press either of the 4 direction buttons.
Then, if they are happening and you press the STOP! button, the messages are sent to release the power relay then shortly after the direction relay.

You will have to adjust the logic to get the directions right.

Here is a walk through of the messages.
Colour code sequence: BLACK WHITE RED ORANGE

BLACK: FWD pressed. You see the messages. A 1 is sent to the GPIO pin to control direction.

WHITE: A delay then you see the ON message and a 1 being sent to the motor power GPIO pin.

RED: (You press the STOP! button)
An OFF signal is sent.

(See the second picture. It is a bit clearer.)

Follow the red link. It goes through a change node and sets the message to "OFF"
That then sends a 0 to the motor power GPIO pin.

You get a "release" message - which releases the direction relay - and you see the 0 sent to that.

If left alone that will happen with the correct times.

If you press the "half" buttons, the time will be halved.

There is a slight trick to that which I will explain later, once you understand this much.

after some days of learning and searching through NodeRed topics, I've finally found the solution how to avoid race condition.
It is possible to change the time and to reset the Delay nodes !

Here is an example I've made:

Here is a picture about one shutter flow. All the other 7 look like this too. (Sorry that it's not english)

Basically I'm "building" up a msg with different values, like:
msg.rolltime = 20000;
mgs.direction = "UP";
... etc
Just like previously @Trying_to_learn recommended.

This whole thing is than copied 8x , and so I can easily set different time to: up / down / half-down ... to all shutters.
The green node is an OpenHAB connection to control it from a Dashboard too.

The real solution under the hood is however inside the SubFlow

[{"id":"81c20494.7c8478","type":"delay","z":"b0fd0f88.94ee28","name":"0.2sec ON","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":220,"wires":[["3ea97fc6.8792c"]]},{"id":"a4fd1cba.daa5b","type":"change","z":"b0fd0f88.94ee28","name":"reset minden delay","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":300,"wires":[["61dafd8b.29ec64","81c20494.7c8478","74fd31f5.c44388"]],"outputLabels":["erewrgsgf"]},{"id":"a787ef30.a46a98","type":"switch","z":"b0fd0f88.94ee28","name":"Fel? Stop? Le?","property":"irany","propertyType":"msg","rules":[{"t":"eq","v":"FEL","vt":"str"},{"t":"eq","v":"STOP","vt":"str"},{"t":"eq","v":"LE","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":260,"y":120,"wires":[["81c20494.7c8478","7714f6c5.4e79f8"],["7735a6af.805c98"],["81c20494.7c8478","8e4e6ffe.95dc9"]]},{"id":"cad0e990.b61ef8","type":"rbe","z":"b0fd0f88.94ee28","name":"Ha van irány változás","func":"rbe","gap":"","start":"","inout":"out","property":"irany","x":220,"y":200,"wires":[[]]},{"id":"4f9478bd.e80e98","type":"switch","z":"b0fd0f88.94ee28","name":"irány relék","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"nappali_rd","vt":"str"},{"t":"eq","v":"konyhai_rd","vt":"str"},{"t":"eq","v":"furdo_rd","vt":"str"},{"t":"eq","v":"szoba1_kisAblak_rd","vt":"str"},{"t":"eq","v":"szoba1_AJTO_rd","vt":"str"},{"t":"eq","v":"szoba2_AJTO_rd","vt":"str"},{"t":"eq","v":"szoba2_kisAblak_rd","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"false","repair":false,"outputs":8,"x":1070,"y":60,"wires":[["3375bca8.71d844"],["cd809ad3.c6fe18"],["e4fca6a0.936708"],["91383dbb.73ee3"],["4b19d6b3.0e1c9"],["ed0b1fb0.7ad5d8"],["128b319c.c7b356","fc260fa2.27d808"],["fc260fa2.27d808"]]},{"id":"bc0a8c66.04ce28","type":"switch","z":"b0fd0f88.94ee28","name":"StartStop Relék","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"nappali_rd","vt":"str"},{"t":"eq","v":"konyhai_rd","vt":"str"},{"t":"eq","v":"furdo_rd","vt":"str"},{"t":"eq","v":"szoba1_kisAblak_rd","vt":"str"},{"t":"eq","v":"szoba1_AJTO_rd","vt":"str"},{"t":"eq","v":"szoba2_AJTO_rd","vt":"str"},{"t":"eq","v":"szoba2_kisAblak_rd","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"false","repair":false,"outputs":8,"x":1240,"y":540,"wires":[["de8c3f6d.538bf8"],["58154556.f7aa64"],["bdb78f8a.368d4"],["a9af3149.c446b"],["50d71f61.4d5b88"],["7fba2cca.7b7dcc"],["2240be8c.7fda6a"],["7618f187.fa7bc8"]]},{"id":"5d3ef2f9.44b164","type":"delay","z":"b0fd0f88.94ee28","name":"5ms","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":110,"y":120,"wires":[["a787ef30.a46a98"]]},{"id":"61dafd8b.29ec64","type":"delay","z":"b0fd0f88.94ee28","name":"Stop 0.2s","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":840,"y":220,"wires":[["4f9478bd.e80e98"]]},{"id":"72bc6ddb.95341c","type":"comment","z":"b0fd0f88.94ee28","name":"Ha felülbírálódik > rögtön reset minden","info":"","x":270,"y":340,"wires":[]},{"id":"7735a6af.805c98","type":"change","z":"b0fd0f88.94ee28","name":"Kikapcs","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":360,"wires":[["bc0a8c66.04ce28","61dafd8b.29ec64","5c5ca9cf.3a3018"]]},{"id":"4d17e7.6ecc0018","type":"comment","z":"b0fd0f88.94ee28","name":"UP (Off =1)","info":"","x":1070,"y":140,"wires":[]},{"id":"a19491dd.a9a4e","type":"comment","z":"b0fd0f88.94ee28","name":"DW (On=0)","info":"","x":1070,"y":180,"wires":[]},{"id":"3ea97fc6.8792c","type":"change","z":"b0fd0f88.94ee28","name":"vár idő","rules":[{"t":"set","p":"delay","pt":"msg","to":"ido","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":360,"wires":[["bc0a8c66.04ce28","74fd31f5.c44388"]]},{"id":"74fd31f5.c44388","type":"delay","z":"b0fd0f88.94ee28","name":"megymegy","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":850,"y":360,"wires":[["7735a6af.805c98"]]},{"id":"5c5ca9cf.3a3018","type":"change","z":"b0fd0f88.94ee28","name":"VÉGE","rules":[{"t":"set","p":"irany","pt":"msg","to":"LEALLT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1250,"y":440,"wires":[[]]},{"id":"8e4e6ffe.95dc9","type":"change","z":"b0fd0f88.94ee28","name":"LEfele","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":140,"wires":[["4f9478bd.e80e98"]]},{"id":"7714f6c5.4e79f8","type":"change","z":"b0fd0f88.94ee28","name":"FEÉfele","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":100,"wires":[["4f9478bd.e80e98"]]}]

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