Xiaomi Vacuum and Purifier push notifications

Hello,

I would like to have iOS push notifications when my vacuum starts and stops or having error, and also when my purifier having error (malfunction alert).

Could you help me with some sort of sample code please?

Vacuum: Roborock S50 with MQTT and MIIO enabled, rooted on 1886 fw, valetudo 0.4.0
Purifier: Xiaomi Air Purifier 2S
Push notification service: notify.mobile_app_iphone

I don’t have one, but looking at the docs, I think this might help you get started.

https://developers.home-assistant.io/docs/en/entity_vacuum.html

These could easily be combined into a single automation if you wanted. Leaving them as separate for more examples so you can pick what you want to do.

# Trigger when the vaccuum enters the 'cleaning' state.
- alias: Vacuum Clean
  trigger:
    platform: state
    entity_id: vacuum.xiaomi_vacuum_cleaner
    to: 'cleaning'
  action:
    service: notify.mobile_app_iphone
    data_template:
      title: "Vacuum Started Cleaning"
      message: "Started at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

- alias: Vacuum Stop
  trigger:
    platform: state
    entity_id: vacuum.xiaomi_vacuum_cleaner
    to: 'returning'
  action:
    service: notify.mobile_app_iphone
    data_template:
      title: "Vacuum Stopped Cleaning"
      message: "Started at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

- alias: Vacuum ERROR
  trigger:
    platform: state
    entity_id: vacuum.xiaomi_vacuum_cleaner
    to: 'error'
  action:
    service: notify.mobile_app_iphone
    data_template:
      title: "Vacuum Error"
      message: "Error Reported at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

Thank you! :slight_smile:

I know this thread is a little old, but I didn’t want to create a new one.

Has anyone worked out how to pull the actual error reported from the Xiaomi/roborock vacs to put in the notification?

I’d like to not have to rely on the Mi Home app for error notifications.

Thanks.

1 Like

I’d really like to know that myself. I only want the robots to send me messages when there is an error and not bother me when everything is all good. The Xiaomi app sends all messages, but HA can fix that - if it can report the actual error.

Would be interested in retrieving the actual error message as well.