Found out now, here is my flow for light and presence detection.
I don`t know if it is working correct yet.
I would also like to have a lovelace button to inject the lights on flow from dashboard in HA, any ideas how to do that?
[{"id":"532bfd0c9ea62df5","type":"tab","label":"Borte-Hjemme","disabled":false,"info":"","env":[]},{"id":"89397c70091c729a","type":"inject","z":"532bfd0c9ea62df5","name":"06:20 mon - sun","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"20 06 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":520,"wires":[["f9b7af1c7eb3d532"]]},{"id":"b8240f357a2130e1","type":"function","z":"532bfd0c9ea62df5","name":"200.25 Spot sofa","func":"msg.target = \"200.25\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 10\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":420,"wires":[["21608755ce8aed8a","79410d7a354c1253","dcd0cd667d9ba413"]]},{"id":"21608755ce8aed8a","type":"hdl-raw-out","z":"532bfd0c9ea62df5","controller":"6e986e87.b7a2a","name":"","x":1250,"y":620,"wires":[]},{"id":"3cb158c9628db607","type":"function","z":"532bfd0c9ea62df5","name":"200.25 Spot sofa","func":"msg.target = \"200.25\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":780,"wires":[["21608755ce8aed8a","79410d7a354c1253","e1b2e9c93a517ead"]]},{"id":"f6f5192c0e391c97","type":"comment","z":"532bfd0c9ea62df5","name":"Lights on","info":"","x":120,"y":520,"wires":[]},{"id":"dfcd73c093b12342","type":"hdl-channel-get","z":"532bfd0c9ea62df5","controller":"6e986e87.b7a2a","address":"200.0","channel":"1","name":"","x":1600,"y":140,"wires":[["608adecf11031e1c","02a5716e41c63a30"]]},{"id":"79410d7a354c1253","type":"delay","z":"532bfd0c9ea62df5","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1320,"y":140,"wires":[["ed315d4fc1ad92b4"]]},{"id":"608adecf11031e1c","type":"debug","z":"532bfd0c9ea62df5","name":"4","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1750,"y":80,"wires":[]},{"id":"ed315d4fc1ad92b4","type":"function","z":"532bfd0c9ea62df5","name":"check","func":"// Save target value to msg.targetlevel as \n// msg.payload.level will be changed in the \"hdl ch get node\".\nmsg.targetlevel = msg.payload.level\n\n//Change the adress so that the \"hdl ch get node\" \n//knows what adress to check\nmsg.payload.address = msg.target \n\n//Return\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1450,"y":140,"wires":[["dfcd73c093b12342","3647e90aeb12c6c2"]]},{"id":"874fdbe425c4fde2","type":"comment","z":"532bfd0c9ea62df5","name":"Check if answerback recived or resend command","info":"","x":1320,"y":80,"wires":[]},{"id":"3647e90aeb12c6c2","type":"debug","z":"532bfd0c9ea62df5","name":"3","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1590,"y":80,"wires":[]},{"id":"02a5716e41c63a30","type":"switch","z":"532bfd0c9ea62df5","name":"Done?","property":"payload.level","propertyType":"msg","rules":[{"t":"neq","v":"targetlevel","vt":"msg"}],"checkall":"false","repair":false,"outputs":1,"x":1750,"y":140,"wires":[["175138097c4391df","393753f6b04481b8"]]},{"id":"175138097c4391df","type":"debug","z":"532bfd0c9ea62df5","name":"6 Resend","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1920,"y":80,"wires":[]},{"id":"393753f6b04481b8","type":"function","z":"532bfd0c9ea62df5","name":"rebuild","func":"//Change the new level target for new attempt \n//if the values did not match\nmsg.payload.level = msg.targetlevel\n//Return\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1890,"y":140,"wires":[["f8d5bdd9ff45cb3d","21608755ce8aed8a","b0e91754a3352fce"]]},{"id":"f8d5bdd9ff45cb3d","type":"debug","z":"532bfd0c9ea62df5","name":"7","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2110,"y":100,"wires":[]},{"id":"a0e0123f256ce5f2","type":"hdl-channel-get","z":"532bfd0c9ea62df5","controller":"6e986e87.b7a2a","address":"200.0","channel":"1","name":"","x":1600,"y":200,"wires":[["25705bdec88e0ea6"]]},{"id":"b0e91754a3352fce","type":"delay","z":"532bfd0c9ea62df5","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1320,"y":200,"wires":[["0a76e40fbbd84c52"]]},{"id":"0a76e40fbbd84c52","type":"function","z":"532bfd0c9ea62df5","name":"check","func":"// Save target value to msg.targetlevel as \n// msg.payload.level will be changed in the \"hdl ch get node\".\nmsg.targetlevel = msg.payload.level\n\n//Change the adress so that the \"hdl ch get node\" \n//knows what adress to check\nmsg.payload.address = msg.target \n\n//Return\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1450,"y":200,"wires":[["a0e0123f256ce5f2"]]},{"id":"25705bdec88e0ea6","type":"switch","z":"532bfd0c9ea62df5","name":"Done?","property":"payload.level","propertyType":"msg","rules":[{"t":"neq","v":"targetlevel","vt":"msg"}],"checkall":"false","repair":false,"outputs":1,"x":1750,"y":200,"wires":[["312b645a77c0fafe"]]},{"id":"312b645a77c0fafe","type":"function","z":"532bfd0c9ea62df5","name":"rebuild","func":"//Change the new level target for new attempt \n//if the values did not match\nmsg.payload.level = msg.targetlevel\n//Return\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1890,"y":200,"wires":[["21608755ce8aed8a","f8d5bdd9ff45cb3d"]]},{"id":"3937c03a144c0eee","type":"function","z":"532bfd0c9ea62df5","name":"200.29 Spot Kjøkken","func":"msg.target = \"200.29\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 20\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":540,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"6c75a78e20ece6c6","type":"function","z":"532bfd0c9ea62df5","name":"200.27 Lamper gang oppe","func":"msg.target = \"200.27\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 20\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":500,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"ec486d1d6317bbaa","type":"function","z":"532bfd0c9ea62df5","name":"200.26 Spot Spisebord","func":"msg.target = \"200.26\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 10\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":460,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"f9f458dfe2a83f11","type":"function","z":"532bfd0c9ea62df5","name":"200.29 Spot Kjøkken","func":"msg.target = \"200.29\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":900,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"62beca2650b51f6f","type":"function","z":"532bfd0c9ea62df5","name":"200.27 Lamper gang oppe","func":"msg.target = \"200.27\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":860,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"43d025edb0c5bb23","type":"function","z":"532bfd0c9ea62df5","name":"200.26 Sofa Spisebord","func":"msg.target = \"200.26\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":820,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"c5feaaee3e75b9ea","type":"comment","z":"532bfd0c9ea62df5","name":"Sjekk om det er noen hjemme","info":"","x":180,"y":620,"wires":[]},{"id":"077c2735d0a4edaa","type":"server-state-changed","z":"532bfd0c9ea62df5","name":"Det er noen hjemme!","server":"4c09bc30.df07b4","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"group.familie","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"home","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":540,"y":620,"wires":[["b8240f357a2130e1","3937c03a144c0eee","6c75a78e20ece6c6","ec486d1d6317bbaa","5b16bbe3f119df0f","acbcc3738477319a","a420c4852870502c","99acaab6ead930ac"],["3cb158c9628db607","f9f458dfe2a83f11","62beca2650b51f6f","43d025edb0c5bb23","2529fcec7ba1b42c","54d6efb6ebc627b2","f02a9fbcc7ef6159","fa21e77b1288a5e3","1c18221b.713e5e","14fb1f507450450e"]]},{"id":"5b16bbe3f119df0f","type":"function","z":"532bfd0c9ea62df5","name":"200.22 Spot Hall","func":"msg.target = \"200.22\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 10\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":380,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"acbcc3738477319a","type":"function","z":"532bfd0c9ea62df5","name":"200.13 Spot kjellerstue","func":"msg.target = \"200.13\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 15\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":340,"wires":[["79410d7a354c1253","21608755ce8aed8a"]]},{"id":"2529fcec7ba1b42c","type":"function","z":"532bfd0c9ea62df5","name":"200.22 Spot Hall","func":"msg.target = \"200.22\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":740,"wires":[["21608755ce8aed8a","79410d7a354c1253"]]},{"id":"54d6efb6ebc627b2","type":"function","z":"532bfd0c9ea62df5","name":"200.13 Spot kjellerstue","func":"msg.target = \"200.13\"\nmsg.code = 49,\nmsg.payload = {\n channel: 1,\n level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":700,"wires":[["21608755ce8aed8a","79410d7a354c1253"]]},{"id":"dcd0cd667d9ba413","type":"debug","z":"532bfd0c9ea62df5","name":"Lys på","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1230,"y":540,"wires":[]},{"id":"1c18221b.713e5e","type":"api-current-state","z":"532bfd0c9ea62df5","name":"Elias rom = Spiller","server":"ac20270b.4d8de8","version":3,"outputs":2,"halt_if":"playing","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.elias_rom","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","x":910,"y":1060,"wires":[["fdf3da66.581118"],[]]},{"id":"fdf3da66.581118","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Pause Elias rom","server":"ac20270b.4d8de8","version":5,"debugenabled":false,"domain":"media_player","service":"media_pause","areaId":[],"deviceId":[],"entityId":["media_player.elias_rom"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1120,"y":1060,"wires":[[]]},{"id":"14fb1f507450450e","type":"api-current-state","z":"532bfd0c9ea62df5","name":"Stue = Spiller","server":"ac20270b.4d8de8","version":3,"outputs":2,"halt_if":"playing","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.stue","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","x":900,"y":1120,"wires":[["fc83998b72e6946a"],[]]},{"id":"fc83998b72e6946a","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Pause Stue","server":"ac20270b.4d8de8","version":5,"debugenabled":false,"domain":"media_player","service":"media_pause","areaId":[],"deviceId":[],"entityId":["media_player.stue"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1110,"y":1120,"wires":[[]]},{"id":"a420c4852870502c","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Mill ovn","server":"4c09bc30.df07b4","version":5,"debugenabled":false,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.mill_panel"],"data":"{\"temperature\":\"20\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":280,"wires":[[]]},{"id":"f02a9fbcc7ef6159","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Mill ovn","server":"4c09bc30.df07b4","version":5,"debugenabled":false,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.mill_panel"],"data":"{\"temperature\":\"18\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":940,"wires":[[]]},{"id":"99acaab6ead930ac","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Varmepumpe","server":"4c09bc30.df07b4","version":5,"debugenabled":false,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.harald_s_device"],"data":"{\"temperature\":\"22\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":220,"wires":[[]]},{"id":"fa21e77b1288a5e3","type":"api-call-service","z":"532bfd0c9ea62df5","name":"Varmepumpe","server":"4c09bc30.df07b4","version":5,"debugenabled":false,"domain":"climate","service":"set_temperature","areaId":[],"deviceId":[],"entityId":["climate.harald_s_device"],"data":"{\"temperature\":\"18\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":1000,"wires":[[]]},{"id":"f9b7af1c7eb3d532","type":"api-current-state","z":"532bfd0c9ea62df5","name":"Det er noen hjemme!","server":"ac20270b.4d8de8","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"group.familie","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","x":540,"y":520,"wires":[[],["b8240f357a2130e1","5b16bbe3f119df0f","acbcc3738477319a","a420c4852870502c","99acaab6ead930ac","ec486d1d6317bbaa","6c75a78e20ece6c6","3937c03a144c0eee"]]},{"id":"d158571a18b0789e","type":"inject","z":"532bfd0c9ea62df5","name":"06:20 mon - sun","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"20 06 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":720,"wires":[["53419be38d3577b5"]]},{"id":"53419be38d3577b5","type":"api-current-state","z":"532bfd0c9ea62df5","name":"Det er noen hjemme!","server":"ac20270b.4d8de8","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"group.familie","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","x":540,"y":720,"wires":[[],["54d6efb6ebc627b2","2529fcec7ba1b42c","3cb158c9628db607","43d025edb0c5bb23","62beca2650b51f6f","f9f458dfe2a83f11","f02a9fbcc7ef6159","fa21e77b1288a5e3","1c18221b.713e5e","14fb1f507450450e"]]},{"id":"9d70fd95018be0da","type":"comment","z":"532bfd0c9ea62df5","name":"Lights off","info":"","x":120,"y":720,"wires":[]},{"id":"e1b2e9c93a517ead","type":"debug","z":"532bfd0c9ea62df5","name":"Lys av","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1230,"y":700,"wires":[]},{"id":"6e986e87.b7a2a","type":"hdl-controller","host":"10.0.0.20","port":"6000","subnetid":"200","deviceid":"0","broadcast":true,"daliId":"92"},{"id":"4c09bc30.df07b4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"ac20270b.4d8de8","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]