[{"id":"03454e69d1fb38da","type":"subflow","name":"Color / Brightness","info":"Color / Brightness Control commands for q-gate node","category":"","in":[{"x":340,"y":140,"wires":[{"id":"e9076938078efe18"}]}],"out":[{"x":640,"y":60,"wires":[{"id":"e9076938078efe18","port":0}]},{"x":640,"y":120,"wires":[{"id":"e9076938078efe18","port":1}]},{"x":640,"y":180,"wires":[{"id":"e9076938078efe18","port":2}]}],"env":[],"meta":{},"color":"#DDAA99","status":{"x":640,"y":240,"wires":[]}},{"id":"e9076938078efe18","type":"function","z":"03454e69d1fb38da","name":"","func":"var entity_id = msg.data.entity_id\nvar current_brightness = msg.data.new_state.attributes.brightness;\nvar current_color_temp = msg.data.new_state.attributes.color_temp;\nvar circadian_mireds = global.get(\"nr_circadian_mireds\");\nvar circadian_brightness = global.get(\"nr_circadian_brightness\");\n/*\nvar calculated_brightness_state = Math.round(circadian_brightness * 0.996078431);\nif (calculated_brightness_state == 254) {calculated_brightness_state = 255}\n*/\ncircadian_brightness = Math.round(circadian_brightness * 0.996078431) + Math.floor(circadian_brightness/255);\n\nvar debug = \n {\n \"Entity\": entity_id,\n \"Old color\": msg.data.old_state.attributes.color_temp,\n \"New color\": msg.data.new_state.attributes.color_temp,\n \"Current color_temp\": current_color_temp,\n \"Circadian mireds\": circadian_mireds,\n \"Old brightness\": msg.data.old_state.attributes.brightness,\n \"New brightness\": msg.data.new_state.attributes.brightness,\n \"Current brightness\": current_brightness,\n \"Circadian brightness\": circadian_brightness\n }\n\nif (msg.data.old_state.state == \"on\" && msg.data.new_state.state == \"on\"){\n\n if (current_color_temp == circadian_mireds &&\n current_brightness == circadian_brightness){\n return [{topic: \"control\", payload: \"open\"}, {topic: \"control\", payload: \"open\"}, debug]\n }\n if (current_color_temp != circadian_mireds &&\n current_brightness == circadian_brightness){\n return [{topic: \"control\", payload: \"queue\"}, {topic: \"control\", payload: \"open\"}, debug]\n }\n if (current_color_temp == circadian_mireds &&\n current_brightness != circadian_brightness){\n return [{topic: \"control\", payload: \"open\"}, {topic: \"control\", payload: \"queue\"}, debug]\n }\n if (current_color_temp != circadian_mireds && \n current_brightness != circadian_brightness){\n return [{topic: \"control\", payload: \"queue\"}, {topic: \"control\", payload: \"queue\"}, debug]\n }\n }\n \nif (msg.data.old_state.state == \"off\" && msg.data.new_state.state == \"on\"){\n return [ { topic: \"control\", payload: \"open\", data: {color_temp: circadian_mireds}},\n { topic: \"control\", payload: \"open\", data: {brightness: circadian_brightness}},\n debug ]}\n\n/* payload.brightness */\n\nif (msg.data.old_state.state == \"on\" && msg.data.new_state.state == \"off\"){\n return [{ topic: \"control\", payload: \"queue\" }, { topic: \"control\", payload: \"queue\"}, debug ]\n }\n\nreturn [null, null, debug]\n\n","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":140,"wires":[[],[],[]]},{"id":"ae8af5aa195ee960","type":"debug","z":"03454e69d1fb38da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"$globalContext('nr_circadian_mireds')\t","targetType":"jsonata","statusVal":"","statusType":"auto","x":420,"y":260,"wires":[]},{"id":"15d3ba0a712a2f77","type":"debug","z":"03454e69d1fb38da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"$globalContext('nr_circadian_brightness')\t","targetType":"jsonata","statusVal":"","statusType":"auto","x":420,"y":220,"wires":[]},{"id":"71e41def.76e254","type":"server-state-changed","z":"7ea0620.a243ca","name":"Cicadian Office","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.circadian_lighting_office","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"$entity().state = \"on\" ? \"open\" : \"queue\"","valueType":"jsonata"},{"property":"topic","propertyType":"msg","value":"control","valueType":"str"}],"x":205,"y":600,"wires":[["a8f21399bc702421"]]},{"id":"60a4dca9.c29d14","type":"api-call-service","z":"7ea0620.a243ca","name":"Light 1","server":"c879ac61.99cd1","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.office_light_1"],"data":"{\t \"brightness\": payload.brightness,\t \"color_temp\": payload.color_temp\t}","dataType":"jsonata","mergeContext":"lightOptions","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":420,"wires":[[]]},{"id":"3863e49219f2c06c","type":"api-call-service","z":"7ea0620.a243ca","name":"Light 2","server":"c879ac61.99cd1","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.office_light_2"],"data":"{\t \"brightness\": payload.brightness,\t \"color_temp\": payload.color_temp}","dataType":"jsonata","mergeContext":"lightOptions","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1335,"y":680,"wires":[[]]},{"id":"c5c6137c20db841c","type":"api-call-service","z":"7ea0620.a243ca","name":"Light 3","server":"c879ac61.99cd1","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.office_light_3"],"data":"{\t \"brightness\": payload.brightness,\t \"color_temp\": payload.color_temp\t}","dataType":"jsonata","mergeContext":"lightOptions","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1340,"y":940,"wires":[[]]},{"id":"5953dc0a6a10c314","type":"server-state-changed","z":"7ea0620.a243ca","name":"Office Color","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.circadian_lighting_color_office","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"topic","propertyType":"msg","value":"control","valueType":"str"},{"property":"payload","propertyType":"msg","value":"$entity().state = \"on\" ? \"open\" : \"queue\"","valueType":"jsonata"}],"x":215,"y":540,"wires":[["cd1e6d98e1856bda"]]},{"id":"3728361be31f9153","type":"server-state-changed","z":"7ea0620.a243ca","name":"Office Brightness","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.circadian_lighting_brightness_office","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"$entity().state = \"on\" ? \"open\" : \"queue\"","valueType":"jsonata"},{"property":"topic","propertyType":"msg","value":"control","valueType":"str"}],"x":205,"y":660,"wires":[["f66d24bc98a1e3de"]]},{"id":"5fcdbdfcad60b453","type":"q-gate","z":"7ea0620.a243ca","name":"color_temp 2","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":755,"y":700,"wires":[["b36ec2b3b096f8d6"]]},{"id":"4b80d3dcd0dcb9fa","type":"link in","z":"7ea0620.a243ca","name":"Office Light 3 Color ","links":["a8f21399bc702421","cd1e6d98e1856bda","babbee9d013605d2"],"x":620,"y":900,"wires":[["e847b97612b57cde"]]},{"id":"bb5ea6235f3f465f","type":"link in","z":"7ea0620.a243ca","name":"Office Light 2 Brightness ","links":["a8f21399bc702421","f66d24bc98a1e3de","fe02e119919f1fbf"],"x":620,"y":820,"wires":[["6e90b1ffee7f80b8"]]},{"id":"5731df33e0ef2e56","type":"q-gate","z":"7ea0620.a243ca","name":"brightness 2","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":755,"y":760,"wires":[["b36ec2b3b096f8d6"]]},{"id":"f38eeefba2af67ce","type":"q-gate","z":"7ea0620.a243ca","name":"color_temp 3","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":755,"y":960,"wires":[["1bd0cac097924a72"]]},{"id":"9dfb80638a8e3d73","type":"q-gate","z":"7ea0620.a243ca","name":"color_temp 1","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":750,"y":440,"wires":[["ee6e3c5a8750dbd3"]]},{"id":"22570f7cadf11491","type":"q-gate","z":"7ea0620.a243ca","name":"brightness 3","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":755,"y":1020,"wires":[["1bd0cac097924a72"]]},{"id":"1c0b19f6eaee2844","type":"q-gate","z":"7ea0620.a243ca","name":"brightness 1","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"","dropCmd":"","statusCmd":"","maxQueueLength":"1","keepNewest":true,"qToggle":true,"persist":true,"storeName":"file","x":750,"y":500,"wires":[["ee6e3c5a8750dbd3"]]},{"id":"a8f21399bc702421","type":"link out","z":"7ea0620.a243ca","name":"Circadian Office","mode":"link","links":["2a3d1ccf39330b28","4193dc61304afe65","4b80d3dcd0dcb9fa","4f8d44ef76bac586","bb5ea6235f3f465f","f6f58ab7e35f5688","dcfa43aa5b436092","43c2e1ab9d4c3a33","3055458e27486427","9d3d2931ff09f30e","df433767e85260dc","46442d133be6f963","4ccd12c7e9fa28f9"],"x":330,"y":600,"wires":[]},{"id":"448f5e6c691dccc4","type":"server-state-changed","z":"7ea0620.a243ca","name":"Light 1","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.office_light_1","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"milliseconds","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"}],"x":70,"y":440,"wires":[["9843d42f60a63e30"]]},{"id":"4193dc61304afe65","type":"link in","z":"7ea0620.a243ca","name":"Office Light 3 Brightness ","links":["a8f21399bc702421","f66d24bc98a1e3de","5da1ef5db9218f1e"],"x":620,"y":1080,"wires":[["1489ae336f7022ab"]]},{"id":"2a3d1ccf39330b28","type":"link in","z":"7ea0620.a243ca","name":"Office Light 1 Color","links":["a8f21399bc702421","b05b2fb283191597","cd1e6d98e1856bda"],"x":615,"y":380,"wires":[["11dfa753a1a2cd05"]]},{"id":"f6f58ab7e35f5688","type":"link in","z":"7ea0620.a243ca","name":"Office Light 2 Color","links":["166c734b13052fb7","a8f21399bc702421","cd1e6d98e1856bda"],"x":620,"y":640,"wires":[["7b9a79c482830d5b"]]},{"id":"4f8d44ef76bac586","type":"link in","z":"7ea0620.a243ca","name":"Office Light 1 Brightness","links":["a8f21399bc702421","a92499638df3f0ae","f66d24bc98a1e3de"],"x":615,"y":560,"wires":[["94a02ed09a89725d"]]},{"id":"ae45a60691ab54fc","type":"server-state-changed","z":"7ea0620.a243ca","name":"Light 2","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.office_light_2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"milliseconds","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"}],"x":55,"y":760,"wires":[["5bdc695b13ac08ce"]]},{"id":"900f6d3a6843c9d4","type":"server-state-changed","z":"7ea0620.a243ca","name":"Light 3","server":"c879ac61.99cd1","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.office_light_3","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"milliseconds","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"eventData"}],"x":55,"y":980,"wires":[["360cde2520d4ef73"]]},{"id":"f66d24bc98a1e3de","type":"link out","z":"7ea0620.a243ca","name":"Office Brightness","mode":"link","links":["4193dc61304afe65","4f8d44ef76bac586","bb5ea6235f3f465f","3055458e27486427","df433767e85260dc","4ccd12c7e9fa28f9"],"x":330,"y":660,"wires":[]},{"id":"cd1e6d98e1856bda","type":"link out","z":"7ea0620.a243ca","name":"Office Color","mode":"link","links":["2a3d1ccf39330b28","4b80d3dcd0dcb9fa","f6f58ab7e35f5688","43c2e1ab9d4c3a33","9d3d2931ff09f30e","46442d133be6f963"],"x":330,"y":540,"wires":[]},{"id":"f75a6792daaeb0b4","type":"comment","z":"7ea0620.a243ca","name":"Office","info":"","x":70,"y":340,"wires":[]},{"id":"11dfa753a1a2cd05","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 1 Color Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 1 Color Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":780,"y":380,"wires":[[]]},{"id":"94a02ed09a89725d","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 1 Brightness Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 1 Brightness Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":790,"y":560,"wires":[[]]},{"id":"7b9a79c482830d5b","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 2 Color Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 2 Color Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":785,"y":640,"wires":[[]]},{"id":"6e90b1ffee7f80b8","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 2 Brightness Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 2 Brightness Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":795,"y":820,"wires":[[]]},{"id":"e847b97612b57cde","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 3 Color Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 3 Color Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":785,"y":900,"wires":[[]]},{"id":"1489ae336f7022ab","type":"ha-entity","z":"7ea0620.a243ca","name":"Light 3 Brightness Control","server":"c879ac61.99cd1","version":2,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Office Light 3 Brightness Control"},{"property":"device_class","value":"opening"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload = \"open\" ? \"on\" : \"off\"\t","stateType":"jsonata","attributes":[{"property":"command","value":"payload","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":795,"y":1080,"wires":[[]]},{"id":"ee6e3c5a8750dbd3","type":"join","z":"7ea0620.a243ca","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":915,"y":460,"wires":[["ae9faf4f99f5df6b"]]},{"id":"b36ec2b3b096f8d6","type":"join","z":"7ea0620.a243ca","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":920,"y":720,"wires":[["4449a34d85b294de"]]},{"id":"1bd0cac097924a72","type":"join","z":"7ea0620.a243ca","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":920,"y":980,"wires":[["5e4f3934b95b1e9e"]]},{"id":"2758054b03a4112e","type":"subflow:03454e69d1fb38da","z":"7ea0620.a243ca","name":"Office Light 1 Control","x":380,"y":440,"wires":[["b05b2fb283191597"],["a92499638df3f0ae"],[]]},{"id":"6ab4a1291df30475","type":"subflow:03454e69d1fb38da","z":"7ea0620.a243ca","name":"Office Light 2 Control","x":365,"y":760,"wires":[["166c734b13052fb7"],["fe02e119919f1fbf"],[]]},{"id":"5e7dad3531a9ab92","type":"subflow:03454e69d1fb38da","z":"7ea0620.a243ca","name":"Office Light 3 Control","x":365,"y":980,"wires":[["babbee9d013605d2"],["5da1ef5db9218f1e"],[]]},{"id":"5bdc695b13ac08ce","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":185,"y":760,"wires":[["6ab4a1291df30475"]]},{"id":"9843d42f60a63e30","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":200,"y":440,"wires":[["2758054b03a4112e"]]},{"id":"360cde2520d4ef73","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":185,"y":980,"wires":[["5e7dad3531a9ab92"]]},{"id":"668bfd5e97d64c23","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1205,"y":680,"wires":[["3863e49219f2c06c"]]},{"id":"6985e773c83c44f3","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1205,"y":940,"wires":[["c5c6137c20db841c"]]},{"id":"c6387631e23d9171","type":"trigger","z":"7ea0620.a243ca","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"1","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1200,"y":420,"wires":[["60a4dca9.c29d14"]]},{"id":"43c2e1ab9d4c3a33","type":"link in","z":"7ea0620.a243ca","name":"Office Light 1 Color Temp q-gate","links":["934e0600896a7adb","a8f21399bc702421","b05b2fb283191597","cd1e6d98e1856bda","9c85a0510c0826d0"],"x":615,"y":440,"wires":[["9dfb80638a8e3d73"]]},{"id":"3055458e27486427","type":"link in","z":"7ea0620.a243ca","name":"Office Light 1 Brightness q-gate","links":["a8f21399bc702421","a92499638df3f0ae","b1ee887a5f59e581","f66d24bc98a1e3de","9c85a0510c0826d0"],"x":615,"y":500,"wires":[["1c0b19f6eaee2844"]]},{"id":"b05b2fb283191597","type":"link out","z":"7ea0620.a243ca","name":"Office Light 1 Color Control","mode":"link","links":["43c2e1ab9d4c3a33","2a3d1ccf39330b28"],"x":525,"y":420,"wires":[]},{"id":"a92499638df3f0ae","type":"link out","z":"7ea0620.a243ca","name":"Office Light 1 Brightness Control","mode":"link","links":["3055458e27486427","4f8d44ef76bac586"],"x":525,"y":460,"wires":[]},{"id":"166c734b13052fb7","type":"link out","z":"7ea0620.a243ca","name":"Office Light 2 Color Control","mode":"link","links":["f6f58ab7e35f5688","9d3d2931ff09f30e"],"x":510,"y":740,"wires":[]},{"id":"fe02e119919f1fbf","type":"link out","z":"7ea0620.a243ca","name":"Office Light 2 Brightness Control","mode":"link","links":["bb5ea6235f3f465f","df433767e85260dc"],"x":510,"y":780,"wires":[]},{"id":"9d3d2931ff09f30e","type":"link in","z":"7ea0620.a243ca","name":"Office Light 2 Color Temp q-gate","links":["166c734b13052fb7","934e0600896a7adb","a8f21399bc702421","cd1e6d98e1856bda","8f139b7a2e1e1072"],"x":620,"y":700,"wires":[["5fcdbdfcad60b453"]]},{"id":"df433767e85260dc","type":"link in","z":"7ea0620.a243ca","name":"Office Light 2 Brightness q-gate","links":["a8f21399bc702421","b1ee887a5f59e581","f66d24bc98a1e3de","fe02e119919f1fbf","8f139b7a2e1e1072"],"x":620,"y":760,"wires":[["5731df33e0ef2e56"]]},{"id":"babbee9d013605d2","type":"link out","z":"7ea0620.a243ca","name":"Office Light 2 Color Control","mode":"link","links":["46442d133be6f963","4b80d3dcd0dcb9fa"],"x":510,"y":960,"wires":[]},{"id":"5da1ef5db9218f1e","type":"link out","z":"7ea0620.a243ca","name":"Office Light 2 Brightness Control","mode":"link","links":["4193dc61304afe65","4ccd12c7e9fa28f9"],"x":510,"y":1000,"wires":[]},{"id":"46442d133be6f963","type":"link in","z":"7ea0620.a243ca","name":"Office Light 3 Color Temp q-gate","links":["934e0600896a7adb","a8f21399bc702421","cd1e6d98e1856bda","babbee9d013605d2","3c70d73a047e84c9"],"x":620,"y":960,"wires":[["f38eeefba2af67ce"]]},{"id":"4ccd12c7e9fa28f9","type":"link in","z":"7ea0620.a243ca","name":"Office Light 3 Brightness q-gate","links":["5da1ef5db9218f1e","a8f21399bc702421","b1ee887a5f59e581","f66d24bc98a1e3de","3c70d73a047e84c9"],"x":620,"y":1020,"wires":[["22570f7cadf11491"]]},{"id":"ae9faf4f99f5df6b","type":"api-current-state","z":"7ea0620.a243ca","name":"On?","server":"c879ac61.99cd1","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.office_light_1","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1035,"y":460,"wires":[["c6387631e23d9171"],["d96a7d6cd4f42087"]]},{"id":"4449a34d85b294de","type":"api-current-state","z":"7ea0620.a243ca","name":"On?","server":"c879ac61.99cd1","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.office_light_2","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1040,"y":720,"wires":[["668bfd5e97d64c23"],["d5a0d787dd0474e6"]]},{"id":"5e4f3934b95b1e9e","type":"api-current-state","z":"7ea0620.a243ca","name":"On?","server":"c879ac61.99cd1","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.office_light_3","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1055,"y":980,"wires":[["6985e773c83c44f3"],["d17fef61a294583d"]]},{"id":"d96a7d6cd4f42087","type":"change","z":"7ea0620.a243ca","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1220,"y":500,"wires":[["9c85a0510c0826d0"]]},{"id":"9c85a0510c0826d0","type":"link out","z":"7ea0620.a243ca","name":"Office Light 1 is off","mode":"link","links":["3055458e27486427","43c2e1ab9d4c3a33"],"x":1335,"y":500,"wires":[]},{"id":"d5a0d787dd0474e6","type":"change","z":"7ea0620.a243ca","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1225,"y":760,"wires":[["8f139b7a2e1e1072"]]},{"id":"8f139b7a2e1e1072","type":"link out","z":"7ea0620.a243ca","name":"Office Light 1 is off","mode":"link","links":["9d3d2931ff09f30e","df433767e85260dc"],"x":1340,"y":760,"wires":[]},{"id":"3c70d73a047e84c9","type":"link out","z":"7ea0620.a243ca","name":"Office Light 1 is off","mode":"link","links":["46442d133be6f963","4ccd12c7e9fa28f9"],"x":1340,"y":1020,"wires":[]},{"id":"d17fef61a294583d","type":"change","z":"7ea0620.a243ca","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1225,"y":1020,"wires":[["3c70d73a047e84c9"]]},{"id":"911fe5374aa62c8f","type":"debug","z":"7ea0620.a243ca","name":"LIGHT 3 >>","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":475,"y":1040,"wires":[]},{"id":"a7af95da048df2ed","type":"debug","z":"7ea0620.a243ca","name":"JOIN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1035,"y":940,"wires":[]},{"id":"9752a473fa01a315","type":"debug","z":"7ea0620.a243ca","name":">> LIGHT 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":275,"y":1040,"wires":[]},{"id":"c5e4a35bf6b097fc","type":"debug","z":"7ea0620.a243ca","name":"color control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1015,"y":900,"wires":[]},{"id":"717f986548852cb7","type":"debug","z":"7ea0620.a243ca","name":"brightness control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1035,"y":1040,"wires":[]},{"id":"c879ac61.99cd1","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]