"Build" an MQTT-Service by tapping multiple buttons

Hi guys,

I am currently running a Roborock with Valetudo on it which communicates with HA via MQTT. I divided the flat into multiple rooms with each room having its unique ID (number). Currently I have a button for each room and when tapped, it calls the respective MQTT service with the ID of the room to be cleaned.
The problem is that you cannot select multiple rooms at once wirhout having to set up a script for every possible combination, so you have to wait for each room to be cleaned to start the next one.
My plan is to be able to tap multiple buttons for the different rooms after another (e.g. kitchen and living room), they then should stay “tapped” for a limited time and the tap itself should write the ID of the selected room into a call-service. At the end when every room is selected there should be an option to “execute” the command and call the service with all selected IDs in it.

I hope I did make myself understandable what I want to do, unfortunately I did not find any possibility to do so and no other topics matching my idea, so does anyone here have any ideas how to manage this?

Thanks and best regards,

Holger

One possible approach would be to create a new input_text helper entity and then queue the IDs you’d want cleaned in there in a comma-separated fashion.

This is how the service call to queue a new ID newIdToAdd could look like:

service: input_text.set_value
data:
  value: "{{ states('input_text.testhelper01') | default('') ~ (',' if states('input_text.testhelper01') != '') ~ '\"newIdToAdd\"' }}"
target:
  entity_id: input_text.testhelper01

Thanks, I’ll give it a try!