Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions homeassistant/components/abode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_DATE,
ATTR_DEVICE_ID,
Expand All @@ -17,6 +18,7 @@
EVENT_HOMEASSISTANT_STOP,
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import dispatcher_send
Expand Down Expand Up @@ -75,7 +77,7 @@ def __init__(self, abode, polling):
self.logout_listener = None


async def async_setup_entry(hass, config_entry):
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up Abode integration from a config entry."""
username = config_entry.data.get(CONF_USERNAME)
password = config_entry.data.get(CONF_PASSWORD)
Expand Down Expand Up @@ -110,7 +112,7 @@ async def async_setup_entry(hass, config_entry):
return True


async def async_unload_entry(hass, config_entry):
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Unload a config entry."""
hass.services.async_remove(DOMAIN, SERVICE_SETTINGS)
hass.services.async_remove(DOMAIN, SERVICE_CAPTURE_IMAGE)
Expand All @@ -129,7 +131,7 @@ async def async_unload_entry(hass, config_entry):
return unload_ok


def setup_hass_services(hass):
def setup_hass_services(hass: HomeAssistant) -> None:
"""Home Assistant services."""

def change_setting(call):
Expand Down Expand Up @@ -183,7 +185,7 @@ def trigger_automation(call):
)


async def setup_hass_events(hass):
async def setup_hass_events(hass: HomeAssistant) -> None:
"""Home Assistant start and stop callbacks."""

def logout(event):
Expand All @@ -202,7 +204,7 @@ def logout(event):
)


def setup_abode_events(hass):
def setup_abode_events(hass: HomeAssistant) -> None:
"""Event callbacks."""

def event_callback(event, event_json):
Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_DISARMED,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeDevice
from .const import DOMAIN

ICON = "mdi:security"


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 Abode alarm control panel device."""
data = hass.data[DOMAIN]
async_add_entities(
Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeDevice
from .const import DOMAIN


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 Abode binary sensor devices."""
data = hass.data[DOMAIN]

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import requests

from homeassistant.components.camera import Camera
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import Throttle

from . import AbodeDevice
Expand All @@ -17,7 +20,11 @@
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=90)


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 Abode camera devices."""
data = hass.data[DOMAIN]

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
import abodepy.helpers.constants as CONST

from homeassistant.components.cover import CoverEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeDevice
from .const import DOMAIN


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 Abode cover devices."""
data = hass.data[DOMAIN]

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
SUPPORT_COLOR_TEMP,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util.color import (
color_temperature_kelvin_to_mired,
color_temperature_mired_to_kelvin,
Expand All @@ -21,7 +24,11 @@
from .const import DOMAIN


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 Abode light devices."""
data = hass.data[DOMAIN]

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
import abodepy.helpers.constants as CONST

from homeassistant.components.lock import LockEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeDevice
from .const import DOMAIN


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 Abode lock devices."""
data = hass.data[DOMAIN]

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/abode/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeDevice
from .const import DOMAIN
Expand All @@ -31,7 +34,11 @@
)


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 Abode sensor devices."""
data = hass.data[DOMAIN]

Expand Down
13 changes: 11 additions & 2 deletions homeassistant/components/abode/switch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""Support for Abode Security System switches."""
from __future__ import annotations

import abodepy.helpers.constants as CONST

from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import AbodeAutomation, AbodeDevice
from .const import DOMAIN
Expand All @@ -12,11 +17,15 @@
ICON = "mdi:robot"


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 Abode switch devices."""
data = hass.data[DOMAIN]

entities = []
entities: list[SwitchEntity] = []
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type hint is required to take into account AbodeSwitch and AbodeAutomationSwitch


for device_type in DEVICE_TYPES:
for device in data.abode.get_devices(generic_type=device_type):
Expand Down