Template syntax for selecting entity of domain type switch from list?

I’m trying to get the name of the single one switch entity of a device and I’ve gotten this far:

So – for later automation ideas – I have the device name in a text helper, I can get the device ID I need for an automation but I need the one switch entity id from that device to be able to toggle it in the automation. I have currently three of these cool Ulanzi clocks, flshed with the Awtrix firmware and I’m trying to use one IKEA Symfonisk gen2 remote to control all three of these watches/matrix display. :wink:

But I’m a noob at templating and Jinja2 and don’t quite understand the link between the Jinja2 select/reject/selectattr/map/… commands and the HA specific attributes.
So the last line doesn’t work yet. :see_no_evil:
Maybe someone has an idea? Maybe @petro, the templating Ninja?! :wink:

UPDATE:
Ohhh nooo, I’m afraid, my whole idea of using a text helper that contains the current Ulanzi clock’s device id and use that in an automation goes bunkers:

Please don’t say I can’t use templates in an automation? :flushed:

Device actions, triggers and conditions do not support templating.

Use the switch.toggle service. It will be a whole bunch easier too.

And stop using device automations.

1 Like

Ahhh, thanks so much, @tom_l, I’ll rethink everything and try my best to be not dependant on device IDs! :+1::+1: :blush: