Add unique ID to WLED config entries (#30480)

* Add unique ID to WLED config entries

* Improve robustness of the tests
This commit is contained in:
Franck Nijhof authored and Paulus Schoutsen committed 2020-01-04 22:48:31 +01:00
1 parent bf9418e51a
commit 51db9bdfce
4 files changed
+56 -40

No files matched your search

@@ -61,6 +61,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = {DATA_WLED_CLIENT: wled}
# For backwards compat, set unique ID
if entry.unique_id is None:
hass.config_entries.async_update_entry(
entry, unique_id=wled.device.info.mac_address
)
# Set up all platforms for this device/entry.
for component in WLED_COMPONENTS:
hass.async_create_task(