Not seeing MQTT Vacuum error states in HA

I have a Xiaomi robot (Gen1) with Valetudo integrated with Home Assistant (0.101.3) using MQTT discovery.

Everything is working perfectly except one thing. When the vacuum has a problem and sends an error state I do not see this reflected in any way in Home Assistant as far as I can see.

I can see the error status is reported in MQTT:

{"battery_level":82,"docked":false,"cleaning":true,"charging":false,"fan_speed":"max","error":"Clean main brush"}

but the robot status in Home Assistant remains “on” and there is no indication of an error in attributes:

status: Cleaning
battery_level: 82
battery_icon: 'mdi:battery-80'
fan_speed: max
fan_speed_list:
  - min
  - medium
  - high
  - max
cleanTime: '354.4'
cleanArea: '18773.6'
cleanCount: 660
last_run_stats:
  startTime: 1575201583000
  endTime: 1575203734000
  duration: 61
  area: '1.0'
  errorCode: 0
  errorDescription: No error
  finishedFlag: false
mainBrush: '289.6'
sideBrush: '140.8'
filter: '131.9'
sensor: '19.6'
friendly_name: rockrobo
supported_features: 2045

Shouldn’t the error status be reflected somehow in the state of the vacuum sensor in HA or do I need to create a separate senor for that?

1 Like

Use mqtt explorer to look at the homeassistant/sensor/device_id topic. There should be a config=... message there.

If it does not contain a config message for an error sensor you need to raise an issue/feature request with the Valetudo developer.

Alternatively you could make your own sensor:

sensor:
  - platform: mqtt
    name: "Robovac Error"
    state_topic: ### you did not say what this was.
    value_template: "{{ value_json.error }}"
1 Like

Looking in MQTT Explorer I see the topic “homeassistant/vacuum/valetudo_rockrobo/config”. It contains this configuration which does have the error_topic and error_template settings:

{
  "name": "rockrobo",
  "supported_features": [
    "turn_on",
    "pause",
    "stop",
    "return_home",
    "battery",
    "status",
    "locate",
    "clean_spot",
    "fan_speed",
    "send_command"
  ],
  "command_topic": "valetudo/rockrobo/command",
  "battery_level_topic": "valetudo/rockrobo/state",
  "battery_level_template": "{{ value_json.battery_level }}",
  "charging_topic": "valetudo/rockrobo/state",
  "charging_template": "{{value_json.charging}}",
  "cleaning_topic": "valetudo/rockrobo/state",
  "cleaning_template": "{{value_json.cleaning}}",
  "docked_topic": "valetudo/rockrobo/state",
  "docked_template": "{{value_json.docked}}",
  "error_topic": "valetudo/rockrobo/state",
  "error_template": "{{value_json.error}}",
  "fan_speed_topic": "valetudo/rockrobo/state",
  "fan_speed_template": "{{ value_json.fan_speed }}",
  "set_fan_speed_topic": "valetudo/rockrobo/set_fan_speed",
  "fan_speed_list": [
    "min",
    "medium",
    "high",
    "max"
  ],
  "send_command_topic": "valetudo/rockrobo/custom_command",
  "json_attributes_topic": "valetudo/rockrobo/attributes"
}

As you suggested @tom_l I have created a separate mqtt sensor with this configuration which actually works.

sensor:
  - platform: mqtt
    name: "Robovac Error"
    state_topic: "valetudo/rockrobo/state"
    value_template: "{{ value_json.error }}"

Based on this it looks to me like the error_topic and error_template of the vacuum sensor above look correct. As it is I now have a workaround but can anyone else with a vacuum using valetudo confirm whether error states are picked up by the mqtt vacuum entity?

1 Like

I do not get error states from valetudo via MQTT, though I did with the xiaomi-via-valetudo integration, but I find the MQTT to be more responsive. Additionally, I have no way of turning the fan to “Whisper”.

Glad to have found the template for a sensor to get the error - I use the error in automations to get around the dreaded “Main Brush Blocked” errors.

@jhenkens How do you get around the “Main Brush Blocked” errors? Is there a way to clear it from HA? It is quite annoying!