Add hints to get_service in syslog (#86701)
parent
ca8cc284ed
commit
b9ffc67a44
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue