How can I turn off my Litter Robot 4 in a script?

Hi all, first post. Hope this is formatted well.

I consider myself an amateur with Home Assistant but am eager and willing to learn.

My goal: Create a script that turns on my Litter Robot 4, runs a cycle, and then turns off.

This may sound silly to anyone familiar with the hardware, but my cat is still adjusting to the device and I do not leave it on all the time. So we kind of use it in a “Semi-auto” mode for the moment while she adapts to it.

I have gotten as far as being able to turn it on, run a cycle, and then even have it press the reset button. But I cannot figure out how to turn it off again.

I saw from some previous posts that vacuum.turn_off is no longer supported and is now vacuum.stop, which is what I believe I want to be able to do in a script but I cannot seem to figure out how.

Using the visual editor, this is the script I’ve come up with so far:

sequence:
  - device_id: a752e59b473507144a571aacb49165db
    domain: vacuum
    entity_id: 350df2bd33fc65654cb3a913d0b861b9
    type: clean
    metadata:
      secondary: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - device_id: a752e59b473507144a571aacb49165db
    domain: button
    entity_id: bbc9bc69e882bf390a819d3094b549ec
    type: press
  - device_id: a752e59b473507144a571aacb49165db
    domain: vacuum
    entity_id: 350df2bd33fc65654cb3a913d0b861b9
    type: clean
  - wait_for_trigger:
      - device_id: a752e59b473507144a571aacb49165db
        domain: vacuum
        entity_id: 350df2bd33fc65654cb3a913d0b861b9
        type: docked
        trigger: device
  - device_id: a752e59b473507144a571aacb49165db
    domain: button
    entity_id: bbc9bc69e882bf390a819d3094b549ec
    type: press
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - device_id: a752e59b473507144a571aacb49165db
    domain: vacuum
    entity_id: 350df2bd33fc65654cb3a913d0b861b9
    type: dock
alias: LR4 Cycle then Power Off
description: ""

However, when I run the script, I get: Error: Entity vacuum.missy_s_magic_box_litter_box does not support action vacuum.return_to_base

Well, the visual editor doesn’t have a “stop” option, so I edited the YAML to change type: dock to type: stop, but that gives me a different error and won’t let me save. Message malformed: value must be one of ['clean', 'dock'] for dictionary value @ data['type']

The thing is, I am pretty sure that sending a stop signal is what I want to do. If I navigate to the devices page, then to the Litter Robot, and click on its Controls panel, I have a “Start” and “Stop” button. And pressing the Stop button will in fact turn off the Litter Robot while it is idle.

How can I send that Stop signal in this script, or otherwise achieve my goal?

Thanks in advance for any help!

You’re on the right track. The missing piece is that the device actions for the vacuum domain only expose clean and dock, but the Litter-Robot doesn’t support “return to base/dock.” The “Stop” you see on the device page is the vacuum.stop service, which you can call directly in a script (not via a “device” action).

Try this script. It uses service calls instead of device actions, waits for the cleaning to finish, resets the unit, then powers the unit off with vacuum.stop.

alias: LR4 – Cycle then Power Off
mode: single
sequence:
  # 1) Start a cleaning cycle
  - service: vacuum.start
    target:
      entity_id: vacuum.missy_s_magic_box_litter_box
    # If your setup doesn’t support vacuum.start, swap to:
    # service: vacuum.turn_on

  # 2) Wait until it's no longer cleaning (max 15 minutes as a safety)
  - wait_template: "{{ not is_state('vacuum.missy_s_magic_box_litter_box', 'cleaning') }}"
    timeout: "00:15:00"
    continue_on_timeout: true

  # 3) Optional: press the Reset button (adjust entity_id to your reset button)
  - service: button.press
    target:
      entity_id: button.missy_s_magic_box_reset_gauge

  # 4) Small settle delay
  - delay: "00:00:10"

  # 5) Power the LR4 off (this is the "Stop" you see in the UI)
  - service: vacuum.stop
    target:
      entity_id: vacuum.missy_s_magic_box_litter_box