Add Dreame Vacuum Notifications blueprint

Sends customizable notifications for Dreame vacuum events (cleaning
status, consumable alerts, warnings, errors, and informational messages).
Requires the Dreame Vacuum integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 21:27:51 +03:00
parent 6848c3f903
commit 9383f957b6
2 changed files with 513 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
# Dreame Vacuum Notifications
Sends customizable notifications for Dreame vacuum events. Requires the [Dreame Vacuum](https://github.com/Tasshack/dreame-vacuum) integration.
## Features
- Notifications for cleaning started and completed
- Consumable end-of-life alerts (brush, filter, mop pad, sensor, etc.)
- Device warning and error notifications
- Informational alerts (e.g., action blocked by Do Not Disturb)
- Individual toggle for each event type
- Customizable message templates with variable substitution
- Multiple notification targets
## How It Works
The blueprint listens to events fired by the Dreame Vacuum integration:
| Event | Description |
| --- | --- |
| `dreame_vacuum_task_status` | Cleaning job started or completed |
| `dreame_vacuum_consumable` | Consumable reached end-of-life |
| `dreame_vacuum_warning` | Dismissible device warning |
| `dreame_vacuum_error` | Device fault |
| `dreame_vacuum_information` | Action blocked by user settings |
Events are filtered by the configured vacuum entity, so only the selected vacuum triggers notifications.
## Configuration
| Input | Description |
| --- | --- |
| **Vacuum Entity** | The Dreame vacuum entity to monitor |
| **Notification Targets** | One or more `notify` entities |
| **Event Toggles** | Enable/disable each event type independently |
| **Message Templates** | Customizable message for each event type |
## Message Template Variables
### Cleaning Started
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{cleaning_mode}` | Cleaning mode (e.g., sweeping, mopping) |
| `{status}` | Current status |
### Cleaning Completed
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{cleaning_mode}` | Cleaning mode used |
| `{status}` | Final status |
| `{cleaned_area}` | Area cleaned (m²) |
| `{cleaning_time}` | Cleaning duration (minutes) |
### Consumable Depleted
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{consumable}` | Consumable name (e.g., Main Brush, Side Brush, Filter, Mop Pad) |
### Warning
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{warning}` | Warning description |
| `{code}` | Warning code |
### Error
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{error}` | Error description |
| `{code}` | Error code |
### Information
| Variable | Description |
| --- | --- |
| `{vacuum_name}` | Friendly name of the vacuum |
| `{information}` | Information message (e.g., Dust Collection, Cleaning Paused) |
## Debug Mode
Enable **Debug Notifications** in the Debug section to send persistent notifications with raw event data for troubleshooting.
## Author
Alexei Dolgolyov (<dolgolyov.alexei@gmail.com>)

View File

@@ -0,0 +1,419 @@
# Dreame Vacuum Notifications
# Sends notifications for Dreame vacuum events (cleaning, errors, consumables).
# See README.md for detailed documentation.
#
# Author: Alexei Dolgolyov (dolgolyov.alexei@gmail.com)
blueprint:
name: "Custom: Dreame Vacuum Notifications"
description: >
Sends customizable notifications for Dreame vacuum events including
cleaning status, consumable alerts, warnings, and errors.
Requires the Dreame Vacuum integration (github.com/Tasshack/dreame-vacuum).
domain: automation
# ===========================================================================
# INPUT CONFIGURATION
# ===========================================================================
input:
# -------------------------------------------------------------------------
# Vacuum Configuration
# -------------------------------------------------------------------------
vacuum_group:
name: "Vacuum"
collapsed: false
input:
vacuum_entity:
name: Vacuum Entity
description: "The Dreame vacuum entity to monitor."
selector:
entity:
integration: dreame_vacuum
domain: vacuum
# -------------------------------------------------------------------------
# Notification Configuration
# -------------------------------------------------------------------------
notification_group:
name: "Notification"
collapsed: false
input:
notify_targets:
name: Notification Targets
description: "Notification service entities to send messages to (select one or more)."
selector:
entity:
domain: notify
multiple: true
# -------------------------------------------------------------------------
# Event Toggles
# -------------------------------------------------------------------------
toggles_group:
name: "Event Toggles"
collapsed: false
input:
enable_cleaning_started:
name: Cleaning Started
description: "Send notification when the vacuum starts cleaning."
default: true
selector:
boolean:
enable_cleaning_completed:
name: Cleaning Completed
description: "Send notification when the vacuum finishes cleaning."
default: true
selector:
boolean:
enable_consumable:
name: Consumable Depleted
description: "Send notification when a consumable reaches end-of-life."
default: true
selector:
boolean:
enable_warning:
name: Warning
description: "Send notification for device warnings."
default: true
selector:
boolean:
enable_error:
name: Error
description: "Send notification for device errors."
default: true
selector:
boolean:
enable_information:
name: Information
description: "Send notification for informational alerts (e.g., blocked by DND)."
default: true
selector:
boolean:
# -------------------------------------------------------------------------
# Message Templates
# -------------------------------------------------------------------------
messages_group:
name: "Message Templates"
collapsed: true
input:
message_cleaning_started:
name: "Cleaning Started Message"
description: >
Message sent when the vacuum starts cleaning.
Variables: `{vacuum_name}`, `{cleaning_mode}`, `{status}`
default: "🧹 {vacuum_name} started cleaning ({cleaning_mode})."
selector:
text:
multiline: true
message_cleaning_completed:
name: "Cleaning Completed Message"
description: >
Message sent when the vacuum finishes cleaning.
Variables: `{vacuum_name}`, `{cleaning_mode}`, `{status}`,
`{cleaned_area}`, `{cleaning_time}`
default: "✅ {vacuum_name} finished cleaning. Area: {cleaned_area} m², time: {cleaning_time} min."
selector:
text:
multiline: true
message_consumable:
name: "Consumable Depleted Message"
description: >
Message sent when a consumable reaches end-of-life.
Variables: `{vacuum_name}`, `{consumable}`
default: "🔧 {vacuum_name}: {consumable} needs replacement."
selector:
text:
multiline: true
message_warning:
name: "Warning Message"
description: >
Message sent for device warnings.
Variables: `{vacuum_name}`, `{warning}`, `{code}`
default: "⚠️ {vacuum_name} warning: {warning} (code: {code})."
selector:
text:
multiline: true
message_error:
name: "Error Message"
description: >
Message sent for device errors.
Variables: `{vacuum_name}`, `{error}`, `{code}`
default: "❌ {vacuum_name} error: {error} (code: {code})."
selector:
text:
multiline: true
message_information:
name: "Information Message"
description: >
Message sent for informational alerts.
Variables: `{vacuum_name}`, `{information}`
default: " {vacuum_name}: {information}."
selector:
text:
multiline: true
# -------------------------------------------------------------------------
# Debug
# -------------------------------------------------------------------------
debug:
name: "Debug"
collapsed: true
input:
enable_debug_notifications:
name: Enable Debug Notifications
description: >
Send persistent notifications for debugging automation behavior.
Shows raw event data and filtering decisions.
default: false
selector:
boolean:
# Queued mode to avoid dropping rapid events
mode: queued
max: 5
# =============================================================================
# TRIGGERS
# =============================================================================
trigger:
# Cleaning job started or completed
- platform: event
event_type: dreame_vacuum_task_status
id: "task_status"
# Consumable reached end-of-life
- platform: event
event_type: dreame_vacuum_consumable
id: "consumable"
# Informational alert (job blocked by user settings)
- platform: event
event_type: dreame_vacuum_information
id: "information"
# Dismissible device warning
- platform: event
event_type: dreame_vacuum_warning
id: "warning"
# Device fault
- platform: event
event_type: dreame_vacuum_error
id: "error"
# =============================================================================
# VARIABLES
# =============================================================================
variables:
# ---------------------------------------------------------------------------
# Input References
# ---------------------------------------------------------------------------
vacuum_entity: !input vacuum_entity
notify_targets: !input notify_targets
enable_debug_notifications: !input enable_debug_notifications
# Event toggles
enable_cleaning_started: !input enable_cleaning_started
enable_cleaning_completed: !input enable_cleaning_completed
enable_consumable: !input enable_consumable
enable_warning: !input enable_warning
enable_error: !input enable_error
enable_information: !input enable_information
# Message templates
message_cleaning_started_template: !input message_cleaning_started
message_cleaning_completed_template: !input message_cleaning_completed
message_consumable_template: !input message_consumable
message_warning_template: !input message_warning
message_error_template: !input message_error
message_information_template: !input message_information
# ---------------------------------------------------------------------------
# Vacuum Info
# ---------------------------------------------------------------------------
vacuum_name: "{{ state_attr(vacuum_entity, 'friendly_name') | default(vacuum_entity) }}"
# ---------------------------------------------------------------------------
# Event Data (flat structure — fields are directly on trigger.event.data)
# ---------------------------------------------------------------------------
event_entity_id: "{{ trigger.event.data.entity_id | default('') }}"
# Task status fields
task_cleaning_mode: "{{ trigger.event.data.cleaning_mode | default('unknown') }}"
task_status_value: "{{ trigger.event.data.status | default('unknown') }}"
task_completed: "{{ trigger.event.data.completed | default(false) }}"
task_cleaned_area: "{{ trigger.event.data.cleaned_area | default(0) }}"
task_cleaning_time: "{{ trigger.event.data.cleaning_time | default(0) }}"
# Consumable fields
consumable_name: "{{ (trigger.event.data.consumable | default('unknown')) | replace('_', ' ') | title }}"
# Warning fields
warning_description: "{{ trigger.event.data.warning | default('unknown') }}"
warning_code: "{{ trigger.event.data.code | default('') }}"
# Error fields
error_description: "{{ trigger.event.data.error | default('unknown') }}"
error_code: "{{ trigger.event.data.code | default('') }}"
# Information fields
information_description: "{{ (trigger.event.data.information | default('unknown')) | replace('_', ' ') | title }}"
# =============================================================================
# CONDITIONS
# =============================================================================
condition:
# Only process events from the configured vacuum entity
- condition: template
value_template: "{{ event_entity_id == vacuum_entity }}"
# =============================================================================
# ACTIONS
# =============================================================================
action:
# ---------------------------------------------------------------------------
# Debug Logging
# ---------------------------------------------------------------------------
- choose:
- conditions:
- condition: template
value_template: "{{ enable_debug_notifications }}"
sequence:
- service: persistent_notification.create
data:
title: "Dreame Vacuum Debug"
message: >
**Trigger:** {{ trigger.id }}
**Entity:** {{ event_entity_id }}
**Vacuum:** {{ vacuum_name }}
**Event Data:** {{ trigger.event.data }}
# ---------------------------------------------------------------------------
# Send Notification Based on Event Type
# ---------------------------------------------------------------------------
- choose:
# CASE 1: Cleaning Started
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'task_status'
and not task_completed
and enable_cleaning_started }}
sequence:
- variables:
message: >
{% set tpl = message_cleaning_started_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{cleaning_mode}', task_cleaning_mode)
| replace('{status}', task_status_value) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"
# CASE 2: Cleaning Completed
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'task_status'
and task_completed
and enable_cleaning_completed }}
sequence:
- variables:
message: >
{% set tpl = message_cleaning_completed_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{cleaning_mode}', task_cleaning_mode)
| replace('{status}', task_status_value)
| replace('{cleaned_area}', task_cleaned_area | string)
| replace('{cleaning_time}', task_cleaning_time | string) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"
# CASE 3: Consumable Depleted
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'consumable' and enable_consumable }}
sequence:
- variables:
message: >
{% set tpl = message_consumable_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{consumable}', consumable_name) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"
# CASE 4: Warning
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'warning' and enable_warning }}
sequence:
- variables:
message: >
{% set tpl = message_warning_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{warning}', warning_description)
| replace('{code}', warning_code | string) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"
# CASE 5: Error
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'error' and enable_error }}
sequence:
- variables:
message: >
{% set tpl = message_error_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{error}', error_description)
| replace('{code}', error_code | string) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"
# CASE 6: Information
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'information' and enable_information }}
sequence:
- variables:
message: >
{% set tpl = message_information_template %}
{{ tpl | replace('{vacuum_name}', vacuum_name)
| replace('{information}', information_description) }}
- service: notify.send_message
target:
entity_id: "{{ notify_targets }}"
data:
message: "{{ message }}"