Hi @rkokkelk
Could you share your flows on setting the buttons and how you manage to change colors, etc. Thanks!
I’m using only a button template, just because you can change only the icon color with the switch template, with the button you have access to the background color. The trick for keeping the state of of your object is using a boolean variable and store it.
My flow for the button template
[{"id":"bf6f5dba.1e48f8","type":"ui_button","z":"d6fa9f2d.3d501","name":"ON/OFF Lampe Bureau","group":"a9bd2e1d.1bde3","order":8,"width":3,"height":1,"passthru":false,"label":"{{msg.topic}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"fa-power-off fa-2x","payload":"lightstate_bureau","payloadType":"global","topic":"homie/homey-topic/lampebureau/onoff/set","x":810,"y":1360,"wires":[["864c9074.1dfa4"]]},{"id":"864c9074.1dfa4","type":"function","z":"d6fa9f2d.3d501","name":"Toggle On / Off","func":"var lightstate_bureau = flow.get(\"lightstate_bureau\") || false;\nmsg.payload = !lightstate_bureau;\nreturn msg;","outputs":1,"noerr":0,"x":1040,"y":1360,"wires":[["b4126e1c.ec2c3"]],"inputLabels":["input"],"outputLabels":["to button"]},{"id":"7788fc72.df1b3c","type":"mqtt in","z":"d6fa9f2d.3d501","name":"MQTT Lampe Bureau","topic":"homie/homey-topic/lampebureau/onoff","qos":"0","datatype":"auto","broker":"eda480cd.72d73","x":380,"y":1360,"wires":[["6561ae0e.a2bac"]]},{"id":"6561ae0e.a2bac","type":"function","z":"d6fa9f2d.3d501","name":"Object State","func":"var lightstate_bureau = flow.get(\"lightstate_bureau\") || undefined;\nvar label;\nvar color;\n\nif(msg.payload === \"true\"){\n label = 'LAMPE BUREAU';\n color = \"#FFC815\";\n lightstate_bureau = true;\n}\nelse{\n label = 'LAMPE BUREAU';\n color = \"\";\n lightstate_bureau = false;\n}\n\nflow.set(\"lightstate_bureau\",lightstate_bureau);\nmsg = {topic:label, background:color};\n\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":1360,"wires":[["bf6f5dba.1e48f8"]]},{"id":"b4126e1c.ec2c3","type":"mqtt out","z":"d6fa9f2d.3d501","name":"MQTT Lampe Bureau","topic":"homie/homey-topic/lampebureau/onoff/set","qos":"","retain":"","broker":"eda480cd.72d73","x":1260,"y":1360,"wires":[]},{"id":"a9bd2e1d.1bde3","type":"ui_group","z":"","name":"Eclairage","tab":"a2490d0e.a872b","order":9,"disp":true,"width":"6","collapse":true},{"id":"eda480cd.72d73","type":"mqtt-broker","z":"","name":"Homey MQTT Riko","broker":"192.168.0.34","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"homey-topic/hub/status","birthQos":"2","birthRetain":"false","birthPayload":"msg.payload","closeTopic":"","closeQos":"2","closeRetain":"false","closePayload":"","willTopic":"","willQos":"2","willRetain":"false","willPayload":""},{"id":"a2490d0e.a872b","type":"ui_tab","z":"","name":"Homey Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]