#Vacuum robot - alternate vacuum-only and vacuum+mop routines

1 messages · Page 1 of 1 (latest)

granite gyro
#

I have a Roborock connected via the Roborock cloud integration to my HA server.
At the moment I have the following automation set up to start cleaning (and send me and my girlfriend a push notification) at most once a day, as soon as everyone leaves home:

# When everybody leaves home
triggers:
  - entity_id: zone.home
    to: "0"
    trigger: state
# If it's the first time this automation triggers today
conditions:
  - condition: template
    value_template: >-
      {{ this.attributes.last_triggered is none or
      this.attributes.last_triggered < today_at() }}
actions:
# Start default cleaning
  - device_id: <D_ID>
    domain: vacuum
    entity_id: <E_ID>
    type: clean
# Send push notifications
  - action: notify.mobile_app_1
    metadata: {}
    data:
      message: _ started cleaning
  - action: notify.mobile_app_2
    metadata: {}
    data:
      message: _ started cleaning
mode: single

and everything has been working great so far. I would like to enhance it by having the robot perform a vacuum+mop routine every other time (or even every third time) and vacuum-only otherwise.
I can think about one possible implementation creating 2 different automations that deactivate themselves after executing and activate the other one - but is there a smarter way to achieve the same result?
Also please review my automation and let me know if anything else can be improved 🙂

Thanks a lot!

indigo pivot
#

Could you if/else the actions on whether the day is even or odd?

granite gyro
#

Not really, the automation usually runs every other day, but it can also run two days in a row or with more than 1 day between two runs

granite gyro
#

I created the script attached in the script.yaml file.

I created the helper input_select.roborock_next_cleaning_mode with possible values: vacuum_only, vacuum_mop

My intention is the following:

if robot is not cleaning already:
  if next schedule cleaning mode is `vacuum_mop`
  and there is water in the tank
  and mop is attached:
    set fan_speed to smart_mode
    set mop_intensity to smart_mode
    set mop_mode to smart_mode
    start cleaning
    set next schedule cleaning mode to `vacuum_only`
    (send notification)
  else:
    set fan_speed to max
    set mop_intensity to off
    set mop_mode to standard
    start cleaning
    set next schedule cleaning mode to `vacuum_mop`
    (send notification)

The conditions seem to be processed correctly and the executed branch is the correct one each time, but the robot seems to be unable to change from the vacuum+mop settings to the vacuum-only settings.

Giving a look at the roborock command documentation, I found these commands:
•⁠ ⁠⁠ get_custom_mode ⁠: https://python-roborock.readthedocs.io/en/stable/api_commands.html#get-custom-mode
•⁠ ⁠⁠ set_custom_mode ⁠: https://python-roborock.readthedocs.io/en/stable/api_commands.html#set-custom-mode
But I haven’t been able to read the response of the first command via HA.

Any help is greatly appreciated! 🙂

granite gyro
#

I will leave the solution here in case someone else is attempting the same and running into the same issues that I faced.

Apparently there is a bug in either the Roborock HA Integration or the Roborock API that makes it necessary to run a specific set of steps in order to change from Smart Plan to any other cleaning routine.

The steps that allowed me to successfully modify the cleaning routine are the following:

  • Send a set_mop_mode command with parameter 302 (custom)
- action: vacuum.send_command
  data:
    command: set_mop_mode
    params: 302
  target:
    entity_id: vacuum.roborock
  • Set the fan speed to the desired one
- action: vacuum.set_fan_speed
  target:
    entity_id: vacuum.roborock
  data:
    fan_speed: max
  • Set mop intensity and mode to off and standard respectively
- action: select.select_option
  target:
    entity_id: select.roborock_mop_intensity
  data:
    option: "off"
- action: select.select_option
  target:
    entity_id: select.roborock_mop_mode
  data: