Rename Entity module in tellduslive (#125668)

This commit is contained in:
epenet 2024-09-10 15:34:30 +02:00 committed by GitHub
parent 130b6559a6
commit afeab659e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 22 deletions

View File

@ -7,8 +7,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .. import tellduslive from .const import DOMAIN, TELLDUS_DISCOVERY_NEW
from .entry import TelldusLiveEntity from .entity import TelldusLiveEntity
async def async_setup_entry( async def async_setup_entry(
@ -20,14 +20,12 @@ async def async_setup_entry(
async def async_discover_binary_sensor(device_id): async def async_discover_binary_sensor(device_id):
"""Discover and add a discovered sensor.""" """Discover and add a discovered sensor."""
client = hass.data[tellduslive.DOMAIN] client = hass.data[DOMAIN]
async_add_entities([TelldusLiveSensor(client, device_id)]) async_add_entities([TelldusLiveSensor(client, device_id)])
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,
tellduslive.TELLDUS_DISCOVERY_NEW.format( TELLDUS_DISCOVERY_NEW.format(binary_sensor.DOMAIN, DOMAIN),
binary_sensor.DOMAIN, tellduslive.DOMAIN
),
async_discover_binary_sensor, async_discover_binary_sensor,
) )

View File

@ -9,9 +9,9 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .. import tellduslive
from . import TelldusLiveClient from . import TelldusLiveClient
from .entry import TelldusLiveEntity from .const import DOMAIN, TELLDUS_DISCOVERY_NEW
from .entity import TelldusLiveEntity
async def async_setup_entry( async def async_setup_entry(
@ -23,12 +23,12 @@ async def async_setup_entry(
async def async_discover_cover(device_id): async def async_discover_cover(device_id):
"""Discover and add a discovered sensor.""" """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_add_entities([TelldusLiveCover(client, device_id)])
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,
tellduslive.TELLDUS_DISCOVERY_NEW.format(cover.DOMAIN, tellduslive.DOMAIN), TELLDUS_DISCOVERY_NEW.format(cover.DOMAIN, DOMAIN),
async_discover_cover, async_discover_cover,
) )

View File

@ -10,8 +10,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .. import tellduslive from .const import DOMAIN, TELLDUS_DISCOVERY_NEW
from .entry import TelldusLiveEntity from .entity import TelldusLiveEntity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -25,12 +25,12 @@ async def async_setup_entry(
async def async_discover_light(device_id): async def async_discover_light(device_id):
"""Discover and add a discovered sensor.""" """Discover and add a discovered sensor."""
client = hass.data[tellduslive.DOMAIN] client = hass.data[DOMAIN]
async_add_entities([TelldusLiveLight(client, device_id)]) async_add_entities([TelldusLiveLight(client, device_id)])
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,
tellduslive.TELLDUS_DISCOVERY_NEW.format(light.DOMAIN, tellduslive.DOMAIN), TELLDUS_DISCOVERY_NEW.format(light.DOMAIN, DOMAIN),
async_discover_light, async_discover_light,
) )

View File

@ -25,8 +25,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .. import tellduslive from .const import DOMAIN, TELLDUS_DISCOVERY_NEW
from .entry import TelldusLiveEntity from .entity import TelldusLiveEntity
SENSOR_TYPE_TEMPERATURE = "temp" SENSOR_TYPE_TEMPERATURE = "temp"
SENSOR_TYPE_HUMIDITY = "humidity" SENSOR_TYPE_HUMIDITY = "humidity"
@ -127,12 +127,12 @@ async def async_setup_entry(
async def async_discover_sensor(device_id): async def async_discover_sensor(device_id):
"""Discover and add a discovered sensor.""" """Discover and add a discovered sensor."""
client = hass.data[tellduslive.DOMAIN] client = hass.data[DOMAIN]
async_add_entities([TelldusLiveSensor(client, device_id)]) async_add_entities([TelldusLiveSensor(client, device_id)])
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,
tellduslive.TELLDUS_DISCOVERY_NEW.format(sensor.DOMAIN, tellduslive.DOMAIN), TELLDUS_DISCOVERY_NEW.format(sensor.DOMAIN, DOMAIN),
async_discover_sensor, async_discover_sensor,
) )

View File

@ -9,8 +9,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .. import tellduslive from .const import DOMAIN, TELLDUS_DISCOVERY_NEW
from .entry import TelldusLiveEntity from .entity import TelldusLiveEntity
async def async_setup_entry( async def async_setup_entry(
@ -22,12 +22,12 @@ async def async_setup_entry(
async def async_discover_switch(device_id): async def async_discover_switch(device_id):
"""Discover and add a discovered sensor.""" """Discover and add a discovered sensor."""
client = hass.data[tellduslive.DOMAIN] client = hass.data[DOMAIN]
async_add_entities([TelldusLiveSwitch(client, device_id)]) async_add_entities([TelldusLiveSwitch(client, device_id)])
async_dispatcher_connect( async_dispatcher_connect(
hass, hass,
tellduslive.TELLDUS_DISCOVERY_NEW.format(switch.DOMAIN, tellduslive.DOMAIN), TELLDUS_DISCOVERY_NEW.format(switch.DOMAIN, DOMAIN),
async_discover_switch, async_discover_switch,
) )