dreame-vacuum Home Assistant Integration

repository·master·Indexed 24 days ago

https://github.com/tasshack/dreame-vacuum

A Home Assistant integration providing a complete app replacement for Dreame robot vacuums. It supports live maps, multi-floor support, and customized room cleaning. The integration exposes reverse-engineered settings and states via switch, sensor, number, and button entities, including maintenance tracking and AI-driven obstacle detection features.

Tokens
11.4K
Snippets
20
Records
47
Agent score
85%

What's inside dreame-vacuum

  1. Understand P-type (Partial) Map Decoding

    master

    Second-generation robots and newer devices use P-type (Partial) maps. Unlike standard I-type maps, P-type maps only contain the differences from the previous frame.

    This integration supports P-type decoding to provide a three-second refresh rate with a three-second delay, matching the performance of the official App. Note that Valetudo does not parse P-frames and instead requests new map refreshes.

  2. Understand Dreame Vacuum entity behavior and naming

    master

    The integration exposes settings and states reverse-engineered from the official App.

    Key Behaviors:

    • Dynamic Exposure: Entities are only added to Home Assistant if the specific device supports that property. Some entities (like customized_cleaning or cleaning_mode) may require specific firmware versions or are unavailable on Valetudo.
    • Naming Schema: Generated entities follow the pattern: [domain].[vacuum name]_[entity name].
    • Data Updates: The integration uses a local_push approach via listeners. It informs Home Assistant only when a property changes. Note that changes made in the official App may take some time to reflect in Home Assistant.
    • Automation Helpers: Most sensor and select entities return their current raw integer values on raw_value, map_id, or segment_id attributes to simplify automations.
    • Availability Rules: Some entities have custom availability logic. For example, the tight_mopping entity becomes unavailable if the water tank or mop pad is not attached.
    • Cloud-Connected Entities: Settings stored in map data rather than on the device (e.g., map_rotation) are exposed as cloud-connected entities.
  3. Understand Dreame vacuum notification types

    master

    The integration provides several types of notifications based on device state. While strings are extracted from the Z10 Pro official app, they are generally applicable to other supported devices:

    • Cleanup completed: Triggered when a cleaning job is finished or manually canceled.
    • Consumable is depleted: Triggered when the lifespan of a consumable (e.g., brush, sensor) has ended.
    • Error reporting: Triggered by device faults or warnings (e.g., dropped sensor, blocked component).
      • Note: Warnings can often be cleared from the device by dismissing the notification in Home Assistant.
    • Cleaning paused due to low battery: Triggered when the 'resume cleaning' feature is active but the battery is too low to continue the current job.
    • New map must be replaced: Triggered after mapping is complete if the device cannot store the new map. In this state, the official app typically prevents making changes.
    • Dust collection not performed: Triggered when auto-emptying is skipped due to 'Do Not Disturb' settings.
  4. Handle Fast Mapping and Spot Cleaning Maps

    master

    When the robot is performing fast mapping or spot cleaning, it creates a new map in its local memory. During this state:

    • The robot does not respond to local map_request API actions.
    • The newly created map does not have an object name yet and can only be accessed via the cloud map_data property.
    • These maps require specific decoding and rendering rules different from standard maps.
  5. Understand Room Entities for Customized Cleaning

    master

    The integration manages room entities for customized cleaning settings, which are available on firmware version 1156 or later.

    Key Behaviors:

    • Customized Cleaning Mode: If enabled, the robot uses these specific room settings for both cleaning and custom segment cleaning jobs. These settings cannot be overridden by start action parameters.
    • Dynamic Entity Updates: Room settings are stored on the current map data. Because only selected map settings are accessible via the cloud API, the integration dynamically updates room entity names and icons whenever the selected map is changed.
    • Map Availability: The integration exposes rooms from all saved maps, but updates their availability state based on the currently selected map.
  6. Manage Multi-floor Maps and Map Entities

    master

    The integration supports up to three saved maps with auto-generated camera and select entities for multi-floor management.

    Map ID Behavior: Saved maps use the format [original map id][version] (e.g., 46). Because map IDs change constantly, they cannot be used directly in entity IDs. Instead, the integration uses an indexing system for map camera entities:

    • Map indexes are created from the ordered saved map list.
    • If a map (e.g., map_2) is removed, subsequent maps shift up (e.g., map_3 becomes map_2), mirroring the official App behavior.
    • If Multi-floor map support is disabled while multiple maps exist, map_1 is always selected as the default.

    Entities:

    • Map Entities: Automatically generated for saved and live maps to support editing and automations.
    • Dynamic Room Entities: Automatically generated for the currently selected map to allow for room and customized cleaning settings.
  7. Use Valetudo Map Card Support

    master

    The integration provides reverse-engineered support for Valetudo map data generation.

    Note on behavior: The Valetudo map card uses its own color index algorithm, does not render room icons or names, and ignores the map rotation setting from the map data. However, it allows for faster image generation because rendering occurs in the browser.

  8. Manage Dreame vacuum notifications

    master

    The integration tracks specific device properties and generates persistent notifications in Home Assistant, mimicking the behavior of the official Dreame app.

    Note: You can enable or disable this notification feature within the integration settings in Home Assistant.

  9. Configure the Rooms Card in Home Assistant

    master

    You can manage all room settings (names, icons, suction, water/mop settings) using a single consolidated card. This requires two custom Home Assistant Lovelace cards:

    1. config-template-card
    2. multiple-entity-row

    To use the provided template, you must update the vacuum_entity variable with your specific vacuum's entity ID (e.g., vacuum.dreame_l10s_ultra).

    {# ----------------- PROVIDE YOUR OWN ENTITY ID AND ROOM COUNT HERE ----------------- #}
    {% set vacuum_entity = "vacuum." %} 
    {# ... rest of the template ... #}
  10. Install the Dreame vacuum integration

    master

    You can install the Dreame vacuum integration for Home Assistant using two methods:

    Search for dreame-vacuum in the Home Assistant Community Store (HACS).

    Manually

    Run the following command in your terminal to download and install the integration:

    wget -O - https://raw.githubusercontent.com/Tasshack/dreame-vacuum/master/install | bash -
  11. Configure the Dreame Vacuum integration

    master

    To set up the Dreame Vacuum integration in Home Assistant, follow these steps:

    1. Navigate to Settings -> Devices & Services -> Add Integration.
    2. Search for and select Dreame Vacuum.
    3. Choose your preferred configuration type (e.g., Cloud or Local, depending on the UI options provided).
    4. Enter the required credentials for your selected configuration type.
    5. Set your device name and integration settings (such as notification preferences or map color schemes).

    Important: Ensure that your devices are on the same subnet for both configuration types to avoid connectivity issues.

  12. Configure Map Icon Sets and Hidden Objects

    master

    You can customize the map's visual density and style through the integration configuration options.

    Selectable Icon Sets:

    • Dreame: Official Dreame App icons.
    • Dreame Old: Icons from older VSLAM robot versions.
    • Mijia: Official Mijia App icons.
    • Material: Material Design icons.

    Hidden Map Objects (Configurable): You can disable specific elements to declutter the map, including:

    • Room details: Colors, Icons, Names, Order, Suction Level, Water Volume, Cleaning Times, and Cleaning Mode (device dependent).
    • Map elements: Path, No Go Zones, No Mop Zones, Virtual Walls, Active Areas, Active Points, Carpet Areas (not supported yet), and Cleaning Direction (not supported yet).
    • Icons: Charger Icon, Robot Icon, AI Obstacle, and Cleaning Direction.