I’ve just tried to configure the new telegram bot component (polling) on two different hass instances, and on both its not working.
I’m using Docker on both systems, the notify component is working fine.
Maybe I do have a configuration issue?
As said, the telegram notify component (notify.telegrambot_matthias) works fine as expected.
The HASS logs don’t tell me any error message, even if i set logging for the bot component to the debug level.
I made the same changes and also still have no reaction from HASS on my commands. (Notifications are working fine)
What is the polling interval ?
How can I help to debug this further ?
Thanks for you help. My configuration is very similar. But I see no reaction in the log on the commandline after I post a command like /start in the chat with my bot. (I see a lot of other events. Also no network activity to api.telegram-org after the initial start of HASS.
I see two standig connection to Telegram:
python.exe 1700 TCP z83 55676 149.154.167.199 https ESTABLISHED
python.exe 1700 TCP z83 56748 149.154.167.199 https ESTABLISHED
So my question remains: If this is polling Telegram, how often that should happen ?
I revoked the API key an use now a new one. Notifications work fine, but I found that in the log during stop of HASS: e[31m17-04-23 20:23:15 ERROR (Dummy-3) [homeassistant.core] Error doing job: Task exception was never retrievede[0m Traceback (most recent call last): File "C:\Users\ABC\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\telegram_bot\polling.py", line 119, in check_incoming yield from self.handle() File "C:\Users\ABC\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\telegram_bot\polling.py", line 108, in handle self.process_message(update) File "C:\Users\ABC\AppData\Local\Programs\Python\Python36\lib\site-packages\homeassistant\components\telegram_bot\__init__.py", line 118, in process_message ATTR_FROM_LAST: data['from']['last_name']} KeyError: 'last_name'e[0m Exception ignored in: <bound method _ProactorBasePipeTransport.__del__ of <_ProactorSocketTransport closing fd=-1 read=<_OverlappedFuture cancelled>>>
My Telegram Account that I used to send messages to the bot has NO last name. I now set one and send a new command. But the error persists since in getUpdates are also old messages without a last name set. So I wait 24h and wait I without old messages it works.
The telegram polling implementation uses long polling with a timeout of 10 seconds. As soon as a message is sent the update method should return with the message, basically. As soon as the 10 second timeout is passed without incoming message or after a message another long polling is done.
Edit: The KeyError is a bug and should be fixed, please create an issue on github, with the stack trace. We should handle cases without last name.
Same here. I can’t see any incoming messages as events logged by hass. The only thing I can see in the logs is the initialization of the telegram_bot polling component.
I can confirm that once receiving a message from a user breaks the polling and HASS must be restarted. No message should be waiting in the queue with that same problem. Wait 24h or delete messages with calling /getUpdates?offset=higher number than last update message ID
Can you fix this issue in next release ? Perhaps check all fields (like missing first name …)
I just updated to 0.43.1 and its working now on both of my HASS instances. Great!
But I also found a way to break it again: at the moment, as CamFlyerCH already said, the meta fields like First Name and Last Name are currently not being checked for content. So if I remove my Last Name in the telegram settings, this breaks HASS.
So a simple “if” should fix this
I’m on 0.43.2 telegram webhook does not work. this is the error I get
17-04-28 22:57:57 ERROR (MainThread) [homeassistant.components.telegram_bot] Incoming message does not have required data.
17-04-28 22:57:57 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "C:\Users\mohammed\AppData\Roaming\.homeassistant\deps\aiohttp\web_protocol.py", line 417, in start
resp = yield from self._request_handler(request)
File "C:\Users\mohammed\AppData\Roaming\.homeassistant\deps\aiohttp\web.py", line 289, in _handle
resp = yield from handler(request)
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\asyncio\coroutines.py", line 209, in coro
res = yield from res
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\asyncio\coroutines.py", line 209, in coro
res = yield from res
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\http\ban.py", line 58, in ban_middleware_handler
return (yield from handler(request))
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\http\__init__.py", line 425, in handle
result = yield from result
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\telegram_bot\webhooks.py", line 95, in post
if not self.process_message(data):
File "C:\Users\mohammed\AppData\Local\Programs\Python\Python35\lib\site-packages\homeassistant\components\telegram_bot\__init__.py", line 116, in process_message
ATTR_FROM_LAST: data['from']['last_name']}
KeyError: 'last_name'
Same here, I manually applied the changes from the fix but polling isnt working after some time. No logs even if i set the telegram_bot component to debug or info. Telegram notification is still working though. My sender has first and last name so Im not sure if this is a different issue.