mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 05:16:49 +00:00
Add attribute templates to template vacuum (#13733)
Co-authored-by: Klaas Schoute <klaas_schoute@hotmail.com>
This commit is contained in:
parent
4ea8f695ba
commit
1511c94bb9
@ -51,6 +51,15 @@ vacuum:
|
|||||||
description: Defines a template to get the fan speed of the vacuum.
|
description: Defines a template to get the fan speed of the vacuum.
|
||||||
required: false
|
required: false
|
||||||
type: template
|
type: template
|
||||||
|
attribute_templates:
|
||||||
|
description: Defines templates for attributes of the sensor.
|
||||||
|
required: false
|
||||||
|
type: map
|
||||||
|
keys:
|
||||||
|
"attribute: template":
|
||||||
|
description: The attribute and corresponding template.
|
||||||
|
required: true
|
||||||
|
type: template
|
||||||
availability_template:
|
availability_template:
|
||||||
description: Defines a template to get the `available` state of the component. If the template returns `true`, the device is `available`. If the template returns any other value, the device will be `unavailable`. If `availability_template` is not configured, the component will always be `available`.
|
description: Defines a template to get the `available` state of the component. If the template returns `true`, the device is `available`. If the template returns any other value, the device will be `unavailable`. If `availability_template` is not configured, the component will always be `available`.
|
||||||
required: false
|
required: false
|
||||||
@ -158,3 +167,28 @@ vacuum:
|
|||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
|
### Add Custom Attributes
|
||||||
|
|
||||||
|
This example shows how to add custom attributes.
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
```yaml
|
||||||
|
vacuum:
|
||||||
|
- platform: template
|
||||||
|
vacuums:
|
||||||
|
living_room_vacuum:
|
||||||
|
value_template: "{{ states('sensor.vacuum_state') }}"
|
||||||
|
battery_level_template: "{{ states('sensor.vacuum_battery_level')|int }}"
|
||||||
|
fan_speed_template: "{{ states('sensor.vacuum_fan_speed') }}"
|
||||||
|
attribute_templates:
|
||||||
|
status: >-
|
||||||
|
{% if (states('sensor.robot_vacuum_robot_cleaner_movement') == "after" and states('sensor.robot_vacuum_robot_cleaner_cleaning_mode') == "stop") %}
|
||||||
|
Charging to Resume
|
||||||
|
{% elif states('sensor.robot_vacuum_robot_cleaner_cleaning_mode') == "auto" %}
|
||||||
|
Cleaning
|
||||||
|
{% else %}
|
||||||
|
Charging
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user