As we don’t know much about the environment to control the lights, in NodeRed the node to consider to controll the lights might be “BigTimer” from Peter Scargill.
https://flows.nodered.org/node/node-red-contrib-bigtimer
This should at least satisfy all timer related needs inside NodeRed (including Sunrise/Sunset and even randomisation, if needed)
the red node in the screenshot is called “BooleanLogicUltimate” and his “OR” Output is used. https://flows.nodered.org/node/node-red-contrib-boolean-logic-ultimate but this could be done as well with a “function” node. I like the better overview like this, but needs said node to be added to NodeRed.
For completeness sake here the Code in Json you see on the Screenshot: (could be copy and pasted into NodeRed)
[
{
"id": "ad165ab65423ba31",
"type": "bigtimer",
"z": "49f39a1906f99fca",
"outtopic": "",
"outpayload1": "",
"outpayload2": "",
"name": "WorkingDays Morning",
"comment": "",
"lat": 0,
"lon": 0,
"starttime": "375",
"endtime": "450",
"starttime2": 0,
"endtime2": 0,
"startoff": "0",
"endoff": "5",
"startoff2": 0,
"endoff2": 0,
"offs": 0,
"outtext1": "",
"outtext2": "",
"timeout": 1440,
"sun": false,
"mon": true,
"tue": true,
"wed": true,
"thu": true,
"fri": true,
"sat": false,
"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,
"day7": 0,
"month7": 0,
"day8": 0,
"month8": 0,
"day9": 0,
"month9": 0,
"day10": 0,
"month10": 0,
"day11": 0,
"month11": 0,
"day12": 0,
"month12": 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,
"xday7": "",
"xmonth7": "",
"xday8": "",
"xmonth8": "",
"xday9": "",
"xmonth9": "",
"xday10": "",
"xmonth10": "",
"xday11": "",
"xmonth11": "",
"xday12": "",
"xmonth12": "",
"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,
"randon1": false,
"randoff1": true,
"randon2": false,
"randoff2": false,
"repeat": true,
"atstart": true,
"odd": false,
"even": false,
"x": 180,
"y": 1980,
"wires": [
[],
[
"dfb1c331fa9d2444"
],
[]
]
},
{
"id": "27d0399f1a4a72d1",
"type": "bigtimer",
"z": "49f39a1906f99fca",
"outtopic": "",
"outpayload1": "",
"outpayload2": "",
"name": "Weekend",
"comment": "",
"lat": 0,
"lon": 0,
"starttime": "705",
"endtime": "780",
"starttime2": 0,
"endtime2": 0,
"startoff": "15",
"endoff": "15",
"startoff2": 0,
"endoff2": 0,
"offs": 0,
"outtext1": "",
"outtext2": "",
"timeout": 1440,
"sun": true,
"mon": false,
"tue": false,
"wed": false,
"thu": false,
"fri": false,
"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,
"day7": 0,
"month7": 0,
"day8": 0,
"month8": 0,
"day9": 0,
"month9": 0,
"day10": 0,
"month10": 0,
"day11": 0,
"month11": 0,
"day12": 0,
"month12": 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,
"xday7": "",
"xmonth7": "",
"xday8": "",
"xmonth8": "",
"xday9": "",
"xmonth9": "",
"xday10": "",
"xmonth10": "",
"xday11": "",
"xmonth11": "",
"xday12": "",
"xmonth12": "",
"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,
"randon1": true,
"randoff1": true,
"randon2": false,
"randoff2": false,
"repeat": true,
"atstart": true,
"odd": false,
"even": false,
"x": 140,
"y": 2100,
"wires": [
[],
[
"237d2d06d6d18793"
],
[]
]
},
{
"id": "98fc7fc0599ebc8f",
"type": "BooleanLogicUltimate",
"z": "49f39a1906f99fca",
"name": "",
"filtertrue": "both",
"persist": true,
"sInitializeWith": "WaitForPayload",
"triggertopic": "trigger",
"outputtriggeredby": "all",
"inputCount": "2",
"topic": "result",
"x": 640,
"y": 2040,
"wires": [
[],
[],
[]
]
},
{
"id": "437581dd35a93f36",
"type": "bigtimer",
"z": "49f39a1906f99fca",
"outtopic": "",
"outpayload1": "",
"outpayload2": "",
"name": "Sunset - 00:30",
"comment": "",
"lat": "48.858513",
"lon": "2.294483",
"starttime": "5004",
"endtime": "30",
"starttime2": 0,
"endtime2": 0,
"startoff": "10",
"endoff": "30",
"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,
"day7": 0,
"month7": 0,
"day8": 0,
"month8": 0,
"day9": 0,
"month9": 0,
"day10": 0,
"month10": 0,
"day11": 0,
"month11": 0,
"day12": 0,
"month12": 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,
"xday7": "",
"xmonth7": "",
"xday8": "",
"xmonth8": "",
"xday9": "",
"xmonth9": "",
"xday10": "",
"xmonth10": "",
"xday11": "",
"xmonth11": "",
"xday12": "",
"xmonth12": "",
"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,
"randon1": true,
"randoff1": true,
"randon2": false,
"randoff2": false,
"repeat": true,
"atstart": true,
"odd": false,
"even": false,
"x": 160,
"y": 2040,
"wires": [
[],
[
"c03176e43f5ed41d"
],
[]
]
},
{
"id": "dfb1c331fa9d2444",
"type": "change",
"z": "49f39a1906f99fca",
"name": "set msg.topic to \"one\"",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "one",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 400,
"y": 1980,
"wires": [
[
"98fc7fc0599ebc8f"
]
]
},
{
"id": "c03176e43f5ed41d",
"type": "change",
"z": "49f39a1906f99fca",
"name": "set msg.topic to \"two\"",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "two",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 400,
"y": 2040,
"wires": [
[
"98fc7fc0599ebc8f"
]
]
},
{
"id": "237d2d06d6d18793",
"type": "change",
"z": "49f39a1906f99fca",
"name": "set msg.topic to \"three\"",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "three",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 390,
"y": 2100,
"wires": [
[
"98fc7fc0599ebc8f"
]
]
}
]
hope this might give some ideas,
best regards!