openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.6k forks source link

[telegram] Send messages silently #8487

Open jwsp1 opened 4 years ago

jwsp1 commented 4 years ago

I'd like to send messages silently but it seems this is not implemented in the binding yet.

J-N-K commented 3 years ago

@ZzetT While this is easy code-wise (just need to add .withNotification(true|false) to sendMessage, the questin is how to integrate that into the actions. It would be easy if we make it a bot-configuration option, but is this flexible enough? If we want to decide on a per-message-basis, we would have to introduce another set of action-methods. I'm not sure if that is the way to go.

jwsp1 commented 3 years ago

I'd prefer a configuration on a per-message-basis because you can easily mute all incoming messages on a chat in Telegram. But sometimes you want to send messages with low prio (=muted) while keeping the opportunity to send it with higher prio (=notification) in the same chat, e.g. when something more important happens.

While this is easy code-wise (just need to add .withNotification(true|false) to sendMessage

This means that it's already possible? If so, I would welcome an entry in readme.

LeeNX commented 3 years ago

I don't think this is in, but would be awesome to have.

Skinah commented 3 years ago

@J-N-K

What are your thoughts on doing this with a channel? If two rules both ran at the exact same time and 1 turned the silent channel turned ON and the other rule turned it OFF, the result would not be predictable, maybe no noise for both will occur. This is not optimal as it may be an urgent message that does not make a sound anymore.

Possible ways forward are:

  1. Use config (do not like this way)
  2. Use channel that rules or user can make all notifications silent with (I think its worth considering this before looking at the next option)
  3. Overload the functions and make documentation a pain and cause a huge number of breaking changes unless a double up of the actions are created to leave all OLD actions alone, and create all new ones like suggested here https://github.com/openhab/openhab-addons/issues/8018
openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/telegram-send-silent-message-from-bot/137048/2

Skinah commented 9 months ago

@J-N-K Did you see my last post? I am happy to make some changes to the code for this, but want some feedback on which way to head with this.

https://www.openhab.org/addons/bindings/telegram/#actions-to-send-messages-to-all-configured-chats

The actions all come in two formats with the LONG being for chatIDs...

foo(String) foo(Long, String)

Then to complicate it they often have String... as the last argument. This prevents tacking the boolean on the end does it not?

foo(String, String...)

foo(String, String..., boolean) Does this work?

This will be a pain to document and this binding is already a huge pain to learn and make choices with. So I'm leaning towards a channel as a quick solution. Thoughts?

lsiepel commented 8 months ago

I think it will be fine to have an action method that has this setting as parameter. It is straight forward, non breaking and not difficult to maintain.

lorenzo93 commented 7 months ago

Hi guys, are there any news about this issue?