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: >-
<a href="https://www.home-assistant.io/">HA site</a>
data:
parse_mode: html
disable_web_page_preview: true
```
* Update homeassistant/components/telegram/notify.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update notify.py
* Update notify.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user