Updated example flow.
Can update from both a flow and dashboard, and gets saved into a flow variable, all connected clients receive the update.
[{"id":"de6cfe9d86ed5b93","type":"ui-template","z":"bc05bdac7c068faa","group":"1a12ece250764369","dashboard":"64d151d89e8704cf","page":"0a534af73f5f11fb","name":"","order":0,"width":0,"height":0,"head":"","format":"<template>\n <div class=\"grid\">\n <v-btn class=\"switch\" stacked v-for=\"(item,index) in switches\" @click=\"switchState(index,item.state)\" :class=\"[item.state ? 'on': 'off']\">\n {{item.name}}\n <v-icon class=\"icon\">{{item.icon}}</v-icon>\n </v-btn>\n </div>\n</template>\n<script>\n export default {\n \n data() {\n return {\n switches:[]\n }\n },\n methods: {\n switchState(index,state) { \n this.switches[index].state = !this.switches[index].state\n this.update(index,state)\n },\n update(index,state){\n this.send({payload:{type:'change', 'switches':this.switches,'switch':this.switches[index]}})\n }\n },\n mounted() { \n \n this.send({payload:{type:'load'}})\n \n this.$socket.on(\"msg-input:\" + this.id, (msg) => {\n \n if('switches' in msg.payload){\n this.switches = msg.payload.switches\n }\n if('update' in msg.payload){\n const name = msg.payload.update.name\n const state = msg.payload.update.state\n const item_index = this.switches.findIndex(x=>x.name == name)\n\n this.switches[item_index].state = state\n this.update(index,state)\n // this.setState(item_index,state)\n }\n }) \n }\n \n}\n</script>\n<style>\n .grid{\n display:grid;\n width:100%;\n grid-template-columns: repeat(3, 1fr);\n gap:8px;\n }\n .switch {\n padding:8px;\n color: #aaa;\n font-size: 11px;\n background-color: #666;\n border-radius: 8px;\n }\n\n .icon {\n font-size: 40px;\n }\n\n .on {\n color: #BD9608;\n text-shadow: 0px 0px 10px #BD9608;\n\n }\n\n .off {\n \n text-shadow: 0px 0px 0px;\n }\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":240,"y":760,"wires":[["52d179278266ad5c"]]},{"id":"52d179278266ad5c","type":"switch","z":"bc05bdac7c068faa","name":"request ?","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"load","vt":"str"},{"t":"eq","v":"change","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":760,"wires":[["4a32d1d626bd3e12"],["c9cea85b0a55d3bc","4e1ceb072b981ddf"]]},{"id":"f5ce5f0e98be7dff","type":"link out","z":"bc05bdac7c068faa","name":"link out 39","mode":"link","links":["0ea5f03060a5f053","16449a5979598e53"],"x":1105,"y":720,"wires":[]},{"id":"16449a5979598e53","type":"link in","z":"bc05bdac7c068faa","name":"link in 25","links":["f5ce5f0e98be7dff","14e3e6c1de302422"],"x":135,"y":760,"wires":[["de6cfe9d86ed5b93"]]},{"id":"c9cea85b0a55d3bc","type":"change","z":"bc05bdac7c068faa","name":"","rules":[{"t":"set","p":"switches","pt":"flow","to":"payload.switches","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":780,"wires":[["72dd07b3cc9024e9"]]},{"id":"6d52057ea8bcdd86","type":"template","z":"bc05bdac7c068faa","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"plain","template":"[\n {\n \"name\": \"Cozhina\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n },\n {\n \"name\": \"Central\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n },\n {\n \"name\": \"Livingroom\",\n \"state\": false,\n \"icon\": \"mdi-lightbulb-outline\"\n },\n {\n \"name\": \"Bedroom\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n },\n {\n \"name\": \"Toilet\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n },\n {\n \"name\": \"Livingroom\",\n \"state\": false,\n \"icon\": \"mdi-lightbulb-outline\"\n },\n {\n \"name\": \"Bedroom\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n },\n {\n \"name\": \"Toilet\",\n \"state\": false,\n \"icon\": \"mdi-led-strip-variant\"\n }\n]","output":"json","x":780,"y":720,"wires":[["dd3e82cb5f9536c7"]]},{"id":"4a32d1d626bd3e12","type":"switch","z":"bc05bdac7c068faa","name":"get flow var","property":"switches","propertyType":"flow","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":740,"wires":[["6d52057ea8bcdd86"],["72dd07b3cc9024e9"]]},{"id":"dd3e82cb5f9536c7","type":"change","z":"bc05bdac7c068faa","name":"set default flow var","rules":[{"t":"set","p":"switches","pt":"flow","to":"payload","tot":"msg","dc":true},{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.switches","pt":"msg","to":"switches","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":700,"wires":[["f5ce5f0e98be7dff"]]},{"id":"72dd07b3cc9024e9","type":"change","z":"bc05bdac7c068faa","name":"switches","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.switches","pt":"msg","to":"switches","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":760,"wires":[["f5ce5f0e98be7dff"]]},{"id":"4e1ceb072b981ddf","type":"debug","z":"bc05bdac7c068faa","name":"debug 513","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":820,"wires":[]},{"id":"25c96721c32b4632","type":"inject","z":"bc05bdac7c068faa","name":"cozhina on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update\":{\"name\":\"Cozhina\",\"state\":true}}","payloadType":"json","x":200,"y":840,"wires":[["14e3e6c1de302422"]]},{"id":"4ad5c0331f11a00a","type":"inject","z":"bc05bdac7c068faa","name":"cozhina off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"update\":{\"name\":\"Cozhina\",\"state\":false}}","payloadType":"json","x":200,"y":880,"wires":[["14e3e6c1de302422"]]},{"id":"14e3e6c1de302422","type":"link out","z":"bc05bdac7c068faa","name":"link out 40","mode":"link","links":["16449a5979598e53"],"x":315,"y":860,"wires":[]},{"id":"1a12ece250764369","type":"ui-group","name":"Group Name","page":"0a534af73f5f11fb","width":"6","height":"1","order":-1,"showTitle":false,"className":""},{"id":"64d151d89e8704cf","type":"ui-base","name":"UI Name","path":"/dashboard"},{"id":"0a534af73f5f11fb","type":"ui-page","name":"Page Name","ui":"64d151d89e8704cf","path":"/","layout":"grid","theme":"ff0a34f890dc8310","order":-1,"className":""},{"id":"ff0a34f890dc8310","type":"ui-theme","name":"Theme Name","colors":{"surface":"#b51a00","primary":"#ffffff","bgPage":"#b51a00","groupBg":"#606060","groupOutline":"#606060"}}]