A few months ago, I created a lighting controller in Flexdash, which worked great. Any button that I clicked would retain it's state if viewed on a different browser, if I refreshed or reopened a closed browser, even days later. So if I activated a light on with my desktop, I could check on my phone at a later time, see it's status and maybe switch it off.
But.. I don't know if it's a consequence of;
But now, the button states no longer persist, so as soon as the browser is closed, refreshed, or a different browser the visible state of the button is sadly gone
Here is a mock up flow to demonstrate -
[{"id":"43a8db52e4b4095f","type":"function","z":"1543d308b342690a","name":"flexdash button","func":"if (msg.payload == 'OFF') {\n msg.color = 'green-lighten-3'\n context.set('currentState', msg.color)\n} else if (msg.payload == 'ON') {\n msg.color = 'yellow-accent-3'\n context.set('currentState', msg.color)\n} else {\nconst state = context.get('currentState') || 'green-lighten-3'\nlet newState = (state == 'green-lighten-3') ? 'yellow-accent-3' : 'green-lighten-3'\ncontext.set('currentState', newState)\nmsg.color = newState\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":565,"y":2155,"wires":[["453a4dee8be38cc3"]]},{"id":"e957db9e5704ea77","type":"fd-push-button","z":"1543d308b342690a","fd_container":"dc6f6a921f8e0373","fd_cols":"4","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"Driveway Lights","title":"Driveway","popup_info":"","enabled":true,"color":"","output_value":1,"icon":null,"x":380,"y":2155,"wires":[["43a8db52e4b4095f"]]},{"id":"5ab534839435aa10","type":"fd-push-button","z":"1543d308b342690a","fd_container":"dc6f6a921f8e0373","fd_cols":"4","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"Garden Lights","title":"Garden","popup_info":"","enabled":true,"color":"","output_value":1,"icon":null,"x":380,"y":2230,"wires":[["03604196c56471e5"]]},{"id":"69f2bed6628bcbfb","type":"fd-push-button","z":"1543d308b342690a","fd_container":"dc6f6a921f8e0373","fd_cols":"4","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"Security Lights","title":"Security","popup_info":"","enabled":true,"color":"","output_value":1,"icon":null,"x":380,"y":2305,"wires":[["314386bde8e02957"]]},{"id":"d492601966ea1090","type":"fd-push-button","z":"1543d308b342690a","fd_container":"dc6f6a921f8e0373","fd_cols":"4","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"All off","title":"All Lights OFF","popup_info":"","enabled":true,"color":"purple-lighten-3","output_value":"OFF","icon":null,"x":120,"y":2255,"wires":[["5f525de183fd14f5"]]},{"id":"c820172e969b0af4","type":"fd-push-button","z":"1543d308b342690a","fd_container":"dc6f6a921f8e0373","fd_cols":"4","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"All off","title":"All Lights on","popup_info":"","enabled":true,"color":"purple-lighten-3","output_value":"ON","icon":null,"x":120,"y":2220,"wires":[["5f525de183fd14f5"]]},{"id":"03604196c56471e5","type":"function","z":"1543d308b342690a","name":"flexdash button","func":"if (msg.payload == 'OFF') {\n msg.color = 'green-lighten-3'\n context.set('currentState', msg.color)\n} else if (msg.payload == 'ON') {\n msg.color = 'yellow-accent-3'\n context.set('currentState', msg.color)\n} else {\nconst state = context.get('currentState') || 'green-lighten-3'\nlet newState = (state == 'green-lighten-3') ? 'yellow-accent-3' : 'green-lighten-3'\ncontext.set('currentState', newState)\nmsg.color = newState\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":2230,"wires":[["b71c85784cc7779a"]]},{"id":"314386bde8e02957","type":"function","z":"1543d308b342690a","name":"flexdash button","func":"if (msg.payload == 'OFF') {\n msg.color = 'green-lighten-3'\n context.set('currentState', msg.color)\n} else if (msg.payload == 'ON') {\n msg.color = 'yellow-accent-3'\n context.set('currentState', msg.color)\n} else {\nconst state = context.get('currentState') || 'green-lighten-3'\nlet newState = (state == 'green-lighten-3') ? 'yellow-accent-3' : 'green-lighten-3'\ncontext.set('currentState', newState)\nmsg.color = newState\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":2305,"wires":[["e98ec8288bdbfcd8"]]},{"id":"453a4dee8be38cc3","type":"junction","z":"1543d308b342690a","x":370,"y":2200,"wires":[["e957db9e5704ea77"]]},{"id":"b71c85784cc7779a","type":"junction","z":"1543d308b342690a","x":370,"y":2275,"wires":[["5ab534839435aa10"]]},{"id":"e98ec8288bdbfcd8","type":"junction","z":"1543d308b342690a","x":370,"y":2350,"wires":[["69f2bed6628bcbfb"]]},{"id":"5f525de183fd14f5","type":"junction","z":"1543d308b342690a","x":204,"y":2236,"wires":[["22f85dc3b60161fa","f1e1615673248a33","6cdb4f2c79162ecb"]]},{"id":"22f85dc3b60161fa","type":"junction","z":"1543d308b342690a","x":305,"y":2130,"wires":[["fdbf0ff17b8f81b7"]]},{"id":"f1e1615673248a33","type":"junction","z":"1543d308b342690a","x":305,"y":2205,"wires":[["2e79537acafd90ea"]]},{"id":"6cdb4f2c79162ecb","type":"junction","z":"1543d308b342690a","x":305,"y":2280,"wires":[["4057df264ff384ed"]]},{"id":"4057df264ff384ed","type":"junction","z":"1543d308b342690a","x":445,"y":2280,"wires":[["314386bde8e02957"]]},{"id":"2e79537acafd90ea","type":"junction","z":"1543d308b342690a","x":445,"y":2205,"wires":[["03604196c56471e5"]]},{"id":"fdbf0ff17b8f81b7","type":"junction","z":"1543d308b342690a","x":450,"y":2130,"wires":[["43a8db52e4b4095f"]]},{"id":"dc6f6a921f8e0373","type":"flexdash container","name":"Example panel","kind":"Panel","fd_children":",7b774415d2399f26,fa5803caa1b3f2d5,ec1cf605133c47cd,f0d58cbb8abe635f,1c3e766d6d24ef84,e957db9e5704ea77,5ab534839435aa10,69f2bed6628bcbfb,d492601966ea1090,c820172e969b0af4","title":"","tab":"fef6c0f6d48841d6","min_cols":"1","max_cols":"20","parent":"2fa703121bdc84d2","solid":true,"cols":"1","rows":"5"},{"id":"fef6c0f6d48841d6","type":"flexdash tab","name":"Energy","icon":"mdi-home-lightning-bolt-outline","title":"","fd_children":",69c2e3f5798c3475","fd":"e8f5aea52ab49500"},{"id":"2fa703121bdc84d2","type":"flexdash container","name":"Examples grid","kind":"StdGrid","fd_children":",dc6f6a921f8e0373","title":"Examples","tab":"6dfcd673f5649409","min_cols":"1","max_cols":"20","parent":"","solid":false,"cols":"1","rows":"1"},{"id":"6dfcd673f5649409","type":"flexdash tab","name":"Examples","icon":"mdi-view-dashboard","title":"Example flows","fd_children":",2fa703121bdc84d2","fd":"e8f5aea52ab49500"}]