Telegram binding stopped working: "actions" is null ... (and no message is being sent...)

Hi there,

Actually I face problems using telegram binding. I used it for years in several rules (sending images from a webcam, sending some text, …) and suddenly it stopped working.

Direkt http API calls work fine https://api.telegram.org/bot/sendMessage?chat_id=&text= but not longer via openhab.
I tried reinstalling the plugin and yesterday I also updated to 4.2 from 4.1 (step to 4.3 comes soon), I tried cleaning cache and so one - but it does not want to work again.

Calling binding from a rule gives me a

Script execution of rule with UID ‘Klingel-1’ failed: Cannot invoke ```

org.openhab.binding.telegram.internal.action.TelegramActions.sendTelegram(String, Object[])" because "actions" is null in Klingel

That’s one of my rules that causes the error described above. All of my rules throw the same error since some weeks…:

val telegramActionBot1 = getActions("telegram","telegram:telegramBot:bot1")

rule "Aktivieren / Deaktivieren von BOT für Klingeln via Telegram melden - BOT 1"
when
	Item KLINGEL_BOT1 changed
then 
	if (KLINGEL_BOT1.state == ON) {
		telegramActionBot1.sendTelegram("Hauskonfiguration geändert. Es erfolgt ab jetzt eine Meldung jedes Klingelns via Telegram an diesen Kanal.")
	}
	if (KLINGEL_BOT1.state == OFF) {
		telegramActionBot1.sendTelegram("Hauskonfiguration geändert. Es erfolgt ab jetzt keine Meldung jedes Klingelns mehr via Telegram an diesen Kanal.")
	}
end

Thing configuration:

Anyone has some hints where the error can come from?

I just could solve the problem.
I added another new bot to openhab with exactly the same data as one of the other bots. And all Bots now work fine again. I deleted the new bot again and all existing rules work again with the old bots… There seems to be a bug in the telegram binding…

You have to put the

val telegramActionBot1 = getActions.. 

into the rule.
I had this too… The rule is loaded before the action is available. So the action is null for the hole rule-file.
When putting the

val telegramActionBot1 = getActions.. 

in the rule itself it works.
I changed all my rules… Other possibility is to reload the rules-file when the action is ready…
Greets

1 Like

Thank you for this information.
I will change this in my rules, too!