mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Add hints to get_service in syslog (#86701)
This commit is contained in:
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…
x
Reference in New Issue
Block a user