Roller shutter time control with no before and no later than at

Hi there,

I’m new to Home Assistant and Node red but have been able to “migrate” most of ioBroker so far. I only have my problems with the roller shutter control.

So far (ioBroker => Blockly script) I have arranged it so that the shutters are closed at sunset, but not before 6 p.m. and not after 10 p.m.

The control by means of sunset is not the problem, but how do I manage it with the “frame times” of 6 p.m. and 10 p.m.?

Examples:

  1. Sunset is at 5:15 p.m., i.e. before 6 p.m., so the shutters should only go down at 6 p.m.
  2. Sunset is at 8:15 p.m., i.e. after 6 p.m. and before 10 p.m., then the shutters should be lowered immediately.
  3. Sunset is at 10:15 p.m., i.e. after 10 p.m., then the shutters should be down at 10 p.m.

I hope I was able to make my problem understandable and hope that someone can help me.

Unfortunately I was unsuccessful in my search here.

Thanks in advance :slight_smile:

This should work for you.

[{"id":"de011008621a52fe","type":"server-state-changed","z":"f80b6c338afd5483","name":"","server":"","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"below_horizon","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":1740,"wires":[["0af856810c65c9d7"],[]]},{"id":"eca0caeca539a9e7","type":"api-call-service","z":"f80b6c338afd5483","name":"close shutter","server":"","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":650,"y":1740,"wires":[[]]},{"id":"0b39c8314c5f1b59","type":"inject","z":"f80b6c338afd5483","name":"6","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 18 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1800,"wires":[["ebb832195cbe1afb"]]},{"id":"b7107c1dd31e4a62","type":"inject","z":"f80b6c338afd5483","name":"10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1860,"wires":[["ea246f8b7cb99a86"]]},{"id":"0af856810c65c9d7","type":"time-range-switch","z":"f80b6c338afd5483","name":"","lat":"","lon":"","startTime":"18:00","endTime":"22:00","startOffset":0,"endOffset":0,"x":370,"y":1740,"wires":[["eca0caeca539a9e7"],[]]},{"id":"ebb832195cbe1afb","type":"api-current-state","z":"f80b6c338afd5483","name":"","server":"","version":3,"outputs":2,"halt_if":"below_horizon","halt_if_type":"str","halt_if_compare":"is","entity_id":"sun.sun","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":1800,"wires":[["eca0caeca539a9e7"],[]]},{"id":"ea246f8b7cb99a86","type":"api-current-state","z":"f80b6c338afd5483","name":"","server":"","version":3,"outputs":2,"halt_if":"above_horizon","halt_if_type":"str","halt_if_compare":"is","entity_id":"sun.sun","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":1860,"wires":[["eca0caeca539a9e7"],[]]}]

Hi Mikefila,

thanks for your work. Meanwhile I found this module “blind” within this package: https://github.com/rdmtc/node-red-contrib-sun-position

It work great for me, after I realized how to configure it.

PS: How can I mark this topic as solved?

can you share your solution as i am searching for the same.