mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +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:
parent
4550968316
commit
114d48ed8b
@ -25,7 +25,6 @@ from homeassistant.const import (
|
|||||||
ATTR_LONGITUDE,
|
ATTR_LONGITUDE,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_PLATFORM,
|
CONF_PLATFORM,
|
||||||
CONF_TIMEOUT,
|
|
||||||
CONF_URL,
|
CONF_URL,
|
||||||
HTTP_DIGEST_AUTHENTICATION,
|
HTTP_DIGEST_AUTHENTICATION,
|
||||||
)
|
)
|
||||||
@ -67,6 +66,7 @@ ATTR_URL = "url"
|
|||||||
ATTR_USER_ID = "user_id"
|
ATTR_USER_ID = "user_id"
|
||||||
ATTR_USERNAME = "username"
|
ATTR_USERNAME = "username"
|
||||||
ATTR_VERIFY_SSL = "verify_ssl"
|
ATTR_VERIFY_SSL = "verify_ssl"
|
||||||
|
ATTR_TIMEOUT = "timeout"
|
||||||
|
|
||||||
CONF_ALLOWED_CHAT_IDS = "allowed_chat_ids"
|
CONF_ALLOWED_CHAT_IDS = "allowed_chat_ids"
|
||||||
CONF_PROXY_URL = "proxy_url"
|
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_DISABLE_WEB_PREV): cv.boolean,
|
||||||
vol.Optional(ATTR_KEYBOARD): vol.All(cv.ensure_list, [cv.string]),
|
vol.Optional(ATTR_KEYBOARD): vol.All(cv.ensure_list, [cv.string]),
|
||||||
vol.Optional(ATTR_KEYBOARD_INLINE): cv.ensure_list,
|
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,
|
extra=vol.ALLOW_EXTRA,
|
||||||
)
|
)
|
||||||
@ -499,15 +499,15 @@ class TelegramNotificationService:
|
|||||||
ATTR_DISABLE_WEB_PREV: None,
|
ATTR_DISABLE_WEB_PREV: None,
|
||||||
ATTR_REPLY_TO_MSGID: None,
|
ATTR_REPLY_TO_MSGID: None,
|
||||||
ATTR_REPLYMARKUP: None,
|
ATTR_REPLYMARKUP: None,
|
||||||
CONF_TIMEOUT: None,
|
ATTR_TIMEOUT: None,
|
||||||
}
|
}
|
||||||
if data is not None:
|
if data is not None:
|
||||||
if ATTR_PARSER in data:
|
if ATTR_PARSER in data:
|
||||||
params[ATTR_PARSER] = self._parsers.get(
|
params[ATTR_PARSER] = self._parsers.get(
|
||||||
data[ATTR_PARSER], self._parse_mode
|
data[ATTR_PARSER], self._parse_mode
|
||||||
)
|
)
|
||||||
if CONF_TIMEOUT in data:
|
if ATTR_TIMEOUT in data:
|
||||||
params[CONF_TIMEOUT] = data[CONF_TIMEOUT]
|
params[ATTR_TIMEOUT] = data[ATTR_TIMEOUT]
|
||||||
if ATTR_DISABLE_NOTIF in data:
|
if ATTR_DISABLE_NOTIF in data:
|
||||||
params[ATTR_DISABLE_NOTIF] = data[ATTR_DISABLE_NOTIF]
|
params[ATTR_DISABLE_NOTIF] = data[ATTR_DISABLE_NOTIF]
|
||||||
if ATTR_DISABLE_WEB_PREV in data:
|
if ATTR_DISABLE_WEB_PREV in data:
|
||||||
|
@ -21,6 +21,9 @@ send_message:
|
|||||||
disable_web_page_preview:
|
disable_web_page_preview:
|
||||||
description: Disables link previews for links in the message.
|
description: Disables link previews for links in the message.
|
||||||
example: true
|
example: true
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send message. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard. Empty list clears a previously set 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"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
@ -55,6 +58,9 @@ send_photo:
|
|||||||
verify_ssl:
|
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.
|
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
|
example: false
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send photo. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||||
example: '["/command1, /command2", "/command3"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
@ -86,6 +92,9 @@ send_sticker:
|
|||||||
verify_ssl:
|
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.
|
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
|
example: false
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send sticker. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||||
example: '["/command1, /command2", "/command3"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
@ -120,6 +129,9 @@ send_video:
|
|||||||
verify_ssl:
|
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.
|
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
|
example: false
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send video. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||||
example: '["/command1, /command2", "/command3"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
@ -154,6 +166,9 @@ send_document:
|
|||||||
verify_ssl:
|
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.
|
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
|
example: false
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send document. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||||
example: '["/command1, /command2", "/command3"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
@ -176,6 +191,9 @@ send_location:
|
|||||||
disable_notification:
|
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.
|
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
|
example: true
|
||||||
|
timeout:
|
||||||
|
description: Timeout for send photo. Will help with timeout errors (poor internet connection, etc)
|
||||||
|
example: '1000'
|
||||||
keyboard:
|
keyboard:
|
||||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||||
example: '["/command1, /command2", "/command3"]'
|
example: '["/command1, /command2", "/command3"]'
|
||||||
|
Loading…
Reference in New Issue
Block a user