Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions homeassistant/components/template/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from homeassistant.components import blueprint
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_ENTITY_PICTURE_TEMPLATE,
CONF_FRIENDLY_NAME,
CONF_ICON,
Expand Down Expand Up @@ -133,6 +134,9 @@ def rewrite_legacy_to_modern_config(
"""Rewrite legacy config."""
entity_cfg = {**entity_cfg}

# Remove deprecated entity_id field from legacy syntax
entity_cfg.pop(ATTR_ENTITY_ID, None)

for from_key, to_key in itertools.chain(
LEGACY_FIELDS.items(), extra_legacy_fields.items()
):
Expand Down
3 changes: 2 additions & 1 deletion tests/components/template/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,13 +832,14 @@ async def test_legacy_deprecation(
"sensors": {
"some_sensor": {
"friendly_name": "Sensor",
"entity_id": "sensor.some_sensor",
"device_class": "timestamp",
"value_template": "{{ now().isoformat() }}",
}
},
},
},
["device_class: timestamp"],
["device_class: timestamp", "entity_id: sensor.some_sensor"],
),
],
)
Expand Down
Loading