Getting My Vacuum Cleaner to Start with a Button Card

Hey everyone, I wanted to share my recent experience with setting up a button card to start my vacuum cleaner. It was a bit of a challenge, but I managed to figure it out, so I thought I’d document the process for anyone else who might be struggling with something similar.

So, my goal was to create a button in Lovelace that, when pressed, would start the cleaning process on my Xiaomi vacuum cleaner. I set up the button card with the vacuum entity and used the vacuum.start service. But when I pressed the button, I got an error: ‘Error while calling service vacuum/start. must contain at least one of entity_id, area_id.’

At first, I was a bit confused. I thought the entity was already specified, but it seems the service needs more explicit instructions. After a bit of research and some trial and error, I realized that I needed to include the entity ID directly in the service call. Here’s how I fixed it:

yaml

  • type: button
    entity: vacuum.xiaomi_vacuum_cleaner
    tap_action:
    action: call-service
    service: vacuum.start
    data:
    entity_id: vacuum.xiaomi_vacuum_cleaner
    show_icon: true
    show_name: false
    show_state: false

By adding the entity_id in the service data, the button now works perfectly! Pressing it starts the vacuum without any issues. It was a bit frustrating at first, but breaking it down and checking the documentation helped me understand what was missing.

If anyone else is having trouble with button cards or service calls, feel free to reach out. I’m happy to help troubleshoot or share what I’ve learned. Happy automating! :rotating_light::sparkles: