Skip to content
Open
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
3 changes: 1 addition & 2 deletions custom_components/xiaomi_miio_airpurifier/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
model = config.get(CONF_MODEL)

_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
unique_id = None
unique_id = f"{host}-{token[:5]}"

if model is None:
miio_device = Device(host, token)
Expand All @@ -149,7 +149,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
raise PlatformNotReady

model = device_info.model
unique_id = "{}-{}".format(model, device_info.mac_address)
_LOGGER.info(
"%s %s %s detected",
model,
Expand Down
3 changes: 1 addition & 2 deletions custom_components/xiaomi_miio_airpurifier/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,14 +1107,13 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
retries = config[CONF_RETRIES]

_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
unique_id = None
unique_id = f"{host}-{token[:5]}"

if model is None:
try:
miio_device = Device(host, token)
device_info = await hass.async_add_executor_job(miio_device.info)
model = device_info.model
unique_id = f"{model}-{device_info.mac_address}"
_LOGGER.info(
"%s %s %s detected",
model,
Expand Down