mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Improve deCONZ platforms (#40986)
* Use platform domain imports with the list of supported platforms * Remove legacy async_setup_platform from platforms
This commit is contained in:
parent
40ea30da96
commit
c2ed743237
@ -33,10 +33,6 @@ DEVICE_CLASS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the deCONZ binary sensor."""
|
"""Set up the deCONZ binary sensor."""
|
||||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||||
|
@ -19,10 +19,6 @@ from .gateway import get_gateway_from_config_entry
|
|||||||
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the deCONZ climate devices.
|
"""Set up the deCONZ climate devices.
|
||||||
|
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
"""Constants for the deCONZ component."""
|
"""Constants for the deCONZ component."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||||
|
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN
|
||||||
|
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN
|
||||||
|
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||||
|
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
|
||||||
|
from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN
|
||||||
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||||
|
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__package__)
|
LOGGER = logging.getLogger(__package__)
|
||||||
|
|
||||||
DOMAIN = "deconz"
|
DOMAIN = "deconz"
|
||||||
@ -19,14 +28,14 @@ CONF_ALLOW_NEW_DEVICES = "allow_new_devices"
|
|||||||
CONF_MASTER_GATEWAY = "master"
|
CONF_MASTER_GATEWAY = "master"
|
||||||
|
|
||||||
SUPPORTED_PLATFORMS = [
|
SUPPORTED_PLATFORMS = [
|
||||||
"binary_sensor",
|
BINARY_SENSOR_DOMAIN,
|
||||||
"climate",
|
CLIMATE_DOMAIN,
|
||||||
"cover",
|
COVER_DOMAIN,
|
||||||
"light",
|
LIGHT_DOMAIN,
|
||||||
"lock",
|
LOCK_DOMAIN,
|
||||||
"scene",
|
SCENE_DOMAIN,
|
||||||
"sensor",
|
SENSOR_DOMAIN,
|
||||||
"switch",
|
SWITCH_DOMAIN,
|
||||||
]
|
]
|
||||||
|
|
||||||
NEW_GROUP = "groups"
|
NEW_GROUP = "groups"
|
||||||
|
@ -17,10 +17,6 @@ from .deconz_device import DeconzDevice
|
|||||||
from .gateway import get_gateway_from_config_entry
|
from .gateway import get_gateway_from_config_entry
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up covers for deCONZ component.
|
"""Set up covers for deCONZ component.
|
||||||
|
|
||||||
|
@ -35,10 +35,6 @@ from .deconz_device import DeconzDevice
|
|||||||
from .gateway import get_gateway_from_config_entry
|
from .gateway import get_gateway_from_config_entry
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the deCONZ lights and groups from a config entry."""
|
"""Set up the deCONZ lights and groups from a config entry."""
|
||||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||||
|
@ -9,10 +9,6 @@ from .const import NEW_SCENE
|
|||||||
from .gateway import get_gateway_from_config_entry
|
from .gateway import get_gateway_from_config_entry
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up scenes for deCONZ component."""
|
"""Set up scenes for deCONZ component."""
|
||||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||||
|
@ -68,10 +68,6 @@ UNIT_OF_MEASUREMENT = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the deCONZ sensors."""
|
"""Set up the deCONZ sensors."""
|
||||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||||
|
@ -8,10 +8,6 @@ from .deconz_device import DeconzDevice
|
|||||||
from .gateway import get_gateway_from_config_entry
|
from .gateway import get_gateway_from_config_entry
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Old way of setting up deCONZ platforms."""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up switches for deCONZ component.
|
"""Set up switches for deCONZ component.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user