Skip to content
Merged
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/unifi/services.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""UniFi Network services."""
from collections.abc import Mapping
from typing import Any

from aiounifi.models.client import ClientReconnectRequest, ClientRemoveRequest
import voluptuous as vol

from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.core import ServiceCall, callback
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC

Expand All @@ -25,7 +27,7 @@


@callback
def async_setup_services(hass) -> None:
def async_setup_services(hass: HomeAssistant) -> None:
"""Set up services for UniFi integration."""

services = {
Expand All @@ -47,13 +49,13 @@ async def async_call_unifi_service(service_call: ServiceCall) -> None:


@callback
def async_unload_services(hass) -> None:
def async_unload_services(hass: HomeAssistant) -> None:
"""Unload UniFi Network services."""
for service in SUPPORTED_SERVICES:
hass.services.async_remove(UNIFI_DOMAIN, service)


async def async_reconnect_client(hass, data) -> None:
async def async_reconnect_client(hass: HomeAssistant, data: Mapping[str, Any]) -> None:
"""Try to get wireless client to reconnect to Wi-Fi."""
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get(data[ATTR_DEVICE_ID])
Expand Down Expand Up @@ -81,7 +83,7 @@ async def async_reconnect_client(hass, data) -> None:
await controller.api.request(ClientReconnectRequest.create(mac))


async def async_remove_clients(hass, data) -> None:
async def async_remove_clients(hass: HomeAssistant, data: Mapping[str, Any]) -> None:
"""Remove select clients from controller.

Validates based on:
Expand Down