How can I update a switch status on the dashboard

Show us the command line you use to do it and export the flow consisting of the button to the mqtt out node and post that too. See this for how to post a flow