core: Vacuum vacuum.return_to_base not working with switch template

The problem

I have a Xiaomi Vacuum S50. It has been working fine for more than a year with my switch template. I created this template because I wanted to expose it on HomeKit as well.

It used to work fine in the sense that turning the switch on would start the vacuum and turning it off will stop the vacuum and send it to the base. However now when I turn the switch off, the vacuum just pauses/stops instead of going back to the base as well. I have the latest firmware on the vacuum.

I’ve checked on the integrations page and this is the correct command for turning it off and send it to the base, however the expected result is not the same as it used to be.

Environment

Home Assistant 0.106.1 through Hassio arch | x86_64 dev | false docker | true hassio | true os_name | Linux python_version | 3.7.6 timezone | Europe/Madrid version | 0.106.1 virtualenv | false

  • Home Assistant release with the issue: 0.106.1
  • Last working Home Assistant release (if known): can’t remember
  • Operating environment (Hass.io/Docker/Windows/etc.): Hassio
  • Integration causing this issue: Vacuum
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/vacuum

Problem-relevant configuration.yaml

- platform: template
    switches:
      limpiador_vacuum:
        friendly_name: Limpiador
        value_template: "{{ is_state('vacuum.limpiador', 'cleaning') }}"
        turn_on:
          service: vacuum.start
          entity_id: vacuum.limpiador
        turn_off:
          service: vacuum.return_to_base
          entity_id: vacuum.limpiador

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 26 (11 by maintainers)

Most upvoted comments

I fixed this temporarily by this script:

dock_xiaomi:
  alias: Dock Xiaomi
  sequence:
  - data:
      entity_id: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.stop
  - delay:
      seconds: 1
  - data:
      entity_id: vacuum.xiaomi_vacuum_cleaner
    service: vacuum.return_to_base

@jaddel This worked for me with a template switch:

    roomba_switch:
        friendly_name: "Roomba"
        value_template: '{{ is_state("vacuum.roomba", "on") }}'
        turn_on:
          service: vacuum.turn_on
          data:
            entity_id: vacuum.roomba
        turn_off:
        - service: vacuum.stop
          data:
            entity_id: vacuum.roomba
        - delay:
            seconds: 1
        - service: vacuum.return_to_base
          data:
            entity_id: vacuum.roomba

Ideally this sequence should be built into the integration for return to base.

What happens when you use just a service call vacuum.return_to_base instead of the switch template? Do you get any errors in the logs when you call that?

Thanks for your reply!. I’ve tried what you suggested and I called the service directly: If the vacuum is running and I call the service the robot will “pause”, same behaviour as from the switch. While the robot is paused, If then I call the service again it will go to the base.

I’ve tried enabling debug logs but I’m not getting anything there