Roborock maintenance reminder

Automate reminders to maintenance parts of your vacuum that are not automatically tracked by the app (for instance the bin bag and dust filter). Will use the total m2 cleaned as an indicator.

Requires that you create an input_number helper to keep track how much m2 is left before maintenance is required.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Reminder to maintenance or replace a part of the vacuum
  description: 'Sends a notification with a reminder to maintenance or replace a part based on m2 cleaned, allowing for snoozing and only notifying if a binary sensor is on (for instance tracking if anyone is home)'
  domain: automation
  input:
    vacuum:
      name: vacuum finished cleaning sensor
      description: "Sensor tracking if cleaning was finished. For me the only reliable one was the 'total clean count', others would change because of intermediate docking."
      selector:
        entity:
    area_left:
      name: Area left sensor
      description: "This entity will hold the m2 left that can be cleaned before the part needs to be serviced or replaced. It needs to be an input_number helper entity with m² as the unit. Must be unique per use of blueprint"
      selector:
        entity:
          domain: input_number
    area_sensor:
      name: Last area cleaned sensor
      description: "sensor showing the total area cleaned during the last cleaning. Will be used to reduce the m² left on the area left sensor."
      selector:
        entity:
          domain: sensor
    home:
      name: home
      description: Binary sensor or person checking if the action can be completed i.e. that someone is at home
      selector:
        entity:
          domain: 
            - person
            - binary_sensor
    reminder_time_start:
      name: Reminder time start
      description: "Earliest time when the reminder should be sent."
      default: '10:00'
      selector:
        time:
    reminder_time_end:
      name: Reminder time end
      description: "Latest time when the reminder should be sent, is used in conjunction with the available sensor, so will trigger if in this time window and coming home from instance"
      default: '18:00'
      selector:
        time:
    interval_area:
      name: maintenance interval in m²
      description: "The interval between the maintenance sessions"
      default: 300
      selector:
        number:
          min: 0
          max: 10000
          mode: box
          unit_of_measurement: m²
    snooze_area:
      name: area added on snooze
      description: "m² to add to the area left when snoozing the message"
      default: 50
      selector:
        number:
          min: 0
          max: 10000
          mode: box
          unit_of_measurement: m²
    notification_title:
      name: Title of the notification
      description: "Title of the notification that will be sent."
      default: "Vacuum requires maintenance"
      selector:
        text:
    notification_message:
      name: Message of the notification
      description: "Message of the notification that will be sent."
      default: "The roborock filter needs to be cleaned"
      selector:
        text:
    notify_device:
      name: Notify device
      description: "The device where the notification should be sent to."
      selector:
        device:
trigger_variables:
  area_left_entity_id:   !input area_left
  area_sensor_entity_id: !input area_sensor
  interval_area: !input interval_area
  snooze_area: !input snooze_area
  action_name_snooze: >-
    {{ "snooze_maintenance_" ~ area_left_entity_id }}
  action_name_performed: >-
    {{ "performed_maintenance_" ~ area_left_entity_id }}

trigger:
  - platform: time
    at: !input reminder_time_start
    id: send_message

  - platform: state
    entity_id: !input home
    to: 
      - "on"
      - "home"
    id: send_message

  - platform: numeric_state
    entity_id: !input area_left
    below: 0
    id: send_message

  - platform: state
    entity_id: !input vacuum
    id: cleaning_performed

  - platform: event
    event_type: mobile_app_notification_action
    id: snooze
    event_data:
      action: "{{ action_name_snooze }}"

  - platform: event
    event_type: mobile_app_notification_action
    id: performed
    event_data:
      action: "{{ action_name_performed }}"

condition:
  - condition: or
    conditions:
      - condition: and
        conditions:
          - condition: trigger
            id: 
              - send_message
          - condition: time
            after: !input reminder_time_start
            before: !input reminder_time_end
          - condition: template
            value_template: |
              {{ states(area_left_entity_id)|float <= 0 }}
      - condition: trigger
        id: 
          - snooze
          - cleaning_performed
          - performed

action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - cleaning_performed
        sequence:
          - service: input_number.set_value
            data:
              value: |
                {{ states(area_left_entity_id)|float - states(area_sensor_entity_id)|float(0) }}
            target:
              entity_id: !input area_left
      - conditions:
          - condition: trigger
            id:
              - performed
        sequence:
          - service: input_number.set_value
            data:
              value: !input interval_area
            target:
              entity_id: !input area_left
      - conditions:
          - condition: trigger
            id:
              - snooze
        sequence:
          - service: input_number.set_value
            data:
              value: |
                {{ states(area_left)|float + snooze_area }}
            target:
              entity_id: !input area_left
      - conditions:
        - condition: trigger
          id: send_message
        sequence:
        - domain: mobile_app
          type: notify
          device_id: !input notify_device
          title:   !input notification_title
          message: !input notification_message
          data:
            actions:
            - title: Done
              action: "{{ action_name_performed }}"
            - title: Snooze
              action: "{{ action_name_snooze }}"
3 Likes

It contained a pretty obvious error in hindsight which I somehow missed. The new version should fix it.

[edit] and another bug found, I really should have tested this a bit longer before I released it… :grimacing: