Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram notifications flood the log file with error 409 #8183

Closed
kirichkov opened this issue Jun 24, 2017 · 4 comments · Fixed by #8186
Closed

Telegram notifications flood the log file with error 409 #8183

kirichkov opened this issue Jun 24, 2017 · 4 comments · Fixed by #8186

Comments

@kirichkov
Copy link
Contributor

kirichkov commented Jun 24, 2017

Home Assistant release (hass --version):
0.47.1

Python release (python3 --version):
3.6.1

Component/platform:
telegram_bot

Description of problem:
Since the telegram notifications were incorporated as part of the telegram chatbot platform this has caused problems with using the same TelegramBot from multiple hass instances.

Before the Telegram notifications would just connect to the telegram server, send a message and disconnect. Now that notifications are part of the chatbot, hass connects to the telegram servers and uses long polling, staying connected, although this is not required, if you want to just send an occasional message. Thus, if you use the same bot from two or more instances just to send notifications (no chatbot functionality required) the log is flooded with 409 errors

Expected:
To use notifications without doing long polling if chatbot functionality is not needed.

Problem-relevant configuration.yaml entries and steps to reproduce:

telegram_bot:
  platform: polling
  api_key: !secret API_KEY
  allowed_chat_ids:
    - !secret CHAT_ID

notify:
  name: BOT
  platform: telegram
  chat_id: !secret CHAT_ID

Traceback (if applicable):
I get 8-10 of these every second:

[homeassistant.components.telegram_bot.polling] Error 409 on https://api.telegram.org/botID:KEY/getUpdates

Additional info:
If I stop my other home assistant instance these errors stop appearing.

In 0.46 I would get a single line in my log and that's it, but since upgrading to 0.47.1 as I mentioned above I get 7-10 errors every second. I believe this fix (#7877) actually causes the above severity of the issue in 0.47.1

@azogue
Copy link
Member

azogue commented Jun 24, 2017

Hi @kirichkov, I've just created a simple platform to only send messages in #8186. You could try it now as a custom_component just putting the new file in path_ha_config/custom_components/telegram_bot/

I hope your problem will be gone with that.

@kirichkov
Copy link
Contributor Author

Thanks for your work, I'll do test it and give some feedback if I have some suggestions.

@point-4ward
Copy link
Contributor

I don't know that much about the difference, so I won't be offended if you tell me I'm way off track, but does changing

telegram_bot:
  platform: polling

to

telegram_bot:
  platform: webhooks

solve this?

@kirichkov
Copy link
Contributor Author

kirichkov commented Jun 26, 2017

No, it does not. This is caused by having the bot connected from multiple places (doesn't have to be multiple home assistant instances). The only way around this is to stop all but one of the telegram bot "clients". If they are Home Assistants, just use azogue's code from #8186 as a custom component, until it's released in the main repo.

@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants