I have placed a button in each room with a template that will send out the Vac to clean the respective room individually. That’s pretty straight forward as the template simply includes a room ID.
I would now however like to have something on a Vacuum dashboard that does it the other way around. Something that would allow me to select multiple rooms. The problem with that is that it would need to add room ID’s to a template on the fly depending on the room selection. So I guess this would call for some kind of dynamic templating solution.
This is an example of the segment that calls for the cleaning of 2 rooms. 2 is dining room, 3 is kitchen:
So imagine I have a selectable button per room on a dashboard and I’ve selected dining room and kitchen. Depending on which buttons are selected, it would build the template so in this case the template would be as above with both room ID’s. But when I deselect dining room, then the template would have to remove the Kitchen Room ID (room 3).
I’d then have a ‘Go’ button that would call the template based on the selection of rooms made .
Maybe there’s an easier way to do this but don’t really see how. Appreciate any insights anyone could share.
TIA!
I’m not good at scripting in Jinja or YAML and basically what I’m trying to achieve is:
If button 1 is active but button 2 is inactive, and ‘Go’ button is pressed, trigger Template 1 (containing the RoomID for Living Room)
If button 2 is active but button 1 is inactive, and ‘Go’ button is pressed, trigger Template 2
(containing the RoomID for Dining Room)
If button 1 and button 2 are both active, and ‘Go’ button is pressed, trigger Template 3
(containing the RoomID for both Living Room and Dining Room)
There’s quite a few more buttons then just 1, 2 and Go which is why doing this via an automation seems insurmountable, hence asking for the assist.
I have 8 rooms total so the different combinations of rooms is quite substantial and that’s without even going into the permutations side of things (which I’m happy to leave well enough alone). So I don’t think I want to be manually doing this.
This sounds like an interesting setup! Maybe use 8 input booleans helper with your rooms, and a script that cleans the rooms based on input select values? I believe if you name them something like, room_clean_xxx or something else that is easy to script I guess, adding removing and renaming rooms should not be too painful
First of all, you can’t use templates in a tap_action. So you will need to create a script, and then call the script. In the script you can use templates to clean only those rooms you want.
As suggested by @jeppesen you can indeed use input_booleans and name them smartly (eg input_boolen.clear_room_3 for the kitchen).
You could also use a mapping variable to map the input booleans to the rooms.
Thx for the replies guys!
A bit busy flying around for work so not enough time atm, but definitely keen to try.
The boolean part I had already figured, that was kind of a given
It’s the scripting side of things that’s the tricky part.
I’m averagely decent at figuring out and editing exisiting low to mid complexity scripts, but suck at getting things started from scratch.
Thx for the code @TheFes, very very very much appreciated.
I’ll report back as soon as I’ve been able to play around with it!
Eureka, it works @TheFes !!!
Finally returned home and was able to test this out.
You did make a mistake in the script by doubling up on data and params but once I noticed that it was pretty straight forward.
Threw together a quick dash to select the rooms and now it’s busy doing it’s thing cleaning the bar and kitchen area. Mrs will be really happy
And let’s face it, so am I