33import asyncio
44import logging
55from typing import Any , Awaitable , Callable , Type
6+
67from aiohttp import ClientConnectionError
7- from pyUnfoldedCircleRemote .const import AUTH_APIKEY_NAME , SIMULATOR_MAC_ADDRESS
8+ from pyUnfoldedCircleRemote .const import AUTH_APIKEY_NAME
89from pyUnfoldedCircleRemote .remote import (
910 ApiKeyCreateError ,
1011 ApiKeyRevokeError ,
1920from voluptuous import Optional , Required
2021
2122from homeassistant import config_entries
22- from homeassistant .helpers .service_info .zeroconf import ZeroconfServiceInfo
2323from homeassistant .config_entries import ConfigEntry , ConfigFlow
2424from homeassistant .const import CONF_HOST , CONF_MAC , CONF_NAME , CONF_PORT
2525from homeassistant .core import HomeAssistant , callback
2626from homeassistant .data_entry_flow import FlowResult
2727from homeassistant .exceptions import HomeAssistantError
2828from homeassistant .helpers .selector import EntitySelector , EntitySelectorConfig
29+ from homeassistant .helpers .service_info .zeroconf import ZeroconfServiceInfo
2930
3031from .const import (
3132 CONF_ACTIVITIES_AS_SWITCHES ,
4041)
4142from .helpers import (
4243 IntegrationNotFound ,
43- UnableToExtractMacAddress ,
44- UnableToDetermineUser ,
4544 InvalidWebsocketAddress ,
45+ UnableToDetermineUser ,
4646 connect_integration ,
4747 device_info_from_discovery_info ,
4848 get_ha_websocket_url ,
4949 get_registered_websocket_url ,
50- mac_address_from_discovery_info ,
50+ register_system_and_driver ,
5151 synchronize_dock_password ,
5252 validate_and_register_system_and_driver ,
53- register_system_and_driver ,
5453 validate_dock_password ,
5554 validate_websocket_address ,
5655)
@@ -169,17 +168,12 @@ async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo):
169168 host = discovery_info .ip_address .compressed
170169 port = discovery_info .port
171170 model = discovery_info .properties .get ("model" )
172- try :
173- mac_address = mac_address_from_discovery_info (discovery_info )
174- except UnableToExtractMacAddress :
175- if (
176- discovery_info .properties .get ("model" ) != "UCR2-simulator"
177- and discovery_info .properties .get ("model" ) != "UCR3-simulator"
178- ):
179- return self .async_abort (reason = "no_mac" )
180- _LOGGER .debug ("Zeroconf from the Simulator %s" , discovery_info )
181- mac_address = SIMULATOR_MAC_ADDRESS .replace (":" , "" ).lower ()
182171
172+ (
173+ device_name ,
174+ configuration_url ,
175+ mac_address ,
176+ ) = await device_info_from_discovery_info (discovery_info )
183177 remote_name = Remote .name_from_model_id (model )
184178 self .discovery_info .update (
185179 {
@@ -195,10 +189,6 @@ async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo):
195189 if mac_address :
196190 await self ._async_set_unique_id_and_abort_if_already_configured (mac_address )
197191
198- device_name , configuration_url = await device_info_from_discovery_info (
199- discovery_info
200- )
201-
202192 self .context .update (
203193 {
204194 "title_placeholders" : {"name" : device_name },
0 commit comments