Cannot send Telegram messages; NullPointerException

Trying to use the Telegram binding to send messages on actions. I configured the bot according to the docs. When I send the bot a chat via Telegram app, I do see the update in PaperUI, so I know it’s working in receive mode at least.

When trying to send messages, however, I’m getting this error in the openhab.log:

    2020-09-08 16:06:18.373 [ERROR] [dule.handler.AnnotationActionHandler] - Could not call method 'public boolean org.openhab.binding.telegram.bot.TelegramActions.sendTelegram(java.lang.Long,java.lang.String,java.lang.Object[])' from module type 'telegram.sendTelegram'.
java.lang.reflect.InvocationTargetException: null
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_252]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_252]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]
	at org.openhab.core.automation.internal.module.handler.AnnotationActionHandler.execute(AnnotationActionHandler.java:86) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1189) [bundleFile:?]
	at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:993) [bundleFile:?]
	at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:91) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: java.lang.NullPointerException

Can you show us how you are trying to send the messages?

I simply created a rule that says ‘when the state of the door sensor changes, send Telegram message’

Where can I find more logs? The main openhab.log doesn’t seem to show much in regards to troubleshooting this. When I click the ‘Play’ icon to test the rule, nothing happens. No message, no errors in the log.

What does your telegram message look like?

No messages are received. That’s what led me to get into the logs, only to discover the nullpointer error.

This may be an issue with the new Rules UI. I was able to set up a test rule using the text files (ie: /opt/openhab/conf/rules/lights.rules) and that works as expected.

What is the message configuration you are trying to send look like?

 sendTelegram("bot1", "item Foo changed")

I don’t see where to add messages in the UI.

Not sure as I do not use the new rules engine and everything except Things are in files but if it’s working in files then you can open an issue on Github to have the feature added/fixed.

It might be the generiv action invoke bug, triggered when a binding gets updated. In that case stop openHAB, clean cache and start again.