From afeab659e1951f7a237fb309d4981b748aceb25b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:34:30 +0200 Subject: [PATCH] Rename Entity module in tellduslive (#125668) --- homeassistant/components/tellduslive/binary_sensor.py | 10 ++++------ homeassistant/components/tellduslive/cover.py | 8 ++++---- .../components/tellduslive/{entry.py => entity.py} | 0 homeassistant/components/tellduslive/light.py | 8 ++++---- homeassistant/components/tellduslive/sensor.py | 8 ++++---- homeassistant/components/tellduslive/switch.py | 8 ++++---- 6 files changed, 20 insertions(+), 22 deletions(-) rename homeassistant/components/tellduslive/{entry.py => entity.py} (100%) diff --git a/homeassistant/components/tellduslive/binary_sensor.py b/homeassistant/components/tellduslive/binary_sensor.py index 1eead7b55a5..33f936beb54 100644 --- a/homeassistant/components/tellduslive/binary_sensor.py +++ b/homeassistant/components/tellduslive/binary_sensor.py @@ -7,8 +7,8 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import tellduslive -from .entry import TelldusLiveEntity +from .const import DOMAIN, TELLDUS_DISCOVERY_NEW +from .entity import TelldusLiveEntity async def async_setup_entry( @@ -20,14 +20,12 @@ async def async_setup_entry( async def async_discover_binary_sensor(device_id): """Discover and add a discovered sensor.""" - client = hass.data[tellduslive.DOMAIN] + client = hass.data[DOMAIN] async_add_entities([TelldusLiveSensor(client, device_id)]) async_dispatcher_connect( hass, - tellduslive.TELLDUS_DISCOVERY_NEW.format( - binary_sensor.DOMAIN, tellduslive.DOMAIN - ), + TELLDUS_DISCOVERY_NEW.format(binary_sensor.DOMAIN, DOMAIN), async_discover_binary_sensor, ) diff --git a/homeassistant/components/tellduslive/cover.py b/homeassistant/components/tellduslive/cover.py index de962041333..d55a72cd633 100644 --- a/homeassistant/components/tellduslive/cover.py +++ b/homeassistant/components/tellduslive/cover.py @@ -9,9 +9,9 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import tellduslive from . import TelldusLiveClient -from .entry import TelldusLiveEntity +from .const import DOMAIN, TELLDUS_DISCOVERY_NEW +from .entity import TelldusLiveEntity async def async_setup_entry( @@ -23,12 +23,12 @@ async def async_setup_entry( async def async_discover_cover(device_id): """Discover and add a discovered sensor.""" - client: TelldusLiveClient = hass.data[tellduslive.DOMAIN] + client: TelldusLiveClient = hass.data[DOMAIN] async_add_entities([TelldusLiveCover(client, device_id)]) async_dispatcher_connect( hass, - tellduslive.TELLDUS_DISCOVERY_NEW.format(cover.DOMAIN, tellduslive.DOMAIN), + TELLDUS_DISCOVERY_NEW.format(cover.DOMAIN, DOMAIN), async_discover_cover, ) diff --git a/homeassistant/components/tellduslive/entry.py b/homeassistant/components/tellduslive/entity.py similarity index 100% rename from homeassistant/components/tellduslive/entry.py rename to homeassistant/components/tellduslive/entity.py diff --git a/homeassistant/components/tellduslive/light.py b/homeassistant/components/tellduslive/light.py index 101ccb0dab0..753e9cf9476 100644 --- a/homeassistant/components/tellduslive/light.py +++ b/homeassistant/components/tellduslive/light.py @@ -10,8 +10,8 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import tellduslive -from .entry import TelldusLiveEntity +from .const import DOMAIN, TELLDUS_DISCOVERY_NEW +from .entity import TelldusLiveEntity _LOGGER = logging.getLogger(__name__) @@ -25,12 +25,12 @@ async def async_setup_entry( async def async_discover_light(device_id): """Discover and add a discovered sensor.""" - client = hass.data[tellduslive.DOMAIN] + client = hass.data[DOMAIN] async_add_entities([TelldusLiveLight(client, device_id)]) async_dispatcher_connect( hass, - tellduslive.TELLDUS_DISCOVERY_NEW.format(light.DOMAIN, tellduslive.DOMAIN), + TELLDUS_DISCOVERY_NEW.format(light.DOMAIN, DOMAIN), async_discover_light, ) diff --git a/homeassistant/components/tellduslive/sensor.py b/homeassistant/components/tellduslive/sensor.py index 36520044101..70c83bb0038 100644 --- a/homeassistant/components/tellduslive/sensor.py +++ b/homeassistant/components/tellduslive/sensor.py @@ -25,8 +25,8 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import tellduslive -from .entry import TelldusLiveEntity +from .const import DOMAIN, TELLDUS_DISCOVERY_NEW +from .entity import TelldusLiveEntity SENSOR_TYPE_TEMPERATURE = "temp" SENSOR_TYPE_HUMIDITY = "humidity" @@ -127,12 +127,12 @@ async def async_setup_entry( async def async_discover_sensor(device_id): """Discover and add a discovered sensor.""" - client = hass.data[tellduslive.DOMAIN] + client = hass.data[DOMAIN] async_add_entities([TelldusLiveSensor(client, device_id)]) async_dispatcher_connect( hass, - tellduslive.TELLDUS_DISCOVERY_NEW.format(sensor.DOMAIN, tellduslive.DOMAIN), + TELLDUS_DISCOVERY_NEW.format(sensor.DOMAIN, DOMAIN), async_discover_sensor, ) diff --git a/homeassistant/components/tellduslive/switch.py b/homeassistant/components/tellduslive/switch.py index cd28a170442..bd770ab08f5 100644 --- a/homeassistant/components/tellduslive/switch.py +++ b/homeassistant/components/tellduslive/switch.py @@ -9,8 +9,8 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .. import tellduslive -from .entry import TelldusLiveEntity +from .const import DOMAIN, TELLDUS_DISCOVERY_NEW +from .entity import TelldusLiveEntity async def async_setup_entry( @@ -22,12 +22,12 @@ async def async_setup_entry( async def async_discover_switch(device_id): """Discover and add a discovered sensor.""" - client = hass.data[tellduslive.DOMAIN] + client = hass.data[DOMAIN] async_add_entities([TelldusLiveSwitch(client, device_id)]) async_dispatcher_connect( hass, - tellduslive.TELLDUS_DISCOVERY_NEW.format(switch.DOMAIN, tellduslive.DOMAIN), + TELLDUS_DISCOVERY_NEW.format(switch.DOMAIN, DOMAIN), async_discover_switch, )