How to display an entity as a toggleable switch?

I use the wonderful auto-entities card to dynamically display the status of a dynamic sent of entities (for instance anything that has “battery” as an attribute). It works great.

I now have the following problem: I have entities in my custom domain (say, mydomain.hello and that are generated programmatically outside of the HA UI. I would like to have a card where the state of these entities is displayed (so far this the same as the example of the batteries above), but in the form of a switch I can toggle to change the state from ‘on’ to ‘off’ and back.

So far I just get the state of the entity, but do not know how to make it changeable. Is this possible with that card?

If you want to control them and they are not in the switch domain you are going to have to make template switches.

Thank you. I found but it looks like this is a static configuration. Would you have an idea how to combine it with the dynamic nature of auto-entities?

Nope, you are going to have to create a template switch for each entity. You can then choose whether or not these new entities are displayed with the auto-entities card.

Thanks. And I guess that this is not something that can be built dynamically? In other words, the templates must be defined (hardcoded) in configuration.yaml ?