Remove invalid return values in setup methods [r-z] (#63365)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/63367/head
parent
dc15c9ed75
commit
b14ac1b94a
|
@ -1,4 +1,6 @@
|
|||
"""Support for interfacing with Russound via RNET Protocol."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from russound import russound
|
||||
|
@ -13,7 +15,10 @@ from homeassistant.components.media_player.const import (
|
|||
SUPPORT_VOLUME_SET,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -43,14 +48,19 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Russound RNET platform."""
|
||||
host = config.get(CONF_HOST)
|
||||
port = config.get(CONF_PORT)
|
||||
|
||||
if host is None or port is None:
|
||||
_LOGGER.error("Invalid config. Expected %s and %s", CONF_HOST, CONF_PORT)
|
||||
return False
|
||||
return
|
||||
|
||||
russ = russound.Russound(host, port)
|
||||
russ.connect()
|
||||
|
|
|
@ -7,8 +7,10 @@ from schluter.authenticator import AuthenticationState, Authenticator
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
@ -31,7 +33,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Schluter component."""
|
||||
_LOGGER.debug("Starting setup of schluter")
|
||||
|
||||
|
@ -51,7 +53,7 @@ def setup(hass, config):
|
|||
authentication = authenticator.authenticate()
|
||||
except RequestException as ex:
|
||||
_LOGGER.error("Unable to connect to Schluter service: %s", ex)
|
||||
return
|
||||
return False
|
||||
|
||||
state = authentication.state
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Sensor for displaying the number of result on Shodan.io."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
|
@ -7,7 +9,10 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -30,7 +35,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Shodan sensor."""
|
||||
api_key = config.get(CONF_API_KEY)
|
||||
name = config.get(CONF_NAME)
|
||||
|
@ -41,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
data.update()
|
||||
except shodan.exception.APIError as error:
|
||||
_LOGGER.warning("Unable to connect to Shodan.io: %s", error)
|
||||
return False
|
||||
return
|
||||
|
||||
add_entities([ShodanSensor(data, name)], True)
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Sensor for SigFox devices."""
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
|
@ -10,7 +12,10 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -29,7 +34,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the sigfox sensor."""
|
||||
api_login = config[CONF_API_LOGIN]
|
||||
api_password = config[CONF_API_PASSWORD]
|
||||
|
@ -37,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
try:
|
||||
sigfox = SigfoxAPI(api_login, api_password)
|
||||
except ValueError:
|
||||
return False
|
||||
return
|
||||
auth = sigfox.auth
|
||||
devices = sigfox.devices
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for Sony projectors via SDCP network control."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import pysdcp
|
||||
|
@ -6,7 +8,10 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -20,7 +25,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Connect to Sony projector using network."""
|
||||
|
||||
host = config[CONF_HOST]
|
||||
|
@ -32,10 +42,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
sdcp_connection.get_power()
|
||||
except ConnectionError:
|
||||
_LOGGER.error("Failed to connect to projector '%s'", host)
|
||||
return False
|
||||
return
|
||||
_LOGGER.debug("Validated projector '%s' OK", host)
|
||||
add_entities([SonyProjector(sdcp_connection, name)], True)
|
||||
return True
|
||||
|
||||
|
||||
class SonyProjector(SwitchEntity):
|
||||
|
|
|
@ -26,7 +26,7 @@ from homeassistant.components.media_player.const import (
|
|||
SUPPORT_VOLUME_MUTE,
|
||||
SUPPORT_VOLUME_SET,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_INTEGRATION_DISCOVERY
|
||||
from homeassistant.config_entries import SOURCE_INTEGRATION_DISCOVERY, ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_COMMAND,
|
||||
CONF_HOST,
|
||||
|
@ -39,7 +39,7 @@ from homeassistant.const import (
|
|||
STATE_PAUSED,
|
||||
STATE_PLAYING,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.device_registry import format_mac
|
||||
|
@ -47,6 +47,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .browse_media import build_item_response, generate_playlist, library_payload
|
||||
|
@ -123,7 +124,11 @@ async def start_server_discovery(hass):
|
|||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up an LMS Server from a config entry."""
|
||||
config = config_entry.data
|
||||
_LOGGER.debug("Reached async_setup_entry for host=%s", config[CONF_HOST])
|
||||
|
@ -215,8 +220,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
EVENT_HOMEASSISTANT_START, start_server_discovery(hass)
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class SqueezeBoxEntity(MediaPlayerEntity):
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support gathering ted5000 information."""
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
@ -19,7 +21,10 @@ from homeassistant.const import (
|
|||
ELECTRIC_POTENTIAL_VOLT,
|
||||
POWER_WATT,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -38,7 +43,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Ted5000 sensor."""
|
||||
host = config.get(CONF_HOST)
|
||||
port = config.get(CONF_PORT)
|
||||
|
@ -56,7 +66,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
dev.append(Ted5000Sensor(gateway, name, mtu, ELECTRIC_POTENTIAL_VOLT))
|
||||
|
||||
add_entities(dev)
|
||||
return True
|
||||
|
||||
|
||||
class Ted5000Sensor(SensorEntity):
|
||||
|
|
|
@ -20,7 +20,10 @@ from homeassistant.const import (
|
|||
CONF_SCAN_INTERVAL,
|
||||
TIME_SECONDS,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -85,7 +88,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Travis CI sensor."""
|
||||
|
||||
token = config[CONF_API_KEY]
|
||||
|
@ -105,7 +113,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
title=NOTIFICATION_TITLE,
|
||||
notification_id=NOTIFICATION_ID,
|
||||
)
|
||||
return False
|
||||
return
|
||||
|
||||
# non specific repository selected, then show all associated
|
||||
if not repositories:
|
||||
|
|
|
@ -11,8 +11,11 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util.dt import utc_from_timestamp
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -35,7 +38,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Discover cameras on a Unifi NVR."""
|
||||
addr = config[CONF_NVR]
|
||||
key = config[CONF_KEY]
|
||||
|
@ -58,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
]
|
||||
except nvr.NotAuthorized:
|
||||
_LOGGER.error("Authorization failure while connecting to NVR")
|
||||
return False
|
||||
return
|
||||
except nvr.NvrError as ex:
|
||||
_LOGGER.error("NVR refuses to talk to me: %s", str(ex))
|
||||
raise PlatformNotReady from ex
|
||||
|
@ -73,7 +81,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
],
|
||||
True,
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
class UnifiVideoCamera(Camera):
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .common import VeSyncDevice
|
||||
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_SWITCHES
|
||||
|
@ -21,7 +23,11 @@ DEV_TYPE_TO_HA = {
|
|||
}
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up switches."""
|
||||
|
||||
async def async_discover(devices):
|
||||
|
@ -34,7 +40,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
hass.data[DOMAIN][VS_DISPATCHERS].append(disp)
|
||||
|
||||
_async_setup_entities(hass.data[DOMAIN][VS_SWITCHES], async_add_entities)
|
||||
return True
|
||||
|
||||
|
||||
@callback
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for Yeelight Sunflower color bulbs (not Yeelight Blue or WiFi)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -13,7 +15,10 @@ from homeassistant.components.light import (
|
|||
LightEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -23,14 +28,19 @@ SUPPORT_YEELIGHT_SUNFLOWER = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
|||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string})
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Yeelight Sunflower Light platform."""
|
||||
host = config.get(CONF_HOST)
|
||||
hub = yeelightsunflower.Hub(host)
|
||||
|
||||
if not hub.available:
|
||||
_LOGGER.error("Could not connect to Yeelight Sunflower hub")
|
||||
return False
|
||||
return
|
||||
|
||||
add_entities(SunflowerBulb(light) for light in hub.get_lights())
|
||||
|
||||
|
|
|
@ -34,7 +34,10 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
__version__,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import Throttle, dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -198,7 +201,12 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the ZAMG sensor platform."""
|
||||
name = config[CONF_NAME]
|
||||
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
||||
|
@ -213,14 +221,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
CONF_STATION_ID,
|
||||
station_id,
|
||||
)
|
||||
return False
|
||||
return
|
||||
|
||||
probe = ZamgData(station_id=station_id)
|
||||
try:
|
||||
probe.update()
|
||||
except (ValueError, TypeError) as err:
|
||||
_LOGGER.error("Received error from ZAMG: %s", err)
|
||||
return False
|
||||
return
|
||||
|
||||
monitored_conditions = config[CONF_MONITORED_CONDITIONS]
|
||||
add_entities(
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Sensor for data from Austrian Zentralanstalt für Meteorologie."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -13,7 +15,10 @@ from homeassistant.components.weather import (
|
|||
WeatherEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
# Reuse data and API logic from the sensor implementation
|
||||
from .sensor import (
|
||||
|
@ -40,7 +45,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the ZAMG weather platform."""
|
||||
name = config.get(CONF_NAME)
|
||||
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
||||
|
@ -55,14 +65,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
CONF_STATION_ID,
|
||||
station_id,
|
||||
)
|
||||
return False
|
||||
return
|
||||
|
||||
probe = ZamgData(station_id=station_id)
|
||||
try:
|
||||
probe.update()
|
||||
except (ValueError, TypeError) as err:
|
||||
_LOGGER.error("Received error from ZAMG: %s", err)
|
||||
return False
|
||||
return
|
||||
|
||||
add_entities([ZamgWeather(probe, name)], True)
|
||||
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
"""Support for ZoneMinder binary sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as ZONEMINDER_DOMAIN
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the ZoneMinder binary sensor platform."""
|
||||
sensors = []
|
||||
for host_name, zm_client in hass.data[ZONEMINDER_DOMAIN].items():
|
||||
sensors.append(ZMAvailabilitySensor(host_name, zm_client))
|
||||
add_entities(sensors)
|
||||
return True
|
||||
|
||||
|
||||
class ZMAvailabilitySensor(BinarySensorEntity):
|
||||
|
|
Loading…
Reference in New Issue