Outside Lights automation with Node-RED

I am struggling with Node-Red, I hope somebody can help with this case:

We have some nice lights outside our house, what I want is this:

  1. the light must be enabled when the time is between DUSK time and 23:00.

  2. the lights must be enabled when the motion sensor outside is activated, this for 5 minutes, but not when it’s daylight time and not when they are already enabled because of rule 1 or 3.

  3. the lights must be enabled when somebody opens the door (door contact), this for 5 minutes, but not when it’s daylight time and not when they are already enabled because of rule 1 or 2.

  4. there must be a master-switch to disable/enable the 3 automations above…

I have this already:

[{“id”:“7a265864.b49a68”,“type”:“tab”,“label”:“Veranda”,“disabled”:false,“info”:""},{“id”:“9532d6bc.eac068”,“type”:“api-call-service”,“z”:“7a265864.b49a68”,“name”:“Veranda AAN”,“server”:“adea651f.d79c98”,“version”:1,“service_domain”:“switch”,“service”:“turn_on”,“entityId”:“switch.veranda_shenzhen_neo_electronics_co_ltd_power_plug_12a_switch”,“data”:"",“dataType”:“json”,“mergecontext”:"",“output_location”:"",“output_location_type”:“none”,“mustacheAltTags”:false,“x”:900,“y”:220,“wires”:[[]]},{“id”:“6f22743d.e8e41c”,“type”:“api-call-service”,“z”:“7a265864.b49a68”,“name”:“Veranda UIT”,“server”:“adea651f.d79c98”,“version”:1,“service_domain”:“switch”,“service”:“turn_off”,“entityId”:“switch.veranda_shenzhen_neo_electronics_co_ltd_power_plug_12a_switch”,“data”:"",“dataType”:“json”,“mergecontext”:"",“output_location”:"",“output_location_type”:“none”,“mustacheAltTags”:false,“x”:930,“y”:320,“wires”:[[]]},{“id”:“a0536f93.3431”,“type”:“switch”,“z”:“7a265864.b49a68”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“off”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:590,“y”:280,“wires”:[[“9532d6bc.eac068”],[“f6e2dd5c.58a96”]]},{“id”:“f0220be5.d55d78”,“type”:“server-state-changed”,“z”:“7a265864.b49a68”,“name”:“contact test”,“server”:“adea651f.d79c98”,“version”:1,“entityidfilter”:“input_boolean.contact_test”,“entityidfiltertype”:“exact”,“outputinitially”:false,“state_type”:“str”,“haltifstate”:"",“halt_if_type”:“str”,“halt_if_compare”:“is”,“outputs”:1,“output_only_on_state_change”:true,“x”:150,“y”:300,“wires”:[[“a0536f93.3431”]]},{“id”:“f6e2dd5c.58a96”,“type”:“stoptimer”,“z”:“7a265864.b49a68”,“duration”:“2”,“units”:“Second”,“payloadtype”:“num”,“payloadval”:“0”,“name”:"",“x”:720,“y”:340,“wires”:[[“6f22743d.e8e41c”],[]]},{“id”:“27f08093.ac43c”,“type”:“bigtimer”,“z”:“7a265864.b49a68”,“outtopic”:"",“outpayload1”:“on”,“outpayload2”:“off”,“name”:“Big Timer”,“comment”:"",“lat”:“53.148654”,“lon”:“6.993419”,“starttime”:5001,“endtime”:“1380”,“starttime2”:“0”,“endtime2”:“0”,“startoff”:0,“endoff”:0,“startoff2”:0,“endoff2”:0,“offs”:0,“outtext1”:"",“outtext2”:"",“timeout”:1440,“sun”:true,“mon”:true,“tue”:true,“wed”:true,“thu”:true,“fri”:true,“sat”:true,“jan”:true,“feb”:true,“mar”:true,“apr”:true,“may”:true,“jun”:true,“jul”:true,“aug”:true,“sep”:true,“oct”:true,“nov”:true,“dec”:true,“day1”:0,“month1”:0,“day2”:0,“month2”:0,“day3”:0,“month3”:0,“day4”:0,“month4”:0,“day5”:0,“month5”:0,“day6”:0,“month6”:0,“d1”:0,“w1”:0,“d2”:0,“w2”:0,“d3”:0,“w3”:0,“d4”:0,“w4”:0,“d5”:0,“w5”:0,“d6”:0,“w6”:0,“xday1”:0,“xmonth1”:0,“xday2”:0,“xmonth2”:0,“xday3”:0,“xmonth3”:0,“xday4”:0,“xmonth4”:0,“xday5”:0,“xmonth5”:0,“xday6”:0,“xmonth6”:0,“xd1”:0,“xw1”:0,“xd2”:0,“xw2”:0,“xd3”:0,“xw3”:0,“xd4”:0,“xw4”:0,“xd5”:0,“xw5”:0,“xd6”:0,“xw6”:0,“suspend”:false,“random”:false,“repeat”:true,“atstart”:true,“odd”:false,“even”:false,“x”:480,“y”:480,“wires”:[[“69ddb25a.43f27c”],[],[]]},{“id”:“69ddb25a.43f27c”,“type”:“switch”,“z”:“7a265864.b49a68”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“off”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:710,“y”:480,“wires”:[[“2f602b9e.175754”],[“825ee3b1.37969”]]},{“id”:“2f602b9e.175754”,“type”:“api-call-service”,“z”:“7a265864.b49a68”,“name”:“Veranda AAN”,“server”:“adea651f.d79c98”,“version”:1,“service_domain”:“switch”,“service”:“turn_on”,“entityId”:“switch.veranda_shenzhen_neo_electronics_co_ltd_power_plug_12a_switch”,“data”:"",“dataType”:“json”,“mergecontext”:"",“output_location”:"",“output_location_type”:“none”,“mustacheAltTags”:false,“x”:980,“y”:520,“wires”:[[]]},{“id”:“825ee3b1.37969”,“type”:“api-call-service”,“z”:“7a265864.b49a68”,“name”:“Veranda UIT”,“server”:“adea651f.d79c98”,“version”:1,“service_domain”:“switch”,“service”:“turn_off”,“entityId”:“switch.veranda_shenzhen_neo_electronics_co_ltd_power_plug_12a_switch”,“data”:"",“dataType”:“json”,“mergecontext”:"",“output_location”:"",“output_location_type”:“none”,“mustacheAltTags”:false,“x”:1010,“y”:580,“wires”:[[]]},{“id”:“adea651f.d79c98”,“type”:“server”,“z”:"",“name”:“Home Assistant”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true}]

But I am stuck, any help would be appreciated a lot !