diff --git a/homeassistant/components/deconz/__init__.py b/homeassistant/components/deconz/__init__.py index aad03b6960d..140fbe12d82 100644 --- a/homeassistant/components/deconz/__init__.py +++ b/homeassistant/components/deconz/__init__.py @@ -19,8 +19,7 @@ from .config_flow import get_master_gateway from .const import CONF_GROUP_ID_BASE, CONF_MASTER_GATEWAY, DOMAIN, PLATFORMS from .deconz_event import async_setup_events, async_unload_events from .errors import AuthenticationRequired, CannotConnect -from .gateway import DeconzGateway -from .hub import get_deconz_api +from .hub import DeconzHub, get_deconz_api from .services import async_setup_services, async_unload_services @@ -47,7 +46,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b if not hass.data[DOMAIN]: async_setup_services(hass) - gateway = hass.data[DOMAIN][config_entry.entry_id] = DeconzGateway( + gateway = hass.data[DOMAIN][config_entry.entry_id] = DeconzHub( hass, config_entry, api ) await gateway.async_update_device_registry() @@ -68,7 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload deCONZ config entry.""" - gateway: DeconzGateway = hass.data[DOMAIN].pop(config_entry.entry_id) + gateway: DeconzHub = hass.data[DOMAIN].pop(config_entry.entry_id) async_unload_events(gateway) if not hass.data[DOMAIN]: diff --git a/homeassistant/components/deconz/alarm_control_panel.py b/homeassistant/components/deconz/alarm_control_panel.py index 862ecece40f..764bcecc17f 100644 --- a/homeassistant/components/deconz/alarm_control_panel.py +++ b/homeassistant/components/deconz/alarm_control_panel.py @@ -29,7 +29,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry DECONZ_TO_ALARM_STATE = { AncillaryControlPanel.ARMED_AWAY: STATE_ALARM_ARMED_AWAY, @@ -45,9 +45,7 @@ DECONZ_TO_ALARM_STATE = { } -def get_alarm_system_id_for_unique_id( - gateway: DeconzGateway, unique_id: str -) -> str | None: +def get_alarm_system_id_for_unique_id(gateway: DeconzHub, unique_id: str) -> str | None: """Retrieve alarm system ID the unique ID is registered to.""" for alarm_system in gateway.api.alarm_systems.values(): if unique_id in alarm_system.devices: @@ -97,7 +95,7 @@ class DeconzAlarmControlPanel(DeconzDevice[AncillaryControl], AlarmControlPanelE def __init__( self, device: AncillaryControl, - gateway: DeconzGateway, + gateway: DeconzHub, alarm_system_id: str, ) -> None: """Set up alarm control panel device.""" diff --git a/homeassistant/components/deconz/binary_sensor.py b/homeassistant/components/deconz/binary_sensor.py index 5dd56a4c5b1..754e5ab427f 100644 --- a/homeassistant/components/deconz/binary_sensor.py +++ b/homeassistant/components/deconz/binary_sensor.py @@ -32,7 +32,7 @@ import homeassistant.helpers.entity_registry as er from .const import ATTR_DARK, ATTR_ON, DOMAIN as DECONZ_DOMAIN from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry from .util import serial_from_unique_id _SensorDeviceT = TypeVar("_SensorDeviceT", bound=PydeconzSensorBase) @@ -225,7 +225,7 @@ class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity): def __init__( self, device: SensorResources, - gateway: DeconzGateway, + gateway: DeconzHub, description: DeconzBinarySensorDescription, ) -> None: """Initialize deCONZ binary sensor.""" diff --git a/homeassistant/components/deconz/button.py b/homeassistant/components/deconz/button.py index 52105c10203..64801880583 100644 --- a/homeassistant/components/deconz/button.py +++ b/homeassistant/components/deconz/button.py @@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice, DeconzSceneMixin -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry @dataclass(frozen=True, kw_only=True) @@ -88,7 +88,7 @@ class DeconzSceneButton(DeconzSceneMixin, ButtonEntity): def __init__( self, device: PydeconzScene, - gateway: DeconzGateway, + gateway: DeconzHub, description: DeconzButtonDescription, ) -> None: """Initialize deCONZ number entity.""" diff --git a/homeassistant/components/deconz/climate.py b/homeassistant/components/deconz/climate.py index 2fddedb00d5..931995196cc 100644 --- a/homeassistant/components/deconz/climate.py +++ b/homeassistant/components/deconz/climate.py @@ -35,7 +35,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import ATTR_LOCKED, ATTR_OFFSET, ATTR_VALVE from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry DECONZ_FAN_SMART = "smart" @@ -103,7 +103,7 @@ class DeconzThermostat(DeconzDevice[Thermostat], ClimateEntity): _attr_temperature_unit = UnitOfTemperature.CELSIUS _enable_turn_on_off_backwards_compatibility = False - def __init__(self, device: Thermostat, gateway: DeconzGateway) -> None: + def __init__(self, device: Thermostat, gateway: DeconzHub) -> None: """Set up thermostat device.""" super().__init__(device, gateway) diff --git a/homeassistant/components/deconz/config_flow.py b/homeassistant/components/deconz/config_flow.py index 3eb6b808805..88f4dd3edb7 100644 --- a/homeassistant/components/deconz/config_flow.py +++ b/homeassistant/components/deconz/config_flow.py @@ -44,7 +44,7 @@ from .const import ( HASSIO_CONFIGURATION_URL, LOGGER, ) -from .gateway import DeconzGateway +from .hub import DeconzHub DECONZ_MANUFACTURERURL = "http://www.dresden-elektronik.de" CONF_SERIAL = "serial" @@ -52,11 +52,11 @@ CONF_MANUAL_INPUT = "Manually define gateway" @callback -def get_master_gateway(hass: HomeAssistant) -> DeconzGateway: +def get_master_gateway(hass: HomeAssistant) -> DeconzHub: """Return the gateway which is marked as master.""" for gateway in hass.data[DOMAIN].values(): if gateway.master: - return cast(DeconzGateway, gateway) + return cast(DeconzHub, gateway) raise ValueError @@ -300,7 +300,7 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN): class DeconzOptionsFlowHandler(OptionsFlow): """Handle deCONZ options.""" - gateway: DeconzGateway + gateway: DeconzHub def __init__(self, config_entry: ConfigEntry) -> None: """Initialize deCONZ options flow.""" diff --git a/homeassistant/components/deconz/cover.py b/homeassistant/components/deconz/cover.py index bac1ea404b9..bccdac1fc4c 100644 --- a/homeassistant/components/deconz/cover.py +++ b/homeassistant/components/deconz/cover.py @@ -22,7 +22,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry DECONZ_TYPE_TO_DEVICE_CLASS = { ResourceType.LEVEL_CONTROLLABLE_OUTPUT.value: CoverDeviceClass.DAMPER, @@ -56,7 +56,7 @@ class DeconzCover(DeconzDevice[Cover], CoverEntity): TYPE = DOMAIN - def __init__(self, cover_id: str, gateway: DeconzGateway) -> None: + def __init__(self, cover_id: str, gateway: DeconzHub) -> None: """Set up cover device.""" super().__init__(cover := gateway.api.lights.covers[cover_id], gateway) diff --git a/homeassistant/components/deconz/deconz_device.py b/homeassistant/components/deconz/deconz_device.py index 8a5ced2c678..90f6a5a251f 100644 --- a/homeassistant/components/deconz/deconz_device.py +++ b/homeassistant/components/deconz/deconz_device.py @@ -16,7 +16,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity from .const import DOMAIN as DECONZ_DOMAIN -from .gateway import DeconzGateway +from .hub import DeconzHub from .util import serial_from_unique_id _DeviceT = TypeVar( @@ -33,7 +33,7 @@ class DeconzBase(Generic[_DeviceT]): def __init__( self, device: _DeviceT, - gateway: DeconzGateway, + gateway: DeconzHub, ) -> None: """Set up device and add update callback to get data from websocket.""" self._device: _DeviceT = device @@ -85,7 +85,7 @@ class DeconzDevice(DeconzBase[_DeviceT], Entity): def __init__( self, device: _DeviceT, - gateway: DeconzGateway, + gateway: DeconzHub, ) -> None: """Set up device and add update callback to get data from websocket.""" super().__init__(device, gateway) @@ -152,7 +152,7 @@ class DeconzSceneMixin(DeconzDevice[PydeconzScene]): def __init__( self, device: PydeconzScene, - gateway: DeconzGateway, + gateway: DeconzHub, ) -> None: """Set up a scene.""" super().__init__(device, gateway) diff --git a/homeassistant/components/deconz/deconz_event.py b/homeassistant/components/deconz/deconz_event.py index 9bde87e5e17..70ee964f2f5 100644 --- a/homeassistant/components/deconz/deconz_event.py +++ b/homeassistant/components/deconz/deconz_event.py @@ -26,7 +26,7 @@ from homeassistant.util import slugify from .const import ATTR_DURATION, ATTR_ROTATION, CONF_ANGLE, CONF_GESTURE, LOGGER from .deconz_device import DeconzBase -from .gateway import DeconzGateway +from .hub import DeconzHub CONF_DECONZ_EVENT = "deconz_event" CONF_DECONZ_ALARM_EVENT = "deconz_alarm_event" @@ -55,7 +55,7 @@ RELATIVE_ROTARY_DECONZ_TO_EVENT = { } -async def async_setup_events(gateway: DeconzGateway) -> None: +async def async_setup_events(gateway: DeconzHub) -> None: """Set up the deCONZ events.""" @callback @@ -100,7 +100,7 @@ async def async_setup_events(gateway: DeconzGateway) -> None: @callback -def async_unload_events(gateway: DeconzGateway) -> None: +def async_unload_events(gateway: DeconzHub) -> None: """Unload all deCONZ events.""" for event in gateway.events: event.async_will_remove_from_hass() @@ -118,7 +118,7 @@ class DeconzEventBase(DeconzBase): def __init__( self, device: AncillaryControl | Presence | RelativeRotary | Switch, - gateway: DeconzGateway, + gateway: DeconzHub, ) -> None: """Register callback that will be used for signals.""" super().__init__(device, gateway) diff --git a/homeassistant/components/deconz/device_trigger.py b/homeassistant/components/deconz/device_trigger.py index a4c24b7b7f4..27c82ab0be5 100644 --- a/homeassistant/components/deconz/device_trigger.py +++ b/homeassistant/components/deconz/device_trigger.py @@ -31,7 +31,7 @@ from .deconz_event import ( DeconzPresenceEvent, DeconzRelativeRotaryEvent, ) -from .gateway import DeconzGateway +from .hub import DeconzHub CONF_SUBTYPE = "subtype" @@ -656,7 +656,7 @@ def _get_deconz_event_from_device( device: dr.DeviceEntry, ) -> DeconzAlarmEvent | DeconzEvent | DeconzPresenceEvent | DeconzRelativeRotaryEvent: """Resolve deconz event from device.""" - gateways: dict[str, DeconzGateway] = hass.data.get(DOMAIN, {}) + gateways: dict[str, DeconzHub] = hass.data.get(DOMAIN, {}) for gateway in gateways.values(): for deconz_event in gateway.events: if device.id == deconz_event.device_id: diff --git a/homeassistant/components/deconz/diagnostics.py b/homeassistant/components/deconz/diagnostics.py index aa40c314802..3200ea162e4 100644 --- a/homeassistant/components/deconz/diagnostics.py +++ b/homeassistant/components/deconz/diagnostics.py @@ -9,7 +9,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_UNIQUE_ID from homeassistant.core import HomeAssistant -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry REDACT_CONFIG = {CONF_API_KEY, CONF_UNIQUE_ID} REDACT_DECONZ_CONFIG = {"bridgeid", "mac", "panid"} diff --git a/homeassistant/components/deconz/fan.py b/homeassistant/components/deconz/fan.py index 65cc2f81ee2..45b1a83878f 100644 --- a/homeassistant/components/deconz/fan.py +++ b/homeassistant/components/deconz/fan.py @@ -17,7 +17,7 @@ from homeassistant.util.percentage import ( ) from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry ORDERED_NAMED_FAN_SPEEDS: list[LightFanSpeed] = [ LightFanSpeed.PERCENT_25, @@ -58,7 +58,7 @@ class DeconzFan(DeconzDevice[Light], FanEntity): _attr_supported_features = FanEntityFeature.SET_SPEED - def __init__(self, device: Light, gateway: DeconzGateway) -> None: + def __init__(self, device: Light, gateway: DeconzHub) -> None: """Set up fan.""" super().__init__(device, gateway) _attr_speed_count = len(ORDERED_NAMED_FAN_SPEEDS) diff --git a/homeassistant/components/deconz/hub/__init__.py b/homeassistant/components/deconz/hub/__init__.py index 962ecf47787..a99a578a89d 100644 --- a/homeassistant/components/deconz/hub/__init__.py +++ b/homeassistant/components/deconz/hub/__init__.py @@ -1,3 +1,4 @@ """Internal functionality not part of HA infrastructure.""" from .api import get_deconz_api # noqa: F401 +from .hub import DeconzHub, get_gateway_from_config_entry # noqa: F401 diff --git a/homeassistant/components/deconz/gateway.py b/homeassistant/components/deconz/hub/hub.py similarity index 98% rename from homeassistant/components/deconz/gateway.py rename to homeassistant/components/deconz/hub/hub.py index adc75e987b9..5c422f845bd 100644 --- a/homeassistant/components/deconz/gateway.py +++ b/homeassistant/components/deconz/hub/hub.py @@ -18,7 +18,7 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.dispatcher import async_dispatcher_send -from .const import ( +from ..const import ( CONF_ALLOW_CLIP_SENSOR, CONF_ALLOW_DECONZ_GROUPS, CONF_ALLOW_NEW_DEVICES, @@ -32,7 +32,7 @@ from .const import ( ) if TYPE_CHECKING: - from .deconz_event import ( + from ..deconz_event import ( DeconzAlarmEvent, DeconzEvent, DeconzPresenceEvent, @@ -69,7 +69,7 @@ SENSORS = ( ) -class DeconzGateway: +class DeconzHub: """Manages a single deCONZ gateway.""" def __init__( @@ -328,6 +328,6 @@ class DeconzGateway: @callback def get_gateway_from_config_entry( hass: HomeAssistant, config_entry: ConfigEntry -) -> DeconzGateway: +) -> DeconzHub: """Return gateway with a matching config entry ID.""" - return cast(DeconzGateway, hass.data[DECONZ_DOMAIN][config_entry.entry_id]) + return cast(DeconzHub, hass.data[DECONZ_DOMAIN][config_entry.entry_id]) diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index 1f9bc953448..4565e72e9f5 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -36,7 +36,7 @@ from homeassistant.util.color import color_hs_to_xy from .const import DOMAIN as DECONZ_DOMAIN, POWER_PLUGS from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry DECONZ_GROUP = "is_deconz_group" EFFECT_TO_DECONZ = { @@ -168,7 +168,7 @@ class DeconzBaseLight(DeconzDevice[_LightDeviceT], LightEntity): TYPE = DOMAIN _attr_color_mode = ColorMode.UNKNOWN - def __init__(self, device: _LightDeviceT, gateway: DeconzGateway) -> None: + def __init__(self, device: _LightDeviceT, gateway: DeconzHub) -> None: """Set up light.""" super().__init__(device, gateway) @@ -334,7 +334,7 @@ class DeconzGroup(DeconzBaseLight[Group]): _attr_has_entity_name = True - def __init__(self, device: Group, gateway: DeconzGateway) -> None: + def __init__(self, device: Group, gateway: DeconzHub) -> None: """Set up group and create an unique id.""" self._unique_id = f"{gateway.bridgeid}-{device.deconz_id}" super().__init__(device, gateway) diff --git a/homeassistant/components/deconz/lock.py b/homeassistant/components/deconz/lock.py index 7afde4ada11..c5fdcd43625 100644 --- a/homeassistant/components/deconz/lock.py +++ b/homeassistant/components/deconz/lock.py @@ -14,7 +14,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry async def async_setup_entry( diff --git a/homeassistant/components/deconz/number.py b/homeassistant/components/deconz/number.py index e98f5d726ac..a829831b511 100644 --- a/homeassistant/components/deconz/number.py +++ b/homeassistant/components/deconz/number.py @@ -25,7 +25,7 @@ import homeassistant.helpers.entity_registry as er from .const import DOMAIN as DECONZ_DOMAIN from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry from .util import serial_from_unique_id T = TypeVar("T", Presence, PydeconzSensorBase) @@ -129,7 +129,7 @@ class DeconzNumber(DeconzDevice[SensorResources], NumberEntity): def __init__( self, device: SensorResources, - gateway: DeconzGateway, + gateway: DeconzHub, description: DeconzNumberDescription, ) -> None: """Initialize deCONZ number entity.""" diff --git a/homeassistant/components/deconz/scene.py b/homeassistant/components/deconz/scene.py index 236389cc100..75e0a5ff44d 100644 --- a/homeassistant/components/deconz/scene.py +++ b/homeassistant/components/deconz/scene.py @@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzSceneMixin -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry async def async_setup_entry( diff --git a/homeassistant/components/deconz/select.py b/homeassistant/components/deconz/select.py index d38fee2fdc7..7720df7c8cd 100644 --- a/homeassistant/components/deconz/select.py +++ b/homeassistant/components/deconz/select.py @@ -17,7 +17,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry SENSITIVITY_TO_DECONZ = { "High": PresenceConfigSensitivity.HIGH.value, diff --git a/homeassistant/components/deconz/sensor.py b/homeassistant/components/deconz/sensor.py index 8366c811318..7f5495bdd98 100644 --- a/homeassistant/components/deconz/sensor.py +++ b/homeassistant/components/deconz/sensor.py @@ -54,7 +54,7 @@ import homeassistant.util.dt as dt_util from .const import ATTR_DARK, ATTR_ON, DOMAIN as DECONZ_DOMAIN from .deconz_device import DeconzDevice -from .gateway import DeconzGateway, get_gateway_from_config_entry +from .hub import DeconzHub, get_gateway_from_config_entry from .util import serial_from_unique_id PROVIDES_EXTRA_ATTRIBUTES = ( @@ -386,7 +386,7 @@ class DeconzSensor(DeconzDevice[SensorResources], SensorEntity): def __init__( self, device: SensorResources, - gateway: DeconzGateway, + gateway: DeconzHub, description: DeconzSensorDescription, ) -> None: """Initialize deCONZ sensor.""" @@ -453,7 +453,7 @@ class DeconzBatteryTracker: def __init__( self, sensor_id: str, - gateway: DeconzGateway, + gateway: DeconzHub, description: DeconzSensorDescription, async_add_entities: AddEntitiesCallback, ) -> None: diff --git a/homeassistant/components/deconz/services.py b/homeassistant/components/deconz/services.py index bcac6ac1e1d..d27c2a67615 100644 --- a/homeassistant/components/deconz/services.py +++ b/homeassistant/components/deconz/services.py @@ -18,7 +18,7 @@ from homeassistant.util.read_only_dict import ReadOnlyDict from .config_flow import get_master_gateway from .const import CONF_BRIDGE_ID, DOMAIN, LOGGER -from .gateway import DeconzGateway +from .hub import DeconzHub DECONZ_SERVICES = "deconz_services" @@ -110,7 +110,7 @@ def async_unload_services(hass: HomeAssistant) -> None: hass.services.async_remove(DOMAIN, service) -async def async_configure_service(gateway: DeconzGateway, data: ReadOnlyDict) -> None: +async def async_configure_service(gateway: DeconzHub, data: ReadOnlyDict) -> None: """Set attribute of device in deCONZ. Entity is used to resolve to a device path (e.g. '/lights/1'). @@ -140,7 +140,7 @@ async def async_configure_service(gateway: DeconzGateway, data: ReadOnlyDict) -> await gateway.api.request("put", field, json=data) -async def async_refresh_devices_service(gateway: DeconzGateway) -> None: +async def async_refresh_devices_service(gateway: DeconzHub) -> None: """Refresh available devices from deCONZ.""" gateway.ignore_state_updates = True await gateway.api.refresh_state() @@ -148,7 +148,7 @@ async def async_refresh_devices_service(gateway: DeconzGateway) -> None: gateway.ignore_state_updates = False -async def async_remove_orphaned_entries_service(gateway: DeconzGateway) -> None: +async def async_remove_orphaned_entries_service(gateway: DeconzHub) -> None: """Remove orphaned deCONZ entries from device and entity registries.""" device_registry = dr.async_get(gateway.hass) entity_registry = er.async_get(gateway.hass) diff --git a/homeassistant/components/deconz/siren.py b/homeassistant/components/deconz/siren.py index a6c4a441e1f..e054dc8b473 100644 --- a/homeassistant/components/deconz/siren.py +++ b/homeassistant/components/deconz/siren.py @@ -18,7 +18,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from .deconz_device import DeconzDevice -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry async def async_setup_entry( diff --git a/homeassistant/components/deconz/switch.py b/homeassistant/components/deconz/switch.py index 990de24dffc..214f3f17897 100644 --- a/homeassistant/components/deconz/switch.py +++ b/homeassistant/components/deconz/switch.py @@ -14,7 +14,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import POWER_PLUGS from .deconz_device import DeconzDevice -from .gateway import get_gateway_from_config_entry +from .hub import get_gateway_from_config_entry async def async_setup_entry( diff --git a/tests/components/deconz/test_gateway.py b/tests/components/deconz/test_gateway.py index a9974b61d08..aec39dc5b8b 100644 --- a/tests/components/deconz/test_gateway.py +++ b/tests/components/deconz/test_gateway.py @@ -18,8 +18,10 @@ from homeassistant.components.cover import DOMAIN as COVER_DOMAIN from homeassistant.components.deconz.config_flow import DECONZ_MANUFACTURERURL from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN from homeassistant.components.deconz.errors import AuthenticationRequired, CannotConnect -from homeassistant.components.deconz.gateway import get_gateway_from_config_entry -from homeassistant.components.deconz.hub import get_deconz_api +from homeassistant.components.deconz.hub import ( + get_deconz_api, + get_gateway_from_config_entry, +) from homeassistant.components.fan import DOMAIN as FAN_DOMAIN from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN diff --git a/tests/components/deconz/test_init.py b/tests/components/deconz/test_init.py index 972f82b1db3..64b1594faea 100644 --- a/tests/components/deconz/test_init.py +++ b/tests/components/deconz/test_init.py @@ -4,7 +4,7 @@ import asyncio from unittest.mock import patch from homeassistant.components.deconz import ( - DeconzGateway, + DeconzHub, async_setup_entry, async_unload_entry, async_update_group_unique_id, @@ -39,8 +39,8 @@ ENTRY2_UUID = "789ACE" async def setup_entry(hass, entry): """Test that setup entry works.""" - with patch.object(DeconzGateway, "async_setup", return_value=True), patch.object( - DeconzGateway, "async_update_device_registry", return_value=True + with patch.object(DeconzHub, "async_setup", return_value=True), patch.object( + DeconzHub, "async_update_device_registry", return_value=True ): assert await async_setup_entry(hass, entry) is True