Telegram Bot enhancements with callback queries and new notification services (#7454)
* telegram_bot and notify.telegram enhancements: - Receive callback queries and produce `telegram_callback` events. - Custom reply_markup (keyboard or inline_keyboard) for every type of message (message, photo, location & document). - `disable_notification`, `disable_web_page_preview`, `reply_to_message_id` and `parse_mode` optional keyword args. - Line break between title and message fields: `'{}\n{}'.format(title, message)` - Move Telegram notification services to `telegram_bot` component and forward service calls from the telegram notify service to the telegram component, so now the `notify.telegram` platform depends of `telegram_bot`, and there is no need for `api_key` in the notifier configuration. The notifier calls the new notification services of the bot component: - telegram_bot/send_message - telegram_bot/send_photo - telegram_bot/send_document - telegram_bot/send_location - telegram_bot/edit_message - telegram_bot/edit_caption - telegram_bot/edit_replymarkup - telegram_bot/answer_callback_query - Added descriptions of the new notification services with a services.yaml file. - CONFIG_SCHEMA instead of PLATFORM_SCHEMA for the `telegram_bot` component, so only one platform is allowed. - Async component setup. * telegram_bot and notify.telegram enhancements: change in requirements_all.txt.
This commit is contained in:
parent
1312ee0f7d
commit
b30c352e37
6 changed files with 763 additions and 242 deletions
|
@ -11,19 +11,15 @@ import logging
|
|||
import async_timeout
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
|
||||
from homeassistant.components.telegram_bot import CONF_ALLOWED_CHAT_IDS, \
|
||||
BaseTelegramBotEntity, PLATFORM_SCHEMA
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, \
|
||||
EVENT_HOMEASSISTANT_STOP, CONF_API_KEY
|
||||
from homeassistant.components.telegram_bot import (
|
||||
CONF_ALLOWED_CHAT_IDS, BaseTelegramBotEntity)
|
||||
from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, CONF_API_KEY)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
REQUIREMENTS = ['python-telegram-bot==5.3.1']
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue