Skip to content

Add object_id to modern template syntax as default_entity_id #40409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/_integrations/template.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ Each entity platform has its own set of configuration options, but there are som
template:
- binary_sensor:
# Common configuration options
- unique_id: my_unique_sensor_id
- default_entity_id: binary_sensor.my_alert
unique_id: my_unique_sensor_id
variables:
my_entity: sensor.watts
availability: "{{ my_entity | has_value }}"
Expand All @@ -199,6 +200,10 @@ template:
required: false
type: template
default: true
default_entity_id:
description: Use `default_entity_id` instead of name for automatic generation of the entity id. E.g. `sensor.my_awesome_sensor`. When used without a `unique_id`, the entity id will update during restart or reload if the entity id is available. If the entity id already exists, the entity id will be created with a number at the end. When used with a `unique_id`, the `default_entity_id` is only used when the entity is added for the first time. When set, this overrides a user-customized Entity ID in case the entity was deleted and added again.
required: false
type: string
icon:
description: Defines a template for the icon of the entity.
required: false
Expand All @@ -212,7 +217,7 @@ template:
required: false
type: template
unique_id:
description: An ID that uniquely identifies this entity. Will be combined with the unique ID of the configuration block if available. This allows changing the `name`, `icon` and `entity_id` from the web interface.
description: An ID that uniquely identifies this entity. Will be combined with the unique ID of the configuration block if available. This allows changing the `name`, `icon` and `entity_id` from the web interface. Changing the `entity_id` from the web interface will overwrite the value in `default_entity_id`.
required: false
type: string
variables:
Expand Down