I have a robot vacuum flashed with Valetudo and integrated into Home Assistant. This exposes a sensor, sensor.valetudo_dreame_d9_map_segments
, which contains as attributes several segments and their friendly names, like so:
"1": Bathroom
"2": Kitchen
"3": Living Room
"4": Kid's Room
"6": Main Bedroom
"7": Hallway
I would like to be able to mark the rooms I wish to be vacuumed via binary switches, set the number of passes via a number helper, and press a button to start my vacuum cleaning with those parameters.
I’ve created the helper entities for this purpose: one binary switch for each room (input_boolean.vacuum_bathroom
, input_boolean.vacuum_kitchen
, etc.), which I have grouped under group.vacuum_rooms
, and a number helper for the iterations, input_number.vacuum_iterations
.
I have downloaded this excellent blueprint package to help with sending commands to the vacuum.
The script takes, as input, a comma-separated list of segment names (their ‘friendly names’, not their ID numbers).
How can I generate such a comma-separated list from the binary sensors within the group that are in the state true
?