Check discovery_info is available and add setup type hints (#63782)
* Add setup type hints to ebusd
* Add setup type hints to envisalink
* Add setup type hints to sisyphus
* Add setup type hints to iperf3
* Add setup type hints to greeneye_monitor
* Revert "Add setup type hints to iperf3"
This reverts commit 9a382e4ba3
.
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
423674c0c9
commit
183a739968
7 changed files with 85 additions and 15 deletions
|
@ -1,4 +1,6 @@
|
|||
"""Support for Envisalink-based alarm control panels (Honeywell/DSC)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -24,9 +26,11 @@ from homeassistant.const import (
|
|||
STATE_ALARM_TRIGGERED,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import (
|
||||
CONF_PANIC,
|
||||
|
@ -51,8 +55,15 @@ ALARM_KEYPRESS_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Perform the setup for Envisalink alarm panels."""
|
||||
if not discovery_info:
|
||||
return
|
||||
configured_partitions = discovery_info["partitions"]
|
||||
code = discovery_info[CONF_CODE]
|
||||
panic_type = discovery_info[CONF_PANIC]
|
||||
|
@ -93,8 +104,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
schema=ALARM_KEYPRESS_SCHEMA,
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
||||
"""Representation of an Envisalink-based alarm panel."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue