Hello experts,
I copied a template of rules out of this forum here regarding irrigation system (YAWS, yet another watering solution).
This year (after migration to OH 3) one of my rules aren´t working anymore. As far as I can say it´s because of the last line in this code (triggeringItem). I was reading that there were some changes with this triggeringItem but I do not know how to fix it in the end.
As the code is not by me I don´t even know what the triggeringItem was used for.
Can you please help me out to get my rule back running again?
Thank you!
rule "Irrigation - valve updated, turn on the timer"
when
Item GroupIrrigationValves changed or
Item Test_Switch changed
then
// protection against overwatering
// log the state of all valves
GroupIrrigationValves.members.forEach [valve |
logDebug("Irrigation", "Irrigation valve: " + valve.name + " " + valve.state)
]
// a valve was turned on
if (GroupIrrigationValves.state == ON) {
if (IrrigationTimerMax.state == OFF) {
// timer is not set yet, start the timer
logDebug("Irrigation", "Irrigation valve open, starting protection timer")
IrrigationTimerMax.sendCommand(ON)
}
else {
// the timer is already running
logDebug("Irrigation", "Irrigation valve open, timer already started, nothing to do")
}
}
else {
logDebug("Irrigation", "All irrigation valves closed, stopping protection timer")
IrrigationTimerMax.postUpdate(OFF)
}
triggeringItem.postUpdate(triggeringItem.state)
end
And here´s the log entry when the rule fails:
2022-05-20 17:55:43.171 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'beregnungsanlage-6' failed: cannot invoke method public abstract org.openhab.core.types.State org.openhab.core.items.Item.getState() on null in beregnungsanlage