Telegram_bot three platform support proxy_url and proxy_params (#12878)

* telegram_bot three platform support proxy_url and proxy_params

* add telegram_bot._initialize_bot to create the bot instance

* rename _initialize_bot to initialize_bot
This commit is contained in:
ruohan.chen authored and Pascal Vizeli committed 2018-03-07 12:44:07 +01:00
1 parent d119610cf1
commit 35bae1eef2
4 files changed
+32 -22

No files matched your search

@@ -8,8 +8,8 @@ import asyncio
import logging
from homeassistant.components.telegram_bot import (
initialize_bot,
PLATFORM_SCHEMA as TELEGRAM_PLATFORM_SCHEMA)
from homeassistant.const import CONF_API_KEY
_LOGGER = logging.getLogger(__name__)
@@ -20,8 +20,9 @@ PLATFORM_SCHEMA = TELEGRAM_PLATFORM_SCHEMA
def async_setup_platform(hass, config):
"""Set up the Telegram broadcast platform."""
# Check the API key works
import telegram
bot = telegram.Bot(config[CONF_API_KEY])
bot = initialize_bot(config)
bot_config = yield from hass.async_add_job(bot.getMe)
_LOGGER.debug("Telegram broadcast platform setup with bot %s",
bot_config['username'])