From 9327947332f5271dcf485781e747cdfb26a7b73f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 2 Feb 2023 22:25:43 +0100 Subject: [PATCH] Improve type hints in onvif (#87184) --- 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 5eef092a5cb..d9cf28f3e8b 100644 --- a/homeassistant/components/onvif/config_flow.py +++ b/homeassistant/components/onvif/config_flow.py @@ -26,7 +26,7 @@ from homeassistant.const import ( 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 3d74f1e4664..1556ae8a1fe 100644 --- a/homeassistant/components/onvif/device.py +++ b/homeassistant/components/onvif/device.py @@ -561,7 +561,13 @@ class ONVIFDevice: 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,