Help understanding telegram keyboard use cases

I am hoping someone has used telegram keyboards before and can clearly explain what they would use them for from openhab? A use case of where a custom keyboard in the chat would make life easier and makes sense? I have added the code needed to get them working, but need to test and add an example to the Readme, but I can not come up with a useful example.

The current sendTelegramQuery adds buttons that disappear when you select one of the buttons. This makes sense and the example in the readme gives a useful use case of when and how you would use it.

The new feature adds a custom keyboard that remains and can be re-used and hidden. It stays until openHAB removes the custom keyboard or sends a different keyboard to be displayed.

A few users asked for it to be added as they had it working in iobroker and missed it when they came to openhab. Can someone help by writing something I can use as an example in the readme? Thanks.

EDIT:
I’m guessing you may be able to display a button with a http link to take you directly to openhabs pages or a graph view. But for graphs it makes more sense to just send the graph as an image to the bot.

I know the query buttons. I use them a lot.
But what is the keyboard? How does it look like? Are this the big buttons with longer texts inside?
Greets.

Does they send commands?
I could imagine sending “light on” to telegram and the answer is a selection of lights to be switched…
Or send picture from… Camera 1 to 4

No, they send text just as if the user typed it out manually. It is just a custom keyboard that will type out what the buttons have on them.

The result goes into the chat, the query method does not go into the chat. The keyboard can be used many times and hidden and you can go back to the normal keyboard.

The only use case I can see is if I wanted to give a friend abilities to do things in my home without giving them openhab access. You could give them a water lawn button they can press multiple times. But I don’t see it as a good use case as you can automate it in openhab and not need a person to press a button. Any idea I come up with there are better ways to do the same thing.

This thread shows what they look like…

OH3 Telegram Custom Keyboard - Add-ons / Bindings - openHAB Community

Ah okay… Thx.
I don’t need this.
But a quiet message were nice… :wink:

Greets

That’s next to be looked at, but first I need to complete this feature so it can be a separate PR.

Since your using sendTelegramQuery(…) a lot, are there any limitations that need to be removed?

It appears that there is no way to put multiple buttons into multiple rows, this that correct?
The two features Keyboards and Query should be consistent, so any features added to one needs to be added to the other. The silent feature needs to be done to nearly all actions so its going to be tackled separately.

EDIT:

Example of multiple rows of InlineKeyboardMarkup that sendTelegramQuery could send:

Example of multiple rows of a ReplyKeyboardMarkup:

That’s correct. And this is really bad. This multiple inline keyboard were perfect. And what would also be really good, a remove query option…
Remove the inline keyboard if now answer in some time or if another person did answer…
Greets

Are you working on this?

I have started and am waiting on a PR to be merged that updates libraries before doing more.

Thx for the info

Hi @matt1,
any news here? I’m really interested in the multiple inline keyboard…
Greets

Hi @matt1,
me again… Any news here? :see_no_evil:
Greets…

Sorry have been busy changing jobs, and now my main goal is to get Reolink up to speed in the ipcamera binding before the next milestone in around ten days time so any spare time is going to that at the moment. I’ll get back on this soon after that as it needs to be done and try and squash a few bugs in the binding at the same time.

@Baschtlwaschtl Did you want to test this in Alpha state? I have not run it in a while but have updated the code into the latest branch and got it compiling again. I tested the custom keyboard for a single row of buttons, but the other two I forget what stage they were at as I was looking to find the best way to implement multiple rows of buttons.

| sendKeyboard(Long chatId, String message, String replyId, boolean oneTimeKeyboard, String[]... buttons) | Send a custom keyboard with multiple rows of buttons. |

| sendKeyboard(Long chatId, String message, String replyId, boolean oneTimeKeyboard, String... buttons)| Send a custom keyboard with a single row of buttons. |

| replyKeyboardRemove(boolean isSelective) | Remove a custom keyboard. |

Hi @matt1,
yes I can do some testing…
Where can I download the jar file?
Greets

http://pcmus.com/openhab/telegram/

I have tested the single line keyboard so this should be useable.
I have not tested the removeKeyboard feature yet.
Multiple rows are not tested as I was not sure how to write the rule in openhab to do a test, the code should work.

The untested stuff may work, you will just have to try and see if it works.

I uninstalled official telegram binding and installed your jar file…

2024-11-19 00:34:32.885 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.telegram-4.3.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.telegram [363]
  Unresolved requirement: Import-Package: com.pengrad.telegrambot

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.18.0.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.4]

Something missing here…

Greets…

https://mvnrepository.com/artifact/com.github.pengrad/java-telegram-bot-api

Sorry, I don’t know what to do here with this information.
Greets

You can download the missing jar file from that link and drop it into the addons folder.