mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Add telegram message_tag, disable_notification, parse_mode (#63604)
Co-authored-by: root <zvldz@users.noreply.github.com>
This commit is contained in:
parent
79d267f8d7
commit
8c69194695
@ -11,6 +11,11 @@ from homeassistant.components.notify import (
|
|||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.telegram_bot import (
|
||||||
|
ATTR_DISABLE_NOTIF,
|
||||||
|
ATTR_MESSAGE_TAG,
|
||||||
|
ATTR_PARSER,
|
||||||
|
)
|
||||||
from homeassistant.const import ATTR_LOCATION
|
from homeassistant.const import ATTR_LOCATION
|
||||||
from homeassistant.helpers.reload import setup_reload_service
|
from homeassistant.helpers.reload import setup_reload_service
|
||||||
|
|
||||||
@ -56,6 +61,21 @@ class TelegramNotificationService(BaseNotificationService):
|
|||||||
service_data.update({ATTR_MESSAGE: message})
|
service_data.update({ATTR_MESSAGE: message})
|
||||||
data = kwargs.get(ATTR_DATA)
|
data = kwargs.get(ATTR_DATA)
|
||||||
|
|
||||||
|
# Set message tag
|
||||||
|
if data is not None and ATTR_MESSAGE_TAG in data:
|
||||||
|
message_tag = data.get(ATTR_MESSAGE_TAG)
|
||||||
|
service_data.update({ATTR_MESSAGE_TAG: message_tag})
|
||||||
|
|
||||||
|
# Set disable_notification
|
||||||
|
if data is not None and ATTR_DISABLE_NOTIF in data:
|
||||||
|
disable_notification = data.get(ATTR_DISABLE_NOTIF)
|
||||||
|
service_data.update({ATTR_DISABLE_NOTIF: disable_notification})
|
||||||
|
|
||||||
|
# Set parse_mode
|
||||||
|
if data is not None and ATTR_PARSER in data:
|
||||||
|
parse_mode = data.get(ATTR_PARSER)
|
||||||
|
service_data.update({ATTR_PARSER: parse_mode})
|
||||||
|
|
||||||
# Get keyboard info
|
# Get keyboard info
|
||||||
if data is not None and ATTR_KEYBOARD in data:
|
if data is not None and ATTR_KEYBOARD in data:
|
||||||
keys = data.get(ATTR_KEYBOARD)
|
keys = data.get(ATTR_KEYBOARD)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user