Template vacuum
The template
platform creates vacuums that combine integrations and provides the
ability to run scripts or invoke actions for each of the start, pause, stop,
return_to_base, clean_spot, locate and set_fan_speed commands of a vacuum.
To enable Template Vacuums in your installation, add the following to your
configuration.yaml
file:
Configuration Variables
List of your vacuums.
An ID that uniquely identifies this vacuum. Set this to a unique value to allow customization through the UI.
Defines a template to get the state of the vacuum. Valid value: docked
/cleaning
/idle
/paused
/returning
/error
Defines a template to get the battery level of the vacuum. Legal values are numbers between 0
and 100
.
Defines a template to get the fan speed of the vacuum.
Defines templates for attributes of the sensor.
The attribute and corresponding template.
Defines a template to get the available
state of the entity. If the template either fails to render or returns True
, "1"
, "true"
, "yes"
, "on"
, "enable"
, or a non-zero number, the entity will be available
. If the template returns any other value, the entity will be unavailable
. If not configured, the entity will always be available
. Note that the string comparison not case sensitive; "TrUe"
and "yEs"
are allowed.
Defines an action to run when the vacuum is started.
Defines an action to run when the vacuum is paused.
Defines an action to run when the vacuum is stopped.
Defines an action to run when the vacuum is given a return to base command.
Defines an action to run when the vacuum is given a clean spot command.
Defines an action to run when the vacuum is given a locate command.
Defines an action to run when the vacuum is given a command to set the fan speed.
Template and action variables
State-based template entities have the special template variable this
available in their templates and actions. The this
variable aids self-referencing of an entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more]’s state and attribute in templates and actions.
Examples
Control vacuum with Harmony Hub
This example shows how you can use a Template Vacuum to control an IR vacuum cleaner using the Harmony Hub Remote integration.
Vacuum with state
This example shows how to use templates to specify the state of the vacuum.
Add custom attributes
This example shows how to add custom attributes.