Home Assistant release with the issue:
0.81.2
Last working Home Assistant release (if known):
0.76.2
Operating environment (Hass.io/Docker/Windows/etc.):
Ubuntu 16.04
Component/platform:
Telegram
Description of problem:
After update to the 0.81.2 I have noticed so many request to api.telegram.org using PiHole. In last 24 hours it made about 33718 requests. This is happening since the update to 0.81.2.
Here is the screenshot from PiHole.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
Traceback (if applicable):
Additional information:
Same for me, lots of requests, HA version 0.81.1 installed in an Ubuntu 16.04 box with virtualenv. I just install PIHole a couple of days ago, so i'm not sure if the situation was happening before.
31512 hits in the last 24h.
Same for me, lots of requests, Home Assistant 0.82.1 installed in an raspberry.
Me too. I have a query to api.telegram.org every 5/6 seconds.
Home Assistant 0.83.3 on docker rpi.
Same. Running Home Assistant 0.84.2 on rpi.
FYI: As a temporary workaround I resolved api.telegram.org manually and put the IP address in the /etc/hosts file on the raspberry. So Home Assistant never asks the pi-hole and the stats there look fine now.
Same here. Seeing a massive calls in PiHole:

The problem is not with the DNS, but with the logic itself, why calling so many times to the API?
This is on 0.86.3
Same problem here.
Using HA 0.90.2 on RPI Docker Hypriot OS
IPV 6 DS Lite Connection Provider
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Did anyone figure out how to do the /etc/hosts workaround on a hassio setup? I'm running raspbian + hassio in docker.
Answering my own question. The /etc/hosts that matters is in the homeassistant container.
In my case i figured out, that the dns blocker dns guard / pihole is responsible in combination with the ipv6 settings by the router.
The only solution is, remove the ipv6 dns setting in your router, reboot the router and the homeassisant. Sometimes the homeassistant needs several restart until the error has gone, this is not valid but it works for me. After that, you can activate the ipv6 setting in your router again, but only for some days, then the error is back. :(
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
No news? I don't understand what IP I suppose to put in the hosts file. I have thousands of requests so the pihole log is pretty much useless...
EDIT: sorry, my bad... I forgot that I had "polling" as platform for the telegram_bot. Since I use telegram only in outgoing direction, I changed to "broadcast" and solved the problem!
I'm suffering from the same issue. I tried to troubleshoot the problem but I was unsuccessful so far.
Home Assistant uses the library "python-telegram-bot" which is a wrapper for the Telegram API. When in polling mode, the following code will be executed:
By default updater.start_polling uses long polling requests with a 10 second timeout. But according to my DNS logs api.telegram.org is requested every 5 seconds. That doesn't necessarily mean that the API will actually be queried every 5 seconds. However it's definitely an odd behavior.
I tried to raise the timeout to 60 seconds but Home Assistant will still ask for api.telegram.org every 5 seconds. This is my code:
self.updater.start_polling(timeout=60)
I'll try to do more research if I have the time.
Same problem here.... my pihole is very busy doing all dns requests for api.telegram.org
Answering my own question. The /etc/hosts that matters is in the homeassistant container.
But it also seems it's copying automatically hosts file into the homeassistant docker container... on booting up or by home assistant supervisor?
Have the same problem since yesterday
No news? I don't understand what IP I suppose to put in the hosts file. I have thousands of requests so the pihole log is pretty much useless...
EDIT: sorry, my bad... I forgot that I had "polling" as platform for the telegram_bot. Since I use telegram only in outgoing direction, I changed to "broadcast" and solved the problem!
Yes, this solved my issue too.
the root cause of that could be the bi-directional communication in combination of my ds-lite ipv6 connection. may.. he try to etsablisch a connection over and over again and got no valid answer.
So the uni-directional communication over "broadcast" is fine for my usecase.
Best Regards.
Hi!
To add more information to the threat
I receive a lot of entries in the DNS like this.
Time | Type | Domain | Client | Status | Reply | Action
-- | -- | -- | -- | -- | -- | --
2020-03-06聽09:47:10 | AAAA | api.telegram.org | 192.168.XX.XX | OK聽(cached) | IP (0.1ms) | Blacklist
2020-03-06聽09:47:10 | A | api.telegram.org | 192.168.XX.XX | OK聽(cached) | IP (0.2ms) | Blacklist
I try the DNS trick, but after reboot it disapear the entry.
I change the platform configuration on configuration.yaml from polling to broadcast and the queries to DNS finish inmediatelly.
Check here.
https://www.home-assistant.io/integrations/telegram_broadcast/
telegram_bot:
Hope it help.
Dani.
@NullEnt1ty in the python-telegram-bot python library v11 is completely broken long polling.
All requests are interrupted with a global timeout of 5 seconds.
Fix in one line, but they do not want to do it.
In the 12th version of the library this is fixed.
But they changed the API, which requires a careful update of the HA component.
This problem is more than 1.5 years.
+1 with the same problem.
Lots of connection on AdguardHome (source is home assistant container).
I think I will add it to hosts files.
+1 with the same problem.
Lots of connection on AdguardHome (source is home assistant container).I think I will add it to hosts files.
I try the DNS trick, but after reboot it disapear the entry.
Try this ...
I change the platform configuration on configuration.yaml from polling to broadcast and the queries to DNS finish inmediatelly.
Check here.
https://www.home-assistant.io/integrations/telegram_broadcast/
Dani.
I change the platform configuration on configuration.yaml from polling to broadcast and the queries to DNS finish inmediatelly.
Keep in mind that this is only an option if you don't want to send message to your bot.
I change the platform configuration on configuration.yaml from polling to broadcast and the queries to DNS finish inmediatelly.
Keep in mind that this is only an option if you don't want to send message to your bot.
Not sure what you mean ... I still receive all notifications without any difference and any other change to my configuration, so ... I suppose my bot is still receiving my messages.
Dani.
Not sure what you mean ... I still receive all notifications without any difference and any other change to my configuration, so ... I suppose my bot is still receiving my messages.
Oh, really? That's quite surprising to me as the documentation for _telegram_broadcast_ states:
Telegram implementation to support sending messages only. Your Home Assistant instance does not have to be exposed to the Internet and there is no polling to receive messages sent to the bot.
Not sure what's going on there 馃槃
Hi
My DNS entry is persistent, and for now that solves the dns requests.
I cannot change to broadcast, as I use my bot bi-directional.
I receive messages from HA but I also send actions to the bot, so HA replies.
Thanks
Broadcast does not use polling.
If you only need to send messages from HA to Telegram - broadcast is best option without this problem.
But if you need send messages from Telegram to HA - you need polling or webhooks.
Broadcast does not use polling.
If you only need to send messages from HA to Telegram - broadcast is best option without this problem.
But if you need send messages from Telegram to HA - you need polling or webhooks.
That's exactly what I do.
My bot responds to commands like /photo, /temp, /speak ... that I can use tho send commands to HA.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
No news? I don't understand what IP I suppose to put in the hosts file. I have thousands of requests so the pihole log is pretty much useless...
EDIT: sorry, my bad... I forgot that I had "polling" as platform for the telegram_bot. Since I use telegram only in outgoing direction, I changed to "broadcast" and solved the problem!