I don't want the elements one by one. I need the whole pair of 3, including the commas.
I am trying to replicate how an Ikea remote and an Ikea color light bulb communicate via the Ikea Tradfri Bridge
This is what I got so far. You can see in the code below. If I push the middle button I get to toggle on/off the light bulb. If I short press the upper button, I get to move the brightness up 15 points on each press and if I long press, I get to move the brightness up continuously until I stop pressing. The opposite for the lower button.
Now for the left and right button, I checked the Ikea Tradfri app while pushing the buttons and it seems there are 20 color presets that I randomly cycle through whenever I press the left or right button. Of course if I press left once and then right once, I should be going back to the same color. You can check the colors in the previous replies.
To simplify matters for now I would be very happy if I put the list and just cycle through it one by one, left and right depending on which button I press. Maybe like I did with the brightness, to cycle left if I press the left button, and right if I press the right button.
I am trying to create a function to fill an array (for output) with the array I selected from the main array (array of array). But I am not very good with functions.
[{"id":"5d7be55b.f6039c","type":"server-events","z":"7503cb14.1c6134","name":"","server":"3ed2660b.f6d8ba","event_type":"zha_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":310,"y":360,"wires":[["40f182d9.20278c"]]},{"id":"40f182d9.20278c","type":"switch","z":"7503cb14.1c6134","name":"Remote Commands","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"toggle","vt":"str"},{"t":"eq","v":"step_with_on_off","vt":"str"},{"t":"eq","v":"step","vt":"str"},{"t":"eq","v":"move_with_on_off","vt":"str"},{"t":"eq","v":"move","vt":"str"},{"t":"eq","v":"stop","vt":"str"},{"t":"eq","v":"press","vt":"str"},{"t":"eq","v":"hold","vt":"str"},{"t":"eq","v":"release","vt":"str"},{"t":"eq","v":"move_to_level_with_on_off","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":320,"y":520,"wires":[["e12ab7d0.f3ebc8"],["b09c6110.5bd75"],["bfb6151c.7b4478"],["7a567951.447498","5676108d.f0dfd"],["bcf002be.218b3","5ef6a19f.a5bf9"],["3fbcd8d.43d8d28","ca7965f.8711b98"],["2b9a28b8.a5d628"],["636227e2.7d1ea8"],["3db29909.5835f6","8b943136.803fb"],[]],"info":"Normal presses\n\n1 Middle - toggle\n2 Up - step_with_on_off\n3 Down - step\n4 Left - press (args: 257, 13, 0)\nRight - press (args: 256, 13, 0)\n\n\nLong presses\n\n5, 6 Middle - toggle, then release then move_to_level_with_on_off, then press (arg 2, 0, 0)\n\n7 Up - move_with_on_off and then stop (when unpressing the button)\n\n8, 9 Down - move and then stop (when unpressing the button)\n\n10 Left - hold (args: 3329, 0) and then release (arg: 3742)\n\nRight - hold (args: 3328, 0) and then release (arg: 2696)\n\n\n\n\n1 toggle\n2 step_with_on_off\n3 step\n7 move_with_on_off\n8 move\n9 stop\n4 press\n10 hold\n5 release\n6 move_to_level_with_on_off\n\n"},{"id":"416c3892.19a9f8","type":"inject","z":"7503cb14.1c6134","name":"on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":370,"y":660,"wires":[["8b53bc2a.fb39f"]]},{"id":"a736255f.2d2278","type":"inject","z":"7503cb14.1c6134","name":"off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":370,"y":700,"wires":[["2bf65be1.e30844"]]},{"id":"8b53bc2a.fb39f","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":520,"wires":[["f144fb51.2307d8"]]},{"id":"2bf65be1.e30844","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn OFF Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":580,"wires":[["f144fb51.2307d8"]]},{"id":"c5594516.62d738","type":"function","z":"7503cb14.1c6134","name":"Brightness up","func":"// add actual brightness value\nvar brightness = msg.data.attributes.brightness;\n\nbrightness = brightness + 15;\n \n\nif(brightness >= 255){\n brightness = 254;\n }\n \nif(brightness < 0){\n brightness = 0;\n\t} \n \nmsg.data.attributes.brightness = brightness\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":980,"y":640,"wires":[["c3ceaec4.05648"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"392c2534.62f7aa","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":640,"wires":[["c5594516.62d738"]]},{"id":"5f79d746.ba18c8","type":"function","z":"7503cb14.1c6134","name":"Brightness down","func":"// add actual brightness value\nvar brightness = msg.data.attributes.brightness;\n\nbrightness = brightness - 15;\n \n\nif(brightness >= 255){\n brightness = 254;\n }\n \nif(brightness < 1){\n brightness = 1;\n\t} \n \nmsg.data.attributes.brightness = brightness\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1000,"y":700,"wires":[["c3ceaec4.05648"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"fd53b136.0f8d4","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":700,"wires":[["5f79d746.ba18c8"]]},{"id":"c3ceaec4.05648","type":"api-call-service","z":"7503cb14.1c6134","name":"Light Brightness","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"{ \"brightness\": {{data.attributes.brightness}}, \"rgb_color\": {{data.attributes.rgb_color}} }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":640,"wires":[["872dfdd2.ac1e8"]],"info":"{\"brightness\": {{data.attributes.brightness}}}"},{"id":"122f5e5a.528e42","type":"inject","z":"7503cb14.1c6134","name":"brightness up","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":350,"y":760,"wires":[["b09c6110.5bd75"]]},{"id":"7befef54.a0fe8","type":"inject","z":"7503cb14.1c6134","name":"brightness down","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":340,"y":800,"wires":[["bfb6151c.7b4478"]]},{"id":"e959ed01.4977f","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":780,"wires":[["b732e44b.522c08"]]},{"id":"b732e44b.522c08","type":"function","z":"7503cb14.1c6134","name":"Brightness up (continous)","func":"// add actual brightness value\nvar brightness = msg.data.attributes.brightness;\n\nbrightness = brightness + 15;\n \n\nif(brightness >= 255){\n brightness = 254;\n }\n \nif(brightness < 0){\n brightness = 0;\n\t} \n \nmsg.data.attributes.brightness = brightness\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":780,"wires":[["c3ceaec4.05648","b9b9e9cf.ebe548"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"b9b9e9cf.ebe548","type":"delay","z":"7503cb14.1c6134","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1270,"y":780,"wires":[["7c61ace6.58ea64"]]},{"id":"7c61ace6.58ea64","type":"gate","z":"7503cb14.1c6134","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1450,"y":780,"wires":[["e959ed01.4977f"]]},{"id":"3fbcd8d.43d8d28","type":"change","z":"7503cb14.1c6134","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":700,"wires":[["7c61ace6.58ea64"]]},{"id":"52cf825b.58ea6c","type":"inject","z":"7503cb14.1c6134","name":"open","props":[{"p":"payload","v":"open","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":1450,"y":700,"wires":[["7c61ace6.58ea64"]]},{"id":"80c6f7a4.645af8","type":"inject","z":"7503cb14.1c6134","name":"close","props":[{"p":"payload","v":"close","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":1450,"y":740,"wires":[["7c61ace6.58ea64"]]},{"id":"7a567951.447498","type":"change","z":"7503cb14.1c6134","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":740,"wires":[["7c61ace6.58ea64"]]},{"id":"b0d76094.de4f","type":"inject","z":"7503cb14.1c6134","name":"brightness up (cont.)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":330,"y":900,"wires":[["7a567951.447498","5676108d.f0dfd"]]},{"id":"dee30c28.e5fdf","type":"inject","z":"7503cb14.1c6134","name":"brightness stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":340,"y":860,"wires":[["3fbcd8d.43d8d28","ca7965f.8711b98"]]},{"id":"872dfdd2.ac1e8","type":"debug","z":"7503cb14.1c6134","name":"light brightness","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1460,"y":640,"wires":[]},{"id":"f144fb51.2307d8","type":"debug","z":"7503cb14.1c6134","name":"light on/off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1450,"y":520,"wires":[]},{"id":"6cc68035.f2b4f","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":920,"wires":[["641611f3.c4328"]]},{"id":"641611f3.c4328","type":"function","z":"7503cb14.1c6134","name":"Brightness down (continous)","func":"// add actual brightness value\nvar brightness = msg.data.attributes.brightness;\n\nbrightness = brightness - 15;\n \n\nif(brightness >= 255){\n brightness = 254;\n }\n \nif(brightness < 0){\n brightness = 0;\n\t} \n \nmsg.data.attributes.brightness = brightness\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1000,"y":920,"wires":[["d28c63b4.e75fa","c3ceaec4.05648"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"d28c63b4.e75fa","type":"delay","z":"7503cb14.1c6134","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1270,"y":920,"wires":[["f162388f.fec128"]]},{"id":"f162388f.fec128","type":"gate","z":"7503cb14.1c6134","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1450,"y":920,"wires":[["6cc68035.f2b4f"]]},{"id":"ca7965f.8711b98","type":"change","z":"7503cb14.1c6134","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":840,"wires":[["f162388f.fec128"]]},{"id":"1b89e3cd.7cde0c","type":"inject","z":"7503cb14.1c6134","name":"open","props":[{"p":"payload","v":"open","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":1450,"y":840,"wires":[["f162388f.fec128"]]},{"id":"f996addd.7811","type":"inject","z":"7503cb14.1c6134","name":"close","props":[{"p":"payload","v":"close","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":1450,"y":880,"wires":[["f162388f.fec128"]]},{"id":"bcf002be.218b3","type":"change","z":"7503cb14.1c6134","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":880,"wires":[["f162388f.fec128"]]},{"id":"2bc0dcde.20e164","type":"inject","z":"7503cb14.1c6134","name":"brightness down (cont.)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":320,"y":940,"wires":[["bcf002be.218b3","5ef6a19f.a5bf9"]]},{"id":"b5620a4d.3ea0c8","type":"comment","z":"7503cb14.1c6134","name":"Brightness","info":"","x":580,"y":580,"wires":[]},{"id":"b09c6110.5bd75","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":640,"wires":[["392c2534.62f7aa"]]},{"id":"bfb6151c.7b4478","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":700,"wires":[["fd53b136.0f8d4"]]},{"id":"5676108d.f0dfd","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":780,"wires":[["e959ed01.4977f"]]},{"id":"5ef6a19f.a5bf9","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":920,"wires":[["6cc68035.f2b4f"]]},{"id":"e12ab7d0.f3ebc8","type":"api-call-service","z":"7503cb14.1c6134","name":"Light Toggle","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1250,"y":460,"wires":[["1572e956.47cea7"]]},{"id":"1572e956.47cea7","type":"debug","z":"7503cb14.1c6134","name":"light toggle","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1450,"y":460,"wires":[]},{"id":"6991393c.28a9e8","type":"inject","z":"7503cb14.1c6134","name":"light toggle","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":360,"y":620,"wires":[["e12ab7d0.f3ebc8"]]},{"id":"6b744a99.331bb4","type":"function","z":"7503cb14.1c6134","name":"Color Switch Left","func":"msg.payload = {\n domain: \"light\",\n service: \"turn_on\",\n data: {\n entity_id: \"light.lab_color_bulb\",\n rgb_color: msg.data.attributes.rgb_color\n }\n};\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":1040,"wires":[["754568a7.1ee2d8"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"290bf86c.154fc8","type":"function","z":"7503cb14.1c6134","name":"Color Switch Right","func":"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":1160,"wires":[["754568a7.1ee2d8"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"9c611585.784688","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":1160,"wires":[["290bf86c.154fc8"]]},{"id":"7dc4784b.6f2608","type":"inject","z":"7503cb14.1c6134","name":"color switch left","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":340,"y":1140,"wires":[["301221b9.b1bf8e"]]},{"id":"e206a6b6.416668","type":"inject","z":"7503cb14.1c6134","name":"color switch right","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":340,"y":1200,"wires":[["2f0e3533.aa549a"]]},{"id":"2f0e3533.aa549a","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":1160,"wires":[["9c611585.784688"]]},{"id":"ceb52def.1c308","type":"comment","z":"7503cb14.1c6134","name":"Color Switch","info":"Ikea Tradfri Bridge and App offer the possibility to switch between a set of colors. So we replicate that here.\n\nThis is the list of the 20 RGB values pairs","x":590,"y":980,"wires":[]},{"id":"84a95494.728308","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":1240,"wires":[["95bf648d.3d3bf8"]]},{"id":"95bf648d.3d3bf8","type":"function","z":"7503cb14.1c6134","name":"Color Switch Left (continous)","func":"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":1240,"wires":[["ebcd13f5.ca897","754568a7.1ee2d8"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"ebcd13f5.ca897","type":"delay","z":"7503cb14.1c6134","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1270,"y":1240,"wires":[["52352259.3c9f1c"]]},{"id":"52352259.3c9f1c","type":"gate","z":"7503cb14.1c6134","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1450,"y":1240,"wires":[["84a95494.728308"]]},{"id":"3db29909.5835f6","type":"change","z":"7503cb14.1c6134","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":1160,"wires":[["52352259.3c9f1c"]]},{"id":"10f966ff.ecdb59","type":"inject","z":"7503cb14.1c6134","name":"open","props":[{"p":"payload","v":"open","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":1450,"y":1160,"wires":[["52352259.3c9f1c"]]},{"id":"a81ce50.89cc618","type":"inject","z":"7503cb14.1c6134","name":"close","props":[{"p":"payload","v":"close","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":1450,"y":1200,"wires":[["52352259.3c9f1c"]]},{"id":"7714f2db.6199ac","type":"change","z":"7503cb14.1c6134","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":1200,"wires":[["52352259.3c9f1c"]]},{"id":"1699fcd7.036323","type":"inject","z":"7503cb14.1c6134","name":"color switch left (cont.)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":320,"y":1300,"wires":[["7714f2db.6199ac","962699a1.9df568"]]},{"id":"d4b09b6a.a69aa8","type":"inject","z":"7503cb14.1c6134","name":"color switch stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":340,"y":1260,"wires":[["8b943136.803fb","3db29909.5835f6"]]},{"id":"1b1aa9b3.4c43a6","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":1380,"wires":[["ea67884b.b152f8"]]},{"id":"ea67884b.b152f8","type":"function","z":"7503cb14.1c6134","name":"Color Switch Right (continous)","func":"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":1380,"wires":[["45f78569.cfc09c","754568a7.1ee2d8"]],"info":"min brightness 0\nmax brightness 255\n\nmin color_temp 0 \nmax color_temp 250"},{"id":"45f78569.cfc09c","type":"delay","z":"7503cb14.1c6134","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1270,"y":1380,"wires":[["556655f6.96b7bc"]]},{"id":"556655f6.96b7bc","type":"gate","z":"7503cb14.1c6134","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1450,"y":1380,"wires":[["1b1aa9b3.4c43a6"]]},{"id":"8b943136.803fb","type":"change","z":"7503cb14.1c6134","name":"close","rules":[{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":1300,"wires":[["556655f6.96b7bc"]]},{"id":"7dca0d46.f243a4","type":"inject","z":"7503cb14.1c6134","name":"open","props":[{"p":"payload","v":"open","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":1450,"y":1300,"wires":[["556655f6.96b7bc"]]},{"id":"13ebf9cc.579116","type":"inject","z":"7503cb14.1c6134","name":"close","props":[{"p":"payload","v":"close","vt":"str"},{"p":"topic","v":"control","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":1450,"y":1340,"wires":[["556655f6.96b7bc"]]},{"id":"348462b6.16bdee","type":"change","z":"7503cb14.1c6134","name":"open","rules":[{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":1340,"wires":[["556655f6.96b7bc"]]},{"id":"25746a05.125116","type":"inject","z":"7503cb14.1c6134","name":"color switch right (cont.)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bang","payloadType":"str","x":320,"y":1340,"wires":[["348462b6.16bdee","f805bf5.cd4c64"]]},{"id":"962699a1.9df568","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":1240,"wires":[["84a95494.728308"]]},{"id":"f805bf5.cd4c64","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":1380,"wires":[["1b1aa9b3.4c43a6"]]},{"id":"2b9a28b8.a5d628","type":"switch","z":"7503cb14.1c6134","name":"Remote Commands","property":"payload.event.args[0]","propertyType":"msg","rules":[{"t":"eq","v":"257","vt":"str"},{"t":"eq","v":"256","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":1020,"wires":[["301221b9.b1bf8e"],["2f0e3533.aa549a"]],"info":"Normal presses\n\n1 Middle - toggle\n2 Up - step_with_on_off\n3 Down - step\n4 Left - press (args: 257, 13, 0)\nRight - press (args: 256, 13, 0)\n\n\nLong presses\n\n5, 6 Middle - toggle, then release then move_to_level_with_on_off, then press (arg 2, 0, 0)\n\n7 Up - move_with_on_off and then stop (when unpressing the button)\n\n8, 9 Down - move and then stop (when unpressing the button)\n\n10 Left - hold (args: 3329, 0) and then release (arg: 3742)\n\nRight - hold (args: 3328, 0) and then release (arg: 2696)\n\n\n\n\n1 toggle\n2 step_with_on_off\n3 step\n4 press\n5 release\n6 move_to_level_with_on_off\n7 move_with_on_off\n8 move\n9 stop\n10 hold\n"},{"id":"636227e2.7d1ea8","type":"switch","z":"7503cb14.1c6134","name":"Remote Commands","property":"payload.event.command.args","propertyType":"msg","rules":[{"t":"eq","v":"3329","vt":"str"},{"t":"eq","v":"3328","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":1400,"wires":[["962699a1.9df568"],["f805bf5.cd4c64"]],"info":"Normal presses\n\n1 Middle - toggle\n2 Up - step_with_on_off\n3 Down - step\n4 Left - press (args: 257, 13, 0)\nRight - press (args: 256, 13, 0)\n\n\nLong presses\n\n5, 6 Middle - toggle, then release then move_to_level_with_on_off, then press (arg 2, 0, 0)\n\n7 Up - move_with_on_off and then stop (when unpressing the button)\n\n8, 9 Down - move and then stop (when unpressing the button)\n\n10 Left - hold (args: 3329, 0) and then release (arg: 3742)\n\nRight - hold (args: 3328, 0) and then release (arg: 2696)\n\n\n\n\n1 toggle\n2 step_with_on_off\n3 step\n4 press\n5 release\n6 move_to_level_with_on_off\n7 move_with_on_off\n8 move\n9 stop\n10 hold\n"},{"id":"301221b9.b1bf8e","type":"api-call-service","z":"7503cb14.1c6134","name":"Turn ON Light","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lab_color_bulb","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":1040,"wires":[["77e09144.04c91"]]},{"id":"e842f2b4.64dd8","type":"comment","z":"7503cb14.1c6134","name":"Remote for lab color bulb","info":"","x":330,"y":420,"wires":[]},{"id":"77e09144.04c91","type":"api-current-state","z":"7503cb14.1c6134","name":"Light State","server":"3ed2660b.f6d8ba","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lab_color_bulb","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":1040,"wires":[["6b744a99.331bb4"]]},{"id":"754568a7.1ee2d8","type":"api-call-service","z":"7503cb14.1c6134","name":"Light Brightness","server":"3ed2660b.f6d8ba","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1200,"y":1040,"wires":[[]],"info":"{\"brightness\": {{data.attributes.brightness}}}"},{"id":"3ed2660b.f6d8ba","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]