diff --git a/homeassistant/components/syslog/notify.py b/homeassistant/components/syslog/notify.py index 5a5bac002e4..d4772e95259 100644 --- a/homeassistant/components/syslog/notify.py +++ b/homeassistant/components/syslog/notify.py @@ -1,4 +1,6 @@ """Syslog notification service.""" +from __future__ import annotations + import syslog import voluptuous as vol @@ -9,6 +11,8 @@ from homeassistant.components.notify import ( PLATFORM_SCHEMA, BaseNotificationService, ) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType CONF_FACILITY = "facility" CONF_OPTION = "option" @@ -63,12 +67,16 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -def get_service(hass, config, discovery_info=None): +def get_service( + hass: HomeAssistant, + config: ConfigType, + discovery_info: DiscoveryInfoType | None = None, +) -> SyslogNotificationService: """Get the syslog notification service.""" - facility = getattr(syslog, SYSLOG_FACILITY[config.get(CONF_FACILITY)]) - option = getattr(syslog, SYSLOG_OPTION[config.get(CONF_OPTION)]) - priority = getattr(syslog, SYSLOG_PRIORITY[config.get(CONF_PRIORITY)]) + facility = getattr(syslog, SYSLOG_FACILITY[config[CONF_FACILITY]]) + option = getattr(syslog, SYSLOG_OPTION[config[CONF_OPTION]]) + priority = getattr(syslog, SYSLOG_PRIORITY[config[CONF_PRIORITY]]) return SyslogNotificationService(facility, option, priority)