I have a few lambda functions that arn’t working post upgrade to OH3. I disected my function down to something very basic to narrow down the problem i found the cause:
Whenever I call the pushover action to send a notification within the lambda it fails with the error message:
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘lamba_test-1’ failed: null in lamba_test
Here’s my example code (ignore the naming - its my function used for autolocking doors):
Rule:
import org.eclipse.xtext.xbase.lib.Functions
import java.util.Map
val pushover = getActions("pushover", "pushover:pushover-account:locks")
val Map<String, Timer> timers = newHashMap
val Functions$Function6<GenericItem, GenericItem, GenericItem, Integer, Map<String, Timer>, String, Boolean> LambdaTest = [
lockItem,
lockItemStatus,
sensorItem,
time,
timers,
lockDesc |
logInfo("LambdaTest", "lockItem: " + lockItem +"lockItemStatus: "+ lockItemStatus + "sensorItem: " + sensorItem + "time: " + time + "timers: " + timers + " lockDesc: "+ lockDesc )
var String TimerKey = lockItem.name
if (timers.containsKey(TimerKey)) {
logInfo("LambdaTest", "Key Contained")
} else {
//pushover.sendMessage("LOCKED (Auto)","Title of Message")
}
true
]
Rule that calls the function:
rule "Auto Lock Timer: House Lock"
when
//Item vHouseLock changed from LOCKED to UNLOCKED or
//Item vHouseLock changed from UNLOCKED to LOCKED or
Item vTest changed
then
logInfo("LambdaTest", "### Auto Lock Timer: House Lock ###")
{
LambdaTest.apply(vHouseLock_Proxy, vHouseLock_Status, vHouseDoor, 30, timers, "House Lock")
}
end
Running the above rule works no problem.
If i were to uncomment out the line that says:
//pushover.sendMessage(“LOCKED (Auto)”,“Title of Message”)
I then get the following error message:
2021-03-06 21:57:05.255 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘lamba_test-1’ failed: null in lamba_test