I am working on my home automation. In doing so I maintain a database of all of the switches and dimmers and their current state. I would like to have a switch widget available for each switch/dimmer in the database. Is there a way for me to create these dynamically? So that when I add switches the ui automatically gets updated? I also want to be able to have the switch widgets reflect the current state of the switch. But I think I am able to figure that part out once i Get more into it.
I am hopefully trying to avoid manually creating 40+ switch widgets.