Hi Hass’s friends, I’ve been trying telegram polling for several days, but I do not want to go … I do not know what to do for you to ask for help … here is my configuration.yaml, Id and Api keys are correct.
In check validate, if checked ok but in home assistant log:
indent preformatted text by 4 spaces
2017-11-16 21:37:35 ERROR (MainThread) [homeassistant.components.telegram_bot] Error setting up platform polling
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/telegram_bot/init.py”, line 232, in async_setup
platform.async_setup_platform(hass, p_config)
File “/usr/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/telegram_bot/polling.py”, line 31, in async_setup_platform
bot = telegram.Bot(config[CONF_API_KEY])
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/telegram/bot.py”, line 105, in init
self.token = self._validate_token(token)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/telegram/bot.py”, line 131, in _validate_token
raise InvalidToken()
telegram.error.InvalidToken: Invalid token
2017-11-16 21:37:35 ERROR (MainThread) [homeassistant.setup] Setup failed for telegram_bot: Component failed to initialize.
2017-11-16 21:37:35 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of notify.telegram. Setup failed for dependencies: telegram_bot
2017-11-16 21:37:35 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform notify.telegram: Could not setup all dependencies.
2017-11-16 21:37:35 ERROR (MainThread) [homeassistant.components.notify] Unknown notification service specified
2017-11-16 21:37:36 ERROR (Thread-14) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/known_devices.yaml contains duplicate key “icon”. Check lines 132 and 136.
2017-11-16 21:37:45 WARNING (MainThread) [homeassistant.setup] Setup of device_tracker is taking over 10 seconds.
2017-11-16 21:40:19 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from nmap_tracker took longer than the scheduled scan interval 0:00:10
2017-11-16 21:42:09 WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from nmap_tracker took longer than the scheduled scan interval 0:00:10
Try comment out api_key from notify. Also you shouldn’t post your api key with you chat id… you might find strange messages turning up in the middle of the night
Your api key is wrong. There are meant to be more numbers in front of it. It should be something like api_key: xxxxxxxx:AAHna1pbqlt2VplTgrrYlyQCf4Eb_VV4zuU
However, telegram fails to initialize and I’m seeing this in the log…
INFO (MainThread) [homeassistant.loader] Loaded notify.telegram from homeassistant.components.notify.telegram
INFO (MainThread) [homeassistant.loader] Loaded telegram_bot from homeassistant.components.telegram_bot
INFO (MainThread) [homeassistant.loader] Loaded telegram_bot.polling from homeassistant.components.telegram_bot.polling
INFO (MainThread) [homeassistant.setup] Setting up telegram_bot
INFO (MainThread) [homeassistant.components.telegram_bot] Setting up telegram_bot.polling
ERROR (MainThread) [homeassistant.components.telegram_bot] Error setting up platform polling
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/telegram_bot/__init__.py", line 234, in async_setup
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/telegram_bot/polling.py", line 38, in async_setup_platform
import telegram
File "/Users/broox/.homeassistant/deps/lib/python/site-packages/telegram/__init__.py", line 45, in <module>
File "/Users/broox/.homeassistant/deps/lib/python/site-packages/telegram/files/file.py", line 22, in <module>
INFO (MainThread) [homeassistant.setup] Setup of domain telegram_bot took 7.9 seconds.
ERROR (MainThread) [homeassistant.setup] Setup failed for telegram_bot: Component failed to initialize.
- [telegram-bot](https://home-assistant.io/components/telegram_bot/)
- [telegram-bot](https://home-assistant.io/components/telegram_bot/)
ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of notify.telegram. Setup failed for dependencies: telegram_bot
ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform notify.telegram: Could not setup all dependencies.
- [telegram-bot](https://home-assistant.io/components/telegram_bot/)
- notify.telegram
- [telegram-bot](https://home-assistant.io/components/telegram_bot/)
- [telegram-bot](https://home-assistant.io/components/telegram_bot/)
- notify.telegram
The issue with mine was that I had a test.py file in my .homeassistant directory that had a syntax error in it… Apparently telegram loads up every file in your home-assistant directory and if anything in there has errors, it will blow up the telegram initialization.
Thank you SO much for posting your solution, @broox! I just ran into the same problem after Telegram had been working flawlessly for a long while. Out of nowhere, a restart of hassio produced these failure errors.
The problem for me ended up being that I needed some extra things quoted in my customize-glob.yaml file. The crazy part is that the configuration validation said all was well with no errors in the log. I guess the Telegram component is rather touchy, like you said.