Skip to content

telegram_bot platform to only send messages#8186

Merged
balloob merged 2 commits into
home-assistant:devfrom
azogue:telegram-only-send
Jun 27, 2017
Merged

telegram_bot platform to only send messages#8186
balloob merged 2 commits into
home-assistant:devfrom
azogue:telegram-only-send

Conversation

@azogue
Copy link
Copy Markdown
Member

@azogue azogue commented Jun 24, 2017

Description:

When the notify.telegramplatform went included in the component telegram_bot (used to send and receive messages), some users using the same Telegram account from multiple devices were abandoned... (See #8183).

This is a dummy telegram_bot platform for these users (and any user who doesn't need to receive any messages). It has the capacity of sending any type of Telegram message, but it cannot receive anything.

Related issue (if applicable): fixes #8183

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2882

Example entry for configuration.yaml (if applicable):

telegram_bot:
  platform: broadcast
  api_key: !secret telegram_bot_api_key
  allowed_chat_ids:
    - !secret telegram_bot_chat_id_admin
    - !secret telegram_bot_group
  
notify:
  - platform: telegram
    chat_id: !secret telegram_bot_chat_id_admin

Checklist:

If user exposed functionality or configuration variables are added/changed:

@MartinHjelmare
Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok. I'm a bit hesitant about the platform name, but I don't have a better suggestion either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be updated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the name either, was hoping someone to suggest a better one, lol

Going to update the description and make the doc.

Thanks for reviewing!

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jun 24, 2017

Yeah the name is a bit strange, but I have also no better sugestion...

@kirichkov
Copy link
Copy Markdown
Contributor

kirichkov commented Jun 24, 2017

Some name suggestions: telegram_message_send, send_telegram_message

I don't say they are better :-) The best would be "telegram_notification", but I think that will result in a lot of confusion!

I spoke too soon. Didn't notice it's a platform under the telegram_bot platform. onlysend is indeed the one that makes most sense so far.

@point-4ward
Copy link
Copy Markdown
Contributor

Suggestion: broadcast

@azogue
Copy link
Copy Markdown
Member Author

azogue commented Jun 26, 2017

ok, so broadcast it is (I like it more too)

"""Set up the Telegram broadcast platform."""
# Check the API key works
import telegram
bot = telegram.Bot(config[CONF_API_KEY])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one of that line is not async safe...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are, but not the next, getting the bot username. Pushed a commit to fix

@balloob balloob merged commit 596093d into home-assistant:dev Jun 27, 2017
@balloob balloob mentioned this pull request Jul 1, 2017
@azogue azogue deleted the telegram-only-send branch July 30, 2017 09:37
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
* add new telegram_bot platform to only send messages

* Fix async
@nordeep
Copy link
Copy Markdown
Contributor

nordeep commented Aug 24, 2017

After telegram_bot was introduced we, unfortunately, can't use more than one bot for notifications. It may be useful when we use customize notifications for different bots(chats) in the messenger (different type of notifications, for example - info, warn, crit).

@kirichkov
Copy link
Copy Markdown
Contributor

Yes, you can. This platform allows you to only send messages. Which allows you to use the bot for notification from multiple hass instances, and other software as well. I use a single bot for notifications from 2 hass instances, and 2 other pieces of software. All in all total 4 "inputs" that send messages.

@nordeep
Copy link
Copy Markdown
Contributor

nordeep commented Aug 24, 2017

But, I need two bots on only one hass instance.
Now on old instance I use hass 0.43.2 and two telegram notifications with two api keys.

@kirichkov
Copy link
Copy Markdown
Contributor

Aha, I see your use case. Maybe you can try adding multiple bots. I see the telegram_bot component's configuration takes a list. Unfortunately I can't be if any more help.

@home-assistant home-assistant locked and limited conversation to collaborators Aug 26, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Aug 26, 2017

Pull requests should not be used for support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram notifications flood the log file with error 409

9 participants