Improve typing in nest legacy platforms (#87071)
This commit is contained in:
parent
2412f7d266
commit
afa55156d6
4 changed files with 24 additions and 32 deletions
|
@ -8,7 +8,10 @@ from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDeviceClass,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_BINARY_SENSORS, CONF_MONITORED_CONDITIONS
|
from homeassistant.const import CONF_BINARY_SENSORS, CONF_MONITORED_CONDITIONS
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import NestSensorDevice
|
from . import NestSensorDevice
|
||||||
from .const import DATA_NEST, DATA_NEST_CONFIG
|
from .const import DATA_NEST, DATA_NEST_CONFIG
|
||||||
|
@ -53,14 +56,9 @@ _VALID_BINARY_SENSOR_TYPES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_legacy_entry(
|
||||||
"""Set up the Nest binary sensors.
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
No longer used.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_legacy_entry(hass, entry, async_add_entities) -> None:
|
|
||||||
"""Set up a Nest binary sensor based on a config entry."""
|
"""Set up a Nest binary sensor based on a config entry."""
|
||||||
nest = hass.data[DATA_NEST]
|
nest = hass.data[DATA_NEST]
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,10 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera, CameraEntityFeature
|
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera, CameraEntityFeature
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from .const import DATA_NEST, DOMAIN
|
from .const import DATA_NEST, DOMAIN
|
||||||
|
@ -21,14 +24,9 @@ NEST_BRAND = "Nest"
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({})
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_legacy_entry(
|
||||||
"""Set up a Nest Cam.
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
No longer in use.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_legacy_entry(hass, entry, async_add_entities) -> None:
|
|
||||||
"""Set up a Nest sensor based on a config entry."""
|
"""Set up a Nest sensor based on a config entry."""
|
||||||
camera_devices = await hass.async_add_executor_job(hass.data[DATA_NEST].cameras)
|
camera_devices = await hass.async_add_executor_job(hass.data[DATA_NEST].cameras)
|
||||||
cameras = [NestCamera(structure, device) for structure, device in camera_devices]
|
cameras = [NestCamera(structure, device) for structure, device in camera_devices]
|
||||||
|
|
|
@ -20,9 +20,12 @@ from homeassistant.components.climate import (
|
||||||
HVACAction,
|
HVACAction,
|
||||||
HVACMode,
|
HVACMode,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL, UnitOfTemperature
|
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL, UnitOfTemperature
|
||||||
|
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 import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DATA_NEST, DOMAIN, SIGNAL_NEST_UPDATE
|
from .const import DATA_NEST, DOMAIN, SIGNAL_NEST_UPDATE
|
||||||
|
|
||||||
|
@ -58,14 +61,9 @@ PRESET_AWAY_AND_ECO = "Away and Eco"
|
||||||
PRESET_MODES = [PRESET_NONE, PRESET_AWAY, PRESET_ECO, PRESET_AWAY_AND_ECO]
|
PRESET_MODES = [PRESET_NONE, PRESET_AWAY, PRESET_ECO, PRESET_AWAY_AND_ECO]
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_legacy_entry(
|
||||||
"""Set up the Nest thermostat.
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
No longer in use.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_legacy_entry(hass, entry, async_add_entities) -> None:
|
|
||||||
"""Set up the Nest climate device based on a config entry."""
|
"""Set up the Nest climate device based on a config entry."""
|
||||||
temp_unit = hass.config.units.temperature_unit
|
temp_unit = hass.config.units.temperature_unit
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.components.sensor import (
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
|
@ -15,6 +16,8 @@ from homeassistant.const import (
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import NestSensorDevice
|
from . import NestSensorDevice
|
||||||
from .const import DATA_NEST, DATA_NEST_CONFIG
|
from .const import DATA_NEST, DATA_NEST_CONFIG
|
||||||
|
@ -75,14 +78,9 @@ _SENSOR_TYPES_DEPRECATED = SENSOR_TYPES_DEPRECATED + DEPRECATED_WEATHER_VARS
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_legacy_entry(
|
||||||
"""Set up the Nest Sensor.
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
No longer used.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_legacy_entry(hass, entry, async_add_entities) -> None:
|
|
||||||
"""Set up a Nest sensor based on a config entry."""
|
"""Set up a Nest sensor based on a config entry."""
|
||||||
nest = hass.data[DATA_NEST]
|
nest = hass.data[DATA_NEST]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue