Just started using HA and I am confused by this section of the “Template” integration documentation which states:
The unique ID for this config block. This will be prefixed to all unique IDs of all entities in this block.
Further in the documentation is also this section:
unique_id string (optional)
An ID that uniquely identifies this entity. Will be combined with the unique ID of the configuration block if available. This allows changing thename
,icon
andentity_id
from the web interface.
There is no example in the docs showing the usage of this “config-block” level unique_id.
Is someone able to provide a working example of their configuration.yaml that utilizes this option?
Most of my attempts to add this config-block-level unique_id causes HA to throw .yaml config errors. The following configuration.yaml is accepted by HA; but HA is not prefixing the unique_id:
(I’ll get to how I’m able to confirm the unique_ids later)
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text-to-speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
logger:
default: info
logs:
custom_components.hacs: debug
aiogithubapi: debug
## customizations ##
#enable python scripts
python_script:
template: !include_dir_merge_list customizations/templates/
sensor: !include_dir_merge_list customizations/sensors_legacy/
customization/templates/valetudo.yaml:
# for custom valetudo controls
- unique_id: "ignored_prefix_"
- sensor:
- name: "selected_segments"
unique_id: valetudo_sel_seg
state: "uninitialized"
- sensor:
- name: "remaining_segments"
unique_id: valetudo_rem_seg
state: "uninitialized"
- binary_sensor:
- name: "vacuum_is_lost"
unique_id: valetudo_is_lost
state: "off"
Per the documentation, my understanding is that sensor.selected_segments should have the full unique_id of: ignored_prefix_valetudo_sel_seg, however, no amount of reloading/deleting/re-adding .yaml files and restarting HA seems to create the proper unique_id.
Any help from the community is, as always, greatly appreciated.