From f188668d8a9b920e25547a62fdcbbf0d088073f9 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 15 May 2024 08:57:27 +0200 Subject: [PATCH] Rename gree coordinator module (#117474) --- homeassistant/components/gree/__init__.py | 2 +- homeassistant/components/gree/climate.py | 2 +- homeassistant/components/gree/{bridge.py => coordinator.py} | 2 +- homeassistant/components/gree/entity.py | 2 +- tests/components/gree/conftest.py | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename homeassistant/components/gree/{bridge.py => coordinator.py} (97%) diff --git a/homeassistant/components/gree/__init__.py b/homeassistant/components/gree/__init__.py index 5b2e95b15e2..0a2e2852e34 100644 --- a/homeassistant/components/gree/__init__.py +++ b/homeassistant/components/gree/__init__.py @@ -9,7 +9,6 @@ from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.event import async_track_time_interval -from .bridge import DiscoveryService from .const import ( COORDINATORS, DATA_DISCOVERY_SERVICE, @@ -17,6 +16,7 @@ from .const import ( DISPATCHERS, DOMAIN, ) +from .coordinator import DiscoveryService _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/gree/climate.py b/homeassistant/components/gree/climate.py index 66b025d52b5..20d5d405591 100644 --- a/homeassistant/components/gree/climate.py +++ b/homeassistant/components/gree/climate.py @@ -42,7 +42,6 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .bridge import DeviceDataUpdateCoordinator from .const import ( COORDINATORS, DISPATCH_DEVICE_DISCOVERED, @@ -51,6 +50,7 @@ from .const import ( FAN_MEDIUM_LOW, TARGET_TEMPERATURE_STEP, ) +from .coordinator import DeviceDataUpdateCoordinator from .entity import GreeEntity _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/gree/bridge.py b/homeassistant/components/gree/coordinator.py similarity index 97% rename from homeassistant/components/gree/bridge.py rename to homeassistant/components/gree/coordinator.py index 867f742e821..1bccf3bbc48 100644 --- a/homeassistant/components/gree/bridge.py +++ b/homeassistant/components/gree/coordinator.py @@ -24,7 +24,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -class DeviceDataUpdateCoordinator(DataUpdateCoordinator): # pylint: disable=hass-enforce-coordinator-module +class DeviceDataUpdateCoordinator(DataUpdateCoordinator): """Manages polling for state changes from the device.""" def __init__(self, hass: HomeAssistant, device: Device) -> None: diff --git a/homeassistant/components/gree/entity.py b/homeassistant/components/gree/entity.py index 4eb4a0cbaeb..7bdef0abd5d 100644 --- a/homeassistant/components/gree/entity.py +++ b/homeassistant/components/gree/entity.py @@ -3,8 +3,8 @@ from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity -from .bridge import DeviceDataUpdateCoordinator from .const import DOMAIN +from .coordinator import DeviceDataUpdateCoordinator class GreeEntity(CoordinatorEntity[DeviceDataUpdateCoordinator]): diff --git a/tests/components/gree/conftest.py b/tests/components/gree/conftest.py index 18113e6530c..eb1361beea3 100644 --- a/tests/components/gree/conftest.py +++ b/tests/components/gree/conftest.py @@ -20,7 +20,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]: @pytest.fixture(autouse=True, name="discovery") def discovery_fixture(): """Patch the discovery object.""" - with patch("homeassistant.components.gree.bridge.Discovery") as mock: + with patch("homeassistant.components.gree.coordinator.Discovery") as mock: mock.return_value = FakeDiscovery() yield mock @@ -29,7 +29,7 @@ def discovery_fixture(): def device_fixture(): """Patch the device search and bind.""" with patch( - "homeassistant.components.gree.bridge.Device", + "homeassistant.components.gree.coordinator.Device", return_value=build_device_mock(), ) as mock: yield mock