postaram sie zrobić tak żeby był licznik od 1 do np 7 czyli od pierwszego do 7mego koloru
każdemu przypisze inna wartość a potem za pomoca swich’a będe odpowiednie włączał
kliknięcie bedzie robiło coś w styli bieżący kolor + 1 lub -1
nie wiem czemu na to nie wpadłem wcześniej, dopiero znaleziony wątek który wkleiłem wyżej mnie natchnął. Tak że nawet nie będę musiał identyfikować aktualnego koloru czyli tych XY bo bede miał to zapisane w zmiennej o konkretnym numerze
gotowe i pięknie działa
[{"id":"3296fe84c778e7d9","type":"tab","label":"Oświetlenie","disabled":false,"info":"","env":[]},{"id":"244c401a84e82669","type":"server-state-changed","z":"3296fe84c778e7d9","name":"Tymon kontakt","server":"156cd5250fc9143d","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["sensor.z_kontakt_tymon_action"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":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":100,"y":460,"wires":[["93ba399e3d3a21d5"]]},{"id":"93ba399e3d3a21d5","type":"function","z":"3296fe84c778e7d9","name":"function 1","func":"var tymon_lampka = msg.payload\n\nmsg.payload = ''\n\nif (tymon_lampka == 'on'){\n msg.payload = \"on\"\n}\nif (tymon_lampka == 'off'){\n msg.payload = \"off\"\n}\nif (tymon_lampka == 'brightness_move_up'){\n msg.payload = \"brightness_move_up\"\n}\nif (tymon_lampka == 'brightness_move_down'){\n msg.payload = \"brightness_move_down\"\n}\nif (tymon_lampka == 'brightness_stop'){\n msg.payload = \"brightness_stop\"\n}\nif (tymon_lampka == 'arrow_right_hold'){\n msg.payload = \"arrow_right_hold\"\n}\nif (tymon_lampka == 'arrow_left_hold'){\n msg.payload = 'arrow_left_hold'\n}\nif (tymon_lampka == 'arrow_right_release' || tymon_lampka == 'arrow_left_release'){\n msg.payload = \"color_temp_stop\"\n}\nif (tymon_lampka == 'arrow_right_click'){\n msg.payload = 'arrow_right_click'\n}\nif (tymon_lampka == 'arrow_left_click'){\n msg.payload = 'arrow_left_click'\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":460,"wires":[["db3abc3197dd8ee2","b677610313e36730"]]},{"id":"e68068ed4af8ba72","type":"mqtt out","z":"3296fe84c778e7d9","name":"","topic":"zigbee2mqtt/Z Zarowka LED Lampka Tymon/set","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"49b255e065ce7528","x":260,"y":60,"wires":[]},{"id":"39f48e1db14547cb","type":"mqtt in","z":"3296fe84c778e7d9","name":"","topic":"zigbee2mqtt/Z Zarowka LED Lampka Tymon","qos":"2","datatype":"auto-detect","broker":"49b255e065ce7528","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":140,"wires":[["319c30f08ba1441f","8f95216d78fc5b2c"]]},{"id":"73b46b84d21dcc7d","type":"mqtt out","z":"3296fe84c778e7d9","name":"","topic":"zigbee2mqtt/Z Zarowka LED Lampka Tymon/get","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"49b255e065ce7528","x":540,"y":240,"wires":[]},{"id":"314023e6610111c3","type":"function","z":"3296fe84c778e7d9","name":"jasnosc wartosc","func":"msg.payload =\n{\n \"brightness\": \"\",\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":220,"wires":[["73b46b84d21dcc7d"]]},{"id":"c16392beed639f74","type":"inject","z":"3296fe84c778e7d9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":220,"wires":[["314023e6610111c3"]]},{"id":"319c30f08ba1441f","type":"debug","z":"3296fe84c778e7d9","name":"debug 4","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":500,"y":180,"wires":[]},{"id":"93546cbe3b58c140","type":"function","z":"3296fe84c778e7d9","name":"off","func":"msg.payload = {\n \"state\": \"off\",\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1010,"y":60,"wires":[["8ee9ddfba38b509e"]]},{"id":"ac123be1487f5b0e","type":"inject","z":"3296fe84c778e7d9","name":"22:30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"30 22 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":870,"y":60,"wires":[["93546cbe3b58c140"]]},{"id":"e5e28fa8eb384737","type":"function","z":"3296fe84c778e7d9","name":"on","func":"msg.payload = {\n \"state\": \"on\",\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":240,"wires":[["53e712216c9b6cee","0fef0cfc725cbc8a"]]},{"id":"96ce112bd902767a","type":"function","z":"3296fe84c778e7d9","name":"off","func":"msg.payload = {\n \"state\": \"off\",\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":280,"wires":[["53e712216c9b6cee","01348270f74523e9"]]},{"id":"b3580577f2589e38","type":"function","z":"3296fe84c778e7d9","name":"jaśniej","func":"msg.payload = {\n \"brightness_move\": 40,\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":320,"wires":[["53e712216c9b6cee"]]},{"id":"05d88a0c8199970b","type":"function","z":"3296fe84c778e7d9","name":"ciemniej","func":"msg.payload = {\n \"brightness_move\": -40,\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":360,"wires":[["53e712216c9b6cee"]]},{"id":"4a792ef5a13af42f","type":"function","z":"3296fe84c778e7d9","name":"jasność stop","func":"msg.payload = {\n \"brightness_move\": 0,\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":400,"wires":[["53e712216c9b6cee"]]},{"id":"305afdbcd55e4bfe","type":"function","z":"3296fe84c778e7d9","name":"kolor temp up","func":"msg.payload = {\n \"color_temp_move\": 50,\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":440,"wires":[["53e712216c9b6cee"]]},{"id":"281e677431269def","type":"function","z":"3296fe84c778e7d9","name":"kolor temp down","func":"msg.payload = {\n \"color_temp_move\": -50,\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":480,"wires":[["53e712216c9b6cee"]]},{"id":"963a2b3c40c3c087","type":"function","z":"3296fe84c778e7d9","name":"kolor temp stop","func":"msg.payload = {\n \"color_temp_move\": \"stop\",\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":520,"wires":[["53e712216c9b6cee"]]},{"id":"db3abc3197dd8ee2","type":"switch","z":"3296fe84c778e7d9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"brightness_move_up","vt":"str"},{"t":"eq","v":"brightness_move_down","vt":"str"},{"t":"eq","v":"brightness_stop","vt":"str"},{"t":"eq","v":"arrow_right_hold","vt":"str"},{"t":"eq","v":"arrow_left_hold","vt":"str"},{"t":"eq","v":"color_temp_stop","vt":"str"},{"t":"eq","v":"arrow_right_click","vt":"str"},{"t":"eq","v":"arrow_left_click","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":610,"y":460,"wires":[["e5e28fa8eb384737"],["96ce112bd902767a"],["b3580577f2589e38"],["05d88a0c8199970b"],["4a792ef5a13af42f"],["305afdbcd55e4bfe"],["281e677431269def"],["963a2b3c40c3c087"],["1668844203d36120"],["1668844203d36120"]]},{"id":"53e712216c9b6cee","type":"link out","z":"3296fe84c778e7d9","name":"link out 161","mode":"link","links":["236cc0a1cd06e797"],"x":1025,"y":380,"wires":[]},{"id":"236cc0a1cd06e797","type":"link in","z":"3296fe84c778e7d9","name":"link in 149","links":["53e712216c9b6cee","0aa2f2f93b450cc3","eb1d51e1ab7b92e9","8ee9ddfba38b509e"],"x":45,"y":60,"wires":[["e68068ed4af8ba72"]]},{"id":"5789b1b7b31e5de2","type":"inject","z":"3296fe84c778e7d9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":260,"wires":[["1206f30e596d5d64"]]},{"id":"1206f30e596d5d64","type":"function","z":"3296fe84c778e7d9","name":"color XY","func":"msg.payload =\n{\n \"color\":{\"x\":\"\",\"y\":\"\"}\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":260,"wires":[["73b46b84d21dcc7d"]]},{"id":"8f95216d78fc5b2c","type":"function","z":"3296fe84c778e7d9","name":"XY - nieuzywane ale zostawiam jako sciagawka","func":"var X = msg.payload.color.x\nvar Y = msg.payload.color.y\nflow.set(\"x\", X)\nflow.set(\"y\", Y)\n//var XY = {payload:msg.payload.color}\n//msg.payload = X\n//Y.payload = ''+Y\n//var msg1 = { payload:X };\n//var msg2 = { payload:Y };\n\n//return [msg1, msg2];\n//return XY;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":140,"wires":[[]]},{"id":"b5e09d48a0bf5520","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": {\"rgb\":\"255,170,78\"},\n}\nreturn msg;\n//\"color\": {\"rgb\":\"255,146,39\"}\n//\"color\": {\"rgb\":\"255,170,95\"}\n//\"color\": {\"rgb\":\"255,190,135\"}\n//\"color\": {\"rgb\":\"255,206,166\"}\n//\"color\": {\"rgb\":\"129,173,255\"}\n//\"color\": {\"rgb\":\"215,151,255\"}\n//\"color\": {\"rgb\":\"255,159,242\"}\n//\"color\": {\"rgb\":\"255,112,86\"}\n//\"color\": {\"rgb\":\"145,255,48\"}\n//\"color\": {\"rgb\":\"106,32,255\"}\n//\"color\": {\"rgb\":\"255,170,78\"}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":740,"wires":[["0aa2f2f93b450cc3"]]},{"id":"0aa2f2f93b450cc3","type":"link out","z":"3296fe84c778e7d9","name":"link out 163","mode":"link","links":["236cc0a1cd06e797"],"x":365,"y":740,"wires":[]},{"id":"9a388fdeaf68d342","type":"inject","z":"3296fe84c778e7d9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":740,"wires":[["b5e09d48a0bf5520"]]},{"id":"1668844203d36120","type":"function","z":"3296fe84c778e7d9","name":"numer koloru","func":"var zmiana = msg.payload\nif (zmiana == 'arrow_right_click'){\n zmiana = 1\n}\nif (zmiana == 'arrow_left_click') {\n zmiana = -1\n}\nvar aktualny_kolor = flow.get('kolor') || 1\nvar max_kolor = flow.get('max_kolor')\nvar nowy_kolor = 1\n\nnowy_kolor = aktualny_kolor + zmiana\n\nif (nowy_kolor > max_kolor){\n nowy_kolor = 1\n}\nif (nowy_kolor < 1) {\n nowy_kolor = max_kolor\n}\n\nflow.set('kolor', nowy_kolor)\nmsg.payload = nowy_kolor\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":620,"wires":[["a22590bff3580d5b","3fae79a1825001e5"]]},{"id":"44dc90edd0762b21","type":"change","z":"3296fe84c778e7d9","name":"max kolorów - trzeba zmieniac razem ze zmiana ilosci kolorow w swich kolor nr","rules":[{"t":"set","p":"max_kolor","pt":"flow","to":"7","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":740,"wires":[[]]},{"id":"a22590bff3580d5b","type":"debug","z":"3296fe84c778e7d9","name":"kolor numer","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":770,"y":660,"wires":[]},{"id":"3fae79a1825001e5","type":"switch","z":"3296fe84c778e7d9","name":"kolor nr","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"6","vt":"num"},{"t":"eq","v":"7","vt":"num"}],"checkall":"false","repair":false,"outputs":7,"x":940,"y":620,"wires":[["2330cf1804569fcc"],["5449be4371a1a448"],["9ff1fec2f11a5949"],["a137fbb52780aa8d"],["3c524350fb752f03"],["6e67db2e6928dc56"],["b0fe42da5e2031ef"]]},{"id":"5449be4371a1a448","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": {\"rgb\":\"255,138,45\"},\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":540,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"9ff1fec2f11a5949","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"255,228,52\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":580,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"3c524350fb752f03","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"124,158,255\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":660,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"b0fe42da5e2031ef","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"255,151,245\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":740,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"2330cf1804569fcc","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"255,81,63\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":500,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"a137fbb52780aa8d","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"110,255,52\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":620,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"6e67db2e6928dc56","type":"function","z":"3296fe84c778e7d9","name":"kolor RGB","func":"msg.payload = {\n \"color\": { \"rgb\": \"110,39,255\" },\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":700,"wires":[["eb1d51e1ab7b92e9"]]},{"id":"eb1d51e1ab7b92e9","type":"link out","z":"3296fe84c778e7d9","name":"link out 164","mode":"link","links":["236cc0a1cd06e797"],"x":1315,"y":620,"wires":[]},{"id":"0fef0cfc725cbc8a","type":"stoptimer-varidelay","z":"3296fe84c778e7d9","duration":"90","durationType":"num","units":"Minute","payloadtype":"num","payloadval":"0","name":"","reporting":"every_second","reportingformat":"seconds","persist":true,"ignoretimerpass":false,"x":1180,"y":240,"wires":[["ebd63ec81a5f2d30"],[],[]]},{"id":"ebd63ec81a5f2d30","type":"link out","z":"3296fe84c778e7d9","name":"link out 165","mode":"link","links":["d1d2734ccb9339e9"],"x":1295,"y":220,"wires":[]},{"id":"d1d2734ccb9339e9","type":"link in","z":"3296fe84c778e7d9","name":"link in 151","links":["ebd63ec81a5f2d30"],"x":905,"y":100,"wires":[["93546cbe3b58c140"]]},{"id":"01348270f74523e9","type":"change","z":"3296fe84c778e7d9","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":280,"wires":[["0fef0cfc725cbc8a"]]},{"id":"b677610313e36730","type":"link out","z":"3296fe84c778e7d9","name":"link out 166","mode":"link","links":["2a229b3dfb830b38"],"x":425,"y":500,"wires":[]},{"id":"2a229b3dfb830b38","type":"link in","z":"3296fe84c778e7d9","name":"link in 152","links":["b677610313e36730"],"x":455,"y":740,"wires":[["44dc90edd0762b21"]]},{"id":"8ee9ddfba38b509e","type":"link out","z":"3296fe84c778e7d9","name":"link out 167","mode":"link","links":["236cc0a1cd06e797"],"x":1095,"y":60,"wires":[]},{"id":"156cd5250fc9143d","type":"server","name":"Home Assistant","version":5,"addon":false,"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":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false},{"id":"49b255e065ce7528","type":"mqtt-broker","name":"","broker":"192.168.50.201","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]