Roller Shutter close at specific time

Hello Im new! I made a node that if I switch the light on (in a specific time range 21 till 5 ) the roller shutter will close.

The Problem is, that if I switch the light on at 20:30 clock and than wait till 21 clock the roller shutter will not close. Only if I switch the light off and on again the roller shutter will close

Hi and welcome to the forum.

Alas you are using a lot of foreign nodes and not all people are going to have those nodes.
This makes it difficult for everyone to help you with.

Looking at the flow, the door status is set by the light status. Which is fair enough.
But HOW you are doing that may be problematic.

Why not get the signal that turns the light ON/OFF to control the roller shutter directly?

It is also confusing that you have the orange node that is just before the roller shutter down node, yet there isn't one just before the roller shutter up node.

Stepping back a couple of steps:
You have the message that turns the light ON/OFF and it goes to the switch node (light status) and then go directly into the roller shutter down and/or roller shutter up node/s.

1 Like

As you are using Home Assistant Webhook nodes - not many on here will be able to help you.

But as i use HA i probably can.

Your logic is a little wrong as the Within-time node you are using is going to only allow info about the light state to pass during the hours you have set it for.

To keep the main logic of what you are doing i would change this around a little

Have the output from the light status switch set a context variable using a change node (something like LightON=Yes or some such

The have an inject node run every minute and put its output into the within-time node - and have a switch node after the within time node to check the state of the context variable and then put the roller down

The alternative is instead of testing the light change of state which is what you are doing - you could instead test the current state every minute and pass that through - although you will need to think about your logic if you turn the light on and then off again


[{"id":"93f5902e5ccfd5aa","type":"inject","z":"a0d0f696507d618e","name":"true at 21:00","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 21 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":140,"y":860,"wires":[["96d9468792f078ab"]]},{"id":"3cdd37517436468d","type":"inject","z":"a0d0f696507d618e","name":"false at 05:00","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":140,"y":900,"wires":[["96d9468792f078ab"]]},{"id":"a76a0e6efab626b9","type":"inject","z":"a0d0f696507d618e","name":"Ligth on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":120,"y":980,"wires":[["96d9468792f078ab"]]},{"id":"d7536ce5a1f1d377","type":"inject","z":"a0d0f696507d618e","name":"Ligth off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":120,"y":1020,"wires":[["96d9468792f078ab"]]},{"id":"96d9468792f078ab","type":"function","z":"a0d0f696507d618e","name":"function 9","func":"let msg1 = {}\nlet msg2 = {}\n\nlet zeit = context.get(\"zeit\") || false\nlet light = context.get(\"light\") || 'off'\n\n// remove or comment (node.warn..) when done.\nlet invar = msg.payload\nswitch (invar) {\n    case 'on':\n        node.warn('light on')\n        light = 'on'\n        if (zeit === true) {\n            msg1.payload = 'roller shutter down'\n            node.send([msg1, null])\n        }\n        break\n    case 'off':\n        node.warn('ligth off')\n        light = 'off'\n        msg2.payload = 'roller shutter up'\n        node.send([null, msg2])\n    break\n    case true:\n        node.warn('zeit true')\n        zeit = true\n        if(light === 'on') {\n            msg1.payload = 'roller shutter down'\n            node.send([msg1, null])\n        }\n        break\n    case false:\n        node.warn('zeit false')\n        zeit = false\n        if(light === 'on') {\n            msg2.payload = 'roller shutter up'\n            node.send([null, msg2])\n        }\n        break   \n}\n\ncontext.set(\"zeit\", zeit)\ncontext.set(\"light\", light)","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":940,"wires":[["c4b2de49b0d91c13"],["2c9ca485f8af0111"]]},{"id":"c4b2de49b0d91c13","type":"debug","z":"a0d0f696507d618e","name":"roller shutter down","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":920,"wires":[]},{"id":"2c9ca485f8af0111","type":"debug","z":"a0d0f696507d618e","name":"roller shutter up","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":960,"wires":[]}]

Is this what you are after?