Controlling arbitrary number of custom MQTT IoT devices

Hi all,

I’ve got 12-13 custom ESP32-based hardware devices that I’ve managed to integrate with HA via MQTT Discovery, which works pretty well. They are IoT animal feeders, and they send discovery messages to HAMQTT using formulaic names for the sensors and buttons they expose, like: feeder_<human-friendly-name>_feed for a button, feeder_<human-friendly-name>_feed_result for a numeric sensor, etc. The <human_friendly_name> is (re)configurable on the device to suit users’ needs, so when they change the name on the device, HAMQTT sees a new device, which is fine AFAICT (I can clean out stale feeder entities with an external script). They each expose a button to HA that triggers a feeding event, and I need to be able to have automations cause any and all feeders to feed simultaneously, I’m assuming by pressing the button for each feeder or sending the MQTT command directly.

There seem to be many ways to skin this cat, which is daunting in and of itself, but none of them seem to provide a way to do the same thing to a list of entities matching a regular expression (^feeder_[A-Za-z0-9]+_feed$, in this case). I won’t always know the feeder name to hardcode them ahead of time, and this is going to scale to 40-ish feeders, so I really don’t want to have to do that, in the first place. Surely I’m missing something simple for what I assume is a common use case, because searching has so far not turned up anything useful (other than the auto-entities custom card, which I’m using to render the sensors and buttons on the dashboard).

It seems like AppDaemon can filter entities like this, and I’m very comfortable in Python, but that seems like overkill for this?

Thanks in advance for any insight!