I have updated to OpenHab3 and I found this errors into log console:
2020-12-27 11:57:27.356 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'bot-1' failed: 'sendTelegram' is not a member of 'null'; line 14, column 9, length 40 in bot
In my rules I use a global var because I use this bot in other rules:
var bot_casa
rule "System Start Bot Rules"
when
System started
then
logInfo("my.rules", "System Start -> Bot Rules")
bot_casa = getActions("telegram","telegram:telegramBot:casa")
bot_casa.sendTelegram('System Started!')
end
Before update it works fine, but now i don’t know why.
It’s possible that the instance of bot thing occur after I call getActions()?
Hello I have the same Problem, and find out at start up my rule returns an error
2020-12-29 12:10:50.080 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sendtelegramm.rules'
2020-12-29 12:10:51.344 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'sendtelegramm.rules', using it anyway:
The field Tmp_sendtelegrammRules.telegramAction refers to the missing type Object
The field Tmp_sendtelegrammRules.telegramAction refers to the missing type Object
The field Tmp_sendtelegrammRules.telegramAction refers to the missing type Object
When i reload my rule all will be fine, so it looks like the action fuction is not running at this poit
import java.util.Date
val String filename = "sendtelegramm.rules"
val telegramAction = getActions("telegram","telegram:telegramBot:mybot")
/* Eine Telegram MSG wird verschickt*/
rule "SendTelegrammMsg"
when
Item TelegrammSendMsg changed
then
val String Empf = transform("JSONPATH", "$.Receiver", TelegrammSendMsg.state.toString)
val String Msg = String::format( "%1$td.%1$tm %1$tH:%1$tM", new Date() )+" Uhr - "+transform("JSONPATH", "$.MSG", TelegrammSendMsg.state.toString)
// Nur Admin
if ( Empf == "1" ){
logInfo(filename, "Telegram Nachricht: " + Msg )
telegramAction.sendTelegram( 1xxxxxxxxL, Msg)
TelegrammSendMsg.postUpdate( '{"Receiver":0,"MSG":" "}' )
}
Hi, I’m also experiencing this sort of problem. During startup these errors occur:
2021-02-03 06:47:21.717 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'event.rules', using it anyway:
The field Tmp_eventRules.telegramAction refers to the missing type Object
The field Tmp_eventRules.telegramAction refers to the missing type Object
My Telegram actions aren’t working until I reload a rule.
error:
2021-02-03 11:53:31.528 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'event-15' failed: null in event
I was also wondering why my rule throws the error with null. A modification of the file and so the forced reload of the rule fixed it. So it is a openhab3 related problem that the “old” rules in the rules directory are not working properly after a restart? Is it only related to the telegram binding or are there also problems with other bindings?
I’m using Astro, GPSTracker, Homematic, ipcamera, Jablotron, Mail, MQTT, OpenWeatherMap, OpenWebNet and Telegram binding. So far only the Telegram binding has this issue…
No. It’s a timing issue. At the moment you ask the binding for Actions, it’s not ready. Later, if you ask again, it will be.
Reloading rules files is one way to ask again.
Whether the problem shows up for you depends on your configuration and hostng, because that affects when various openHAB parts get started and become ready. And of course, when you do ask for your getActions()
I am using Pushover instead of Telegram, but I have the exact same problem.
After I restart the openhab-service, no pushover notification is working. But as soon as I reload the rules-file, with the pushover-action, it works fine.
(with “as soon as” I mean about 3 days after the restart so not immediately).