Ensure https base_url in telegram bot (#7726)
This commit is contained in:
parent
c556b619b7
commit
228fb8c072
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
_LOGGER.debug("telegram webhook Status: %s", current_status)
|
_LOGGER.debug("telegram webhook Status: %s", current_status)
|
||||||
handler_url = '{0}{1}'.format(hass.config.api.base_url,
|
handler_url = '{0}{1}'.format(hass.config.api.base_url,
|
||||||
TELEGRAM_HANDLER_URL)
|
TELEGRAM_HANDLER_URL)
|
||||||
|
if not handler_url.startswith('https'):
|
||||||
|
_LOGGER.error("Invalid telegram webhook %s must be https", handler_url)
|
||||||
|
return False
|
||||||
|
|
||||||
if current_status and current_status['url'] != handler_url:
|
if current_status and current_status['url'] != handler_url:
|
||||||
result = yield from hass.async_add_job(bot.setWebhook, handler_url)
|
result = yield from hass.async_add_job(bot.setWebhook, handler_url)
|
||||||
if result:
|
if result:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue