Zwave day night auto dimming with times and max brightness hassio

Hello
have a look and see what you all think if someone could do the join node better but it works,
also anyway of simplifying it i have 24 ways to do on these

[{"id":"b84a7f9a.24408","type":"server-events","z":"cf1115c.2dcd6e8","name":"HA All Events","server":"d0be6c93.2903a","x":110,"y":140,"wires":[["fd7c9ec6.5f502"]]},{"id":"29e7db9a.11e0a4","type":"function","z":"cf1115c.2dcd6e8","name":"Brightness Value","func":"var temp=msg.payload.event.new_state.attributes.brightness;\nvar msg = {payload:temp};\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":140,"wires":[["48d98f79.41b7a","c7251b5d.143678"]]},{"id":"17f930a.35c6ecf","type":"change","z":"cf1115c.2dcd6e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"149","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":460,"wires":[["f029a7b.03e1b58","cf60cace.85a828"]]},{"id":"d4004f92.61d7f","type":"api-call-service","z":"cf1115c.2dcd6e8","name":"(sw 1) level 3 on","server":"d0be6c93.2903a","service_domain":"homeassistant","service":"turn_on","data":"{\"entity_id\":\"light.fibaro_system_fgd212_dimmer_2_level_3\"}","mergecontext":"","x":1280,"y":460,"wires":[["bff21614.58a188"]],"inputLabels":["1"],"outputLabels":["1"]},{"id":"f029a7b.03e1b58","type":"template","z":"cf1115c.2dcd6e8","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"data\": {\n \"brightness\": \"{{payload}}\"\n }\n}\n","output":"str","x":1060,"y":460,"wires":[["d4004f92.61d7f"]]},{"id":"fd7c9ec6.5f502","type":"switch","z":"cf1115c.2dcd6e8","name":"Filter zwave level_3","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"light.fibaro_system_fgd212_dimmer_2_level_3","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":140,"wires":[["b8864352.8aa0a"],[]]},{"id":"c7251b5d.143678","type":"join","z":"cf1115c.2dcd6e8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1390,"y":140,"wires":[["9148ce4e.b341"]]},{"id":"48d98f79.41b7a","type":"api-current-state","z":"cf1115c.2dcd6e8","name":"","server":"d0be6c93.2903a","halt_if":"","override_topic":false,"override_payload":false,"entity_id":"binary_sensor.sun_up","x":1110,"y":100,"wires":[["c7251b5d.143678"]]},{"id":"bd8cdda.f7d072","type":"switch","z":"cf1115c.2dcd6e8","name":"Day Night ","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"on","vt":"str"},{"t":"cont","v":"off","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":100,"y":220,"wires":[["e59ca77c.ea5ac8"],["18cb8b12.9be805"],[]]},{"id":"18cb8b12.9be805","type":"function","z":"cf1115c.2dcd6e8","name":"Brightness Value Night","func":"var temp=msg.payload[1];\nvar msg = {payload:temp};\nreturn msg;\n\n","outputs":1,"noerr":0,"x":320,"y":380,"wires":[["41ccd84b.c56338"]]},{"id":"e59ca77c.ea5ac8","type":"function","z":"cf1115c.2dcd6e8","name":"Brightness Value Day","func":"var temp=msg.payload[1];\nvar msg = {payload:temp};\nreturn msg;\n\n","outputs":1,"noerr":0,"x":320,"y":340,"wires":[["e6251227.cfc4f"]]},{"id":"41ccd84b.c56338","type":"switch","z":"cf1115c.2dcd6e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"149","v2t":"num"},{"t":"btwn","v":"150","vt":"num","v2":"240","v2t":"num"},{"t":"btwn","v":"241","vt":"num","v2":"256","v2t":"num"},{"t":"cont","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":610,"y":540,"wires":[["cf60cace.85a828"],["17f930a.35c6ecf","cf60cace.85a828"],["6fdbb242.a1eb3c"],[],[]]},{"id":"cf60cace.85a828","type":"stoptimer","z":"cf1115c.2dcd6e8","duration":"1","units":"Minute","payloadtype":"bool","payloadval":"true","name":"Auto turn off","x":1050,"y":540,"wires":[["7c9c71eb.508ab"],["679c0d47.065c44","953a31f2.95b86"]]},{"id":"953a31f2.95b86","type":"api-call-service","z":"cf1115c.2dcd6e8","name":"(sw 1) level 3 off","server":"d0be6c93.2903a","service_domain":"homeassistant","service":"turn_off","data":"{\"entity_id\":\"light.fibaro_system_fgd212_dimmer_2_level_3\"}","mergecontext":"","x":1280,"y":540,"wires":[["bff21614.58a188"]],"inputLabels":["1"],"outputLabels":["1"]},{"id":"1dc97080.c316d","type":"stoptimer","z":"cf1115c.2dcd6e8","duration":"30","units":"Minute","payloadtype":"bool","payloadval":"true","name":"Auto turn off","x":830,"y":260,"wires":[["f031dceb.ab5f"],[]]},{"id":"f031dceb.ab5f","type":"api-call-service","z":"cf1115c.2dcd6e8","name":"(sw 1) level 3 off","server":"d0be6c93.2903a","service_domain":"homeassistant","service":"turn_off","data":"{\"entity_id\":\"light.fibaro_system_fgd212_dimmer_2_level_3\"}","mergecontext":"","x":1080,"y":240,"wires":[["dcc8036e.4afd"]],"inputLabels":["1"],"outputLabels":["1"]},{"id":"6fdbb242.a1eb3c","type":"stoptimer","z":"cf1115c.2dcd6e8","duration":"1","units":"Minute","payloadtype":"num","payloadval":"40","name":"Auto turn off","x":830,"y":540,"wires":[["6d64d721.985cb8"],["17bfe888.734af7","f029a7b.03e1b58"]]},{"id":"17bfe888.734af7","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":720,"wires":[]},{"id":"6d64d721.985cb8","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":660,"wires":[]},{"id":"7c9c71eb.508ab","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1270,"y":660,"wires":[]},{"id":"679c0d47.065c44","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1270,"y":720,"wires":[]},{"id":"e6251227.cfc4f","type":"switch","z":"cf1115c.2dcd6e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"150","vt":"num","v2":"240","v2t":"num"},{"t":"btwn","v":"241","vt":"num","v2":"256","v2t":"num"},{"t":"cont","v":"on","vt":"str"},{"t":"cont","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":610,"y":280,"wires":[["1dc97080.c316d"],[],[],[]]},{"id":"b8864352.8aa0a","type":"rbe","z":"cf1115c.2dcd6e8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":510,"y":140,"wires":[["29e7db9a.11e0a4"]]},{"id":"51dc5e5f.29237","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1870,"y":240,"wires":[]},{"id":"dcc8036e.4afd","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":240,"wires":[]},{"id":"bff21614.58a188","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":460,"wires":[]},{"id":"9148ce4e.b341","type":"rbe","z":"cf1115c.2dcd6e8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1530,"y":140,"wires":[["54d0fcae.af7164","363b56eb.16082a"]]},{"id":"16763c47.c9e0f4","type":"switch","z":"cf1115c.2dcd6e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"240","v2t":"num"},{"t":"btwn","v":"241","vt":"num","v2":"256","v2t":"num"},{"t":"cont","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":810,"y":660,"wires":[[],[],[],[]]},{"id":"54d0fcae.af7164","type":"delay","z":"cf1115c.2dcd6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1700,"y":140,"wires":[["bd8cdda.f7d072","51dc5e5f.29237"]]},{"id":"363b56eb.16082a","type":"debug","z":"cf1115c.2dcd6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1870,"y":300,"wires":[]},{"id":"d0be6c93.2903a","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"7e358308f6c6c585364160f6fcab576e9e57ec3008f3845da664b35cbf882bbc"}]