Rule error'z

Hi guys,

I’m by no means a coder and am self-taught through trial and error and lots and lots of copy and pasting other people’s work. I just can’t get my head around why this rule isn’t working?

val actions = getActions("mqtt", "mqtt:broker:mosquitto")

rule "back door open"

when
Item Back_Door changed
then
if(Back_Door.state ==OPEN)
actions.publishMQTT("comfort2/input17/set","1")
else
actions.publishMQTT("comfort2/input17/set","0") 
end

I need to send to 1 & 0 to my security system instead of open&closed but i’m getting this error that i cannot fix

2021-08-04 13:36:04.170 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'backdoor-1' failed: null in backdoor

Where am I going wrong?

cheers

actions may be null, it only gets loaded once when the rules file loads. At system boot time, the binding may not be ready at that moment.
It’s safer to get actions within the rule, when you want it.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.