1
mirror of https://github.com/home-assistant/core synced 2024-07-18 12:02:20 +02:00

Add timeout attribute for send files (#31379)

* Add timeout attribute for send files

* Remove dublicate

Remove attribute dublicate in BASE_SERVICE_SCHEMA

* Remove duplicate

return attribute to BASE_SERVICE_SCHEMA and remove from SERVICE_SCHEMA_SEND_FILE

* Add timeout parameter description

Add timeout parameter description for "send message" and "send location"
This commit is contained in:
Konsts 2020-02-03 22:23:58 +02:00 committed by GitHub
parent 4550968316
commit 114d48ed8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -25,7 +25,6 @@ from homeassistant.const import (
ATTR_LONGITUDE,
CONF_API_KEY,
CONF_PLATFORM,
CONF_TIMEOUT,
CONF_URL,
HTTP_DIGEST_AUTHENTICATION,
)
@ -67,6 +66,7 @@ ATTR_URL = "url"
ATTR_USER_ID = "user_id"
ATTR_USERNAME = "username"
ATTR_VERIFY_SSL = "verify_ssl"
ATTR_TIMEOUT = "timeout"
CONF_ALLOWED_CHAT_IDS = "allowed_chat_ids"
CONF_PROXY_URL = "proxy_url"
@ -135,7 +135,7 @@ BASE_SERVICE_SCHEMA = vol.Schema(
vol.Optional(ATTR_DISABLE_WEB_PREV): cv.boolean,
vol.Optional(ATTR_KEYBOARD): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(ATTR_KEYBOARD_INLINE): cv.ensure_list,
vol.Optional(CONF_TIMEOUT): vol.Coerce(float),
vol.Optional(ATTR_TIMEOUT): cv.positive_int,
},
extra=vol.ALLOW_EXTRA,
)
@ -499,15 +499,15 @@ class TelegramNotificationService:
ATTR_DISABLE_WEB_PREV: None,
ATTR_REPLY_TO_MSGID: None,
ATTR_REPLYMARKUP: None,
CONF_TIMEOUT: None,
ATTR_TIMEOUT: None,
}
if data is not None:
if ATTR_PARSER in data:
params[ATTR_PARSER] = self._parsers.get(
data[ATTR_PARSER], self._parse_mode
)
if CONF_TIMEOUT in data:
params[CONF_TIMEOUT] = data[CONF_TIMEOUT]
if ATTR_TIMEOUT in data:
params[ATTR_TIMEOUT] = data[ATTR_TIMEOUT]
if ATTR_DISABLE_NOTIF in data:
params[ATTR_DISABLE_NOTIF] = data[ATTR_DISABLE_NOTIF]
if ATTR_DISABLE_WEB_PREV in data:

View File

@ -21,6 +21,9 @@ send_message:
disable_web_page_preview:
description: Disables link previews for links in the message.
example: true
timeout:
description: Timeout for send message. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard. Empty list clears a previously set keyboard.
example: '["/command1, /command2", "/command3"]'
@ -55,6 +58,9 @@ send_photo:
verify_ssl:
description: Enable or disable SSL certificate verification. Set to false if you're downloading the file from a URL and you don't want to validate the SSL certificate of the server.
example: false
timeout:
description: Timeout for send photo. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'
@ -86,6 +92,9 @@ send_sticker:
verify_ssl:
description: Enable or disable SSL certificate verification. Set to false if you're downloading the file from a URL and you don't want to validate the SSL certificate of the server.
example: false
timeout:
description: Timeout for send sticker. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'
@ -120,6 +129,9 @@ send_video:
verify_ssl:
description: Enable or disable SSL certificate verification. Set to false if you're downloading the file from a URL and you don't want to validate the SSL certificate of the server.
example: false
timeout:
description: Timeout for send video. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'
@ -154,6 +166,9 @@ send_document:
verify_ssl:
description: Enable or disable SSL certificate verification. Set to false if you're downloading the file from a URL and you don't want to validate the SSL certificate of the server.
example: false
timeout:
description: Timeout for send document. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'
@ -176,6 +191,9 @@ send_location:
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
example: true
timeout:
description: Timeout for send photo. Will help with timeout errors (poor internet connection, etc)
example: '1000'
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'