Please help - Shark Vacuum Room cleaning based floorplan

Hi,

I’m using the custom:floorplan-card and I’m trying to setup the Shark Vacuum for room cleaning. I have two SVGs (Den and Dining Room) that represent the shark vacuum in the floorplan. When I press the selected vacuum icon, it cleans that room. I have that working. What I can’t figure out is how to spin the icon for that room it is cleaning.

The shark vacuum integration does not return the room its cleaning, so I have no way to tell which room it is cleaning. So, when I press the shark SVG for a specified room, I’ll need to save off which room its in.

How can I accomplish that?

                - element: shark.clean_den
                  tap_action:
                    action: call-service
                    service: sharkiq.clean_room
                    service_data:
                      entity_id: vacuum.kitchen                    
                      rooms: Den
                  state_action:
                    service: floorplan.class_set
                    service_data: |
                      >  
                        if (element.state === "cleaning")  return "spinning-vacuum";   
                        else  if (element.state === "returning")  return "returning-vacuum";
                        else if (element.state === "error")  return "error-vacuum";
                        else return "";

                - element: shark.clean_dining
                  tap_action:
                    action: call-service
                    service: sharkiq.clean_room
                    service_data:
                      entity_id: vacuum.kitchen                    
                      rooms: "Dining Room" 
                  state_action:
                    service: floorplan.class_set
                    service_data: |
                      >  
                        if (element.state === "cleaning")  return "spinning-vacuum";   
                        else  if (element.state === "returning")  return "returning-vacuum";
                        else if (element.state === "error")  return "error-vacuum";
                        else return "";

Please help!!! I submitted this request for help 16 days ago.

When I select a vacuum icon on my floorplan which indicates that I want to clean that room. I would like to spin the icon and maybe change the color.

Does anyone have any idea how to save off which room is being clean so that I can spin the icon?

The shark vacuum device does not return which room is being cleaned.

Thanks for your help!!

Kevin

Can’t give you specific help on the code you’re using, sorry!

I’d suggest an input_select as helper, where you can save the room the vacuum is in. If you don’t call a service directly from your tap_action, but rather call a script, you can setup a script sequence where you can start the vacuum and set the room value in an input_select.

Afterwards you can easily read the state of the input_select and use it in your other configuration.

Thanks for the reply, I finally got it working the way I wanted.

OK, this “simple” thing required a bit of work.
I had to create a helper and use a script below.

The lovelace tap_actions do not support multiple actions for some reason.
I used the script referenced below for multiple actions.

I created a helper, input_text.cleaning_living_area, which I set to the room to clean. For example, den or dining.
I created an automation to reset the input_text.cleaning_living_area to “done” when the vacuum state changes from cleaning to docked

Below is yaml to support room cleaning:

                - element: shark.clean_den
                  entity:
                    - input_text.cleaning_living_area
                  tap_action:
                    action: call-service
                    service: script.multi_tap_action
                    service_data:
                      actions:
                        - service: sharkiq.clean_room
                          entity_id: vacuum.kitchen
                          data:
                            rooms: Den
                        - service: input_text.set_value
                          entity_id: input_text.cleaning_living_area
                          data:
                            value: den
                    target: {}
                  state_action:
                    service: floorplan.class_set
                    service_data: |
                      >  
                        if (entity.state === "den")  return "spinning-vacuum";   
                        else return "";

                - element: shark.clean_dining
                  entity:
                    - input_text.cleaning_living_area
                  tap_action:
                    action: call-service
                    service: script.multi_tap_action
                    service_data:
                      actions:
                        - service: sharkiq.clean_room
                          entity_id: vacuum.kitchen
                          data:
                            rooms: Dining Room
                        - service: input_text.set_value
                          entity_id: input_text.cleaning_living_area
                          data:
                            value: dining
                    target: {}
1 Like