I have a list of devices (id and name) to show as switches in the dashboard. Can I create the switches dynamically, from a function, so that I don't have to build each of them in the flow manually?
Only if you build your own in a ui-template
Do you mean by using Angular code?
yes - eg see previous thread Dynamically create dashboard items