mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
![Marc Mueller](/assets/img/avatar_default.png)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
29 lines
1023 B
Python
29 lines
1023 B
Python
"""The waze_travel_time component."""
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.const import Platform
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.entity_registry import (
|
|
async_entries_for_config_entry,
|
|
async_get,
|
|
)
|
|
|
|
PLATFORMS = [Platform.SENSOR]
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Load the saved entities."""
|
|
if entry.unique_id is not None:
|
|
hass.config_entries.async_update_entry(entry, unique_id=None)
|
|
|
|
ent_reg = async_get(hass)
|
|
for entity in async_entries_for_config_entry(ent_reg, entry.entry_id):
|
|
ent_reg.async_update_entity(entity.entity_id, new_unique_id=entry.entry_id)
|
|
|
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
|
"""Unload a config entry."""
|
|
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|