Dashboard UI on/off switch issue

I ran into a problem that I couldn't figure out. I had a switch on the dashboard. It was set to on but. I selected the state follows input of the switch . When I click the switch from the UI it wouldn't change. Attached a debug node and it showed that the input would change (toggle if you will) from on to off, off to on. But the switch wouldn't change. At one point I noted that in the editor, I had a green square but with OFF/on. Eventually I sent a message via mqtt that seems to unstick the button but I can't quite figure out why it got stuck?

Without seeing your flow it's hard to tell anything.
What kind of output you are getting from MQTT?
Does the output from MQTT matches the data type that your switch is configured to?
If the switch is configured to send out Boolean (true/false) it expects Boolean for input also.
It will be much easier to help you if you share your flow or screenshots of your switch configuration.

If it's set to show state of the input then it will only show the state of the input - so clicking the switch will change the output but not the icon - the idea being that you would feed it back into the input - via some mechanism that checks the result of the click action... so when the indicator goes "on" you know that the thing you switched is really on. etc

Here's the flow

[{"id":"310ae05f.e25ed","type":"mqtt in","z":"a8691b08.399048","name":"TV Lamp","topic":"stat/TVLamp/POWER","qos":"0","broker":"4ea8322.ae0dacc","x":83.33334011501734,"y":936.6666870117188,"wires":[["785d1e3c.07daf","426bb23b.c791ec"]]},{"id":"785d1e3c.07daf","type":"debug","z":"a8691b08.399048","name":"","active":true,"console":"false","complete":"true","x":522,"y":787,"wires":[]},{"id":"426bb23b.c791ec","type":"ui_switch","z":"a8691b08.399048","name":"","label":"TV Lamp","group":"dcfb116.92399f","order":5,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","x":472,"y":937,"wires":[["5d4ffb59.c58274"]]},{"id":"5d4ffb59.c58274","type":"mqtt out","z":"a8691b08.399048","name":"TV Lamp","topic":"cmnd/TVLamp/POWER","qos":"0","retain":"false","broker":"4ea8322.ae0dacc","x":751,"y":937,"wires":[]},{"id":"4ea8322.ae0dacc","type":"mqtt-broker","z":"","broker":"192.168.24.2","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"dcfb116.92399f","type":"ui_group","z":"","name":"Default","tab":"db89d438.d66268","disp":true,"width":"6"},{"id":"db89d438.d66268","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":8}]

Note that it's working now but this was fixed by me sending a simple on into the input topic.