From faf25b2235cabea7ceeb94908f94949dc20c1806 Mon Sep 17 00:00:00 2001
From: ildar170975 <71872483+ildar170975@users.noreply.github.com>
Date: Sat, 30 Jul 2022 15:06:55 +0300
Subject: [PATCH] Add telegram disable_web_page_preview (#75898)
* Add telegram disable_web_page_preview
Adds ability to specify disable_web_page_preview to telegram.notify:
```
- service: notify.telegram
data:
message: >-
HA site
data:
parse_mode: html
disable_web_page_preview: true
```
* Update homeassistant/components/telegram/notify.py
Co-authored-by: Martin Hjelmare
* Update notify.py
* Update notify.py
Co-authored-by: Martin Hjelmare
---
homeassistant/components/telegram/notify.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/homeassistant/components/telegram/notify.py b/homeassistant/components/telegram/notify.py
index b87ddc670c3..bca48e4b85a 100644
--- a/homeassistant/components/telegram/notify.py
+++ b/homeassistant/components/telegram/notify.py
@@ -13,6 +13,7 @@ from homeassistant.components.notify import (
)
from homeassistant.components.telegram_bot import (
ATTR_DISABLE_NOTIF,
+ ATTR_DISABLE_WEB_PREV,
ATTR_MESSAGE_TAG,
ATTR_PARSER,
)
@@ -76,6 +77,11 @@ class TelegramNotificationService(BaseNotificationService):
parse_mode = data.get(ATTR_PARSER)
service_data.update({ATTR_PARSER: parse_mode})
+ # Set disable_web_page_preview
+ if data is not None and ATTR_DISABLE_WEB_PREV in data:
+ disable_web_page_preview = data[ATTR_DISABLE_WEB_PREV]
+ service_data.update({ATTR_DISABLE_WEB_PREV: disable_web_page_preview})
+
# Get keyboard info
if data is not None and ATTR_KEYBOARD in data:
keys = data.get(ATTR_KEYBOARD)