I have an automation that will randomly turn on a single light from a list of lights. It works well and randomly turns on a single light from the list.
Unfortunately none of the lights defined in the list have this automation listed in the Automation section of the device. This makes it very easy to forget that this device is being used by this automation.
Is there a way to specify which devices are being targeted by an automation? Alternatively, is there a different way of randomly choosing an entity in an automation so that it would result in the automation being shown in the device’s automations list?
Home Assistant can’t make the association for the entity because none of those lights appear in the service call’s entity_id option (more generally, they’re not explicitly part of the target).
Only by specifying the entity as described above.
As explained, you would have to ensure each entity is explicitly specified in the service call. Here’s one way to do it. Obviously, it’s simpler to use templating to select a random entity.
Thanks for the reply and the clarification on how it actually determines which entities to associate the automation with. The last part of your comment spurred a different idea that seems to accomplish my goal.
I’ve got to duplicate the entities in the list but specifically calling them out the second time in something that never gets hit accomplishes that goal.