From 96fde69d5dd55a792db9fff8d7333ad2f0664f85 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 2 Feb 2023 16:21:19 +0000 Subject: [PATCH] Improve type hints in onvif --- homeassistant/components/onvif/config_flow.py | 4 ++-- homeassistant/components/onvif/device.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/onvif/config_flow.py b/homeassistant/components/onvif/config_flow.py index b4227b0cfa3114..dadd1b2cd9fa7f 100644 --- a/homeassistant/components/onvif/config_flow.py +++ b/homeassistant/components/onvif/config_flow.py @@ -26,7 +26,7 @@ CONF_PORT, CONF_USERNAME, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from .const import CONF_DEVICE_ID, DEFAULT_ARGUMENTS, DEFAULT_PORT, DOMAIN, LOGGER from .device import get_device @@ -45,7 +45,7 @@ def wsdiscovery() -> list[Service]: return services -async def async_discovery(hass) -> list[dict[str, Any]]: +async def async_discovery(hass: HomeAssistant) -> list[dict[str, Any]]: """Return if there are devices that can be discovered.""" LOGGER.debug("Starting ONVIF discovery") services = await hass.async_add_executor_job(wsdiscovery) diff --git a/homeassistant/components/onvif/device.py b/homeassistant/components/onvif/device.py index 3d74f1e46643c5..1556ae8a1fe8e9 100644 --- a/homeassistant/components/onvif/device.py +++ b/homeassistant/components/onvif/device.py @@ -561,7 +561,13 @@ async def async_set_imaging_settings( LOGGER.error("Error trying to set Imaging settings: %s", err) -def get_device(hass, host, port, username, password) -> ONVIFCamera: +def get_device( + hass: HomeAssistant, + host: str, + port: int, + username: str | None, + password: str | None, +) -> ONVIFCamera: """Get ONVIFCamera instance.""" return ONVIFCamera( host,