I would have expected the apt-get to have installed it. Is there a snapshot repo 1.8 users should be pulling from to get the 1.9 and 1.10 version bindings?
OK… after Rich second your suggestion, I tried the expire binding.
In principle it works. Well, this is a success story for me, as I tried something new and it worked (other than the link for the binding being broken – now fixed).
Question for you if you do not mind:
Considering the example you’ve given me…
If the level change does not arrive within 2 min (given it is, under normal conditions, updated every 60 sec), I should never have an expired timer, thus a state of UNDEF.
However, what my initial timer rule achieved was:
send reporting = ON if a level update has been received
send reporting = OFF if it hasn’t
With my expire binding I get the OFF, but what gives me the ON…?
If this makes sense?!
EDIT:
At present I have this:
rule "Irrigation tank update not received"
when
Item Tank_Irrigation_Level changed to UNDEF
then
logInfo("IrriTank.rule", "Tank_Irrigation_Reporting: no update received on time")
Tank_Irrigation_Reporting.postUpdate("OFF")
end
rule "Irrigation tank update received"
when
Item Tank_Irrigation_Level received update
then
Tank_Irrigation_Reporting.postUpdate("ON")
end
Which is not really much of a saving compared to the createTimer()…
I suspect it is my lack of creativity to solve this differently.
Just one rule can be used to track whether the Tank_Irrigation_Level is UNDEF or another state:
rule "Irrigation tank update received"
when
Item Tank_Irrigation_Level received update
then
Tank_Irrigation_Reporting.postUpdate(if (Tank_Irrigation_Level.state == UNDEF) OFF else ON)
end
2017-02-06 18:16:30.846 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Irrigation tank update received': The name 'UNDEF' cannot be resolved to an item or type.
I also tried “UNDEF”, Undefined, “Undefined”…
And then rewrote the rule to:
rule "Irrigation tank update not received"
when
Item Tank_Irrigation_Level received update
then
// https://community.openhab.org/t/oh1-8-the-name-unkown-cannot-be-resolved-to-an-item-or-type/22078/24
// OH2: if (Tank_Irrigation_Level.state == UNDEF) {
// OH1: if (Tank_Irrigation_Level.state == Undefined) {
if (Tank_Irrigation_Level.state == Undefined) {
logInfo("IrriTank.rule", "Tank_Irrigation_Reporting: no update received on time")
Tank_Irrigation_Reporting.postUpdate("OFF")
} else {
Tank_Irrigation_Reporting.postUpdate("ON")
}
end
… same result, with all four variations of undefined.
EDIT: I made a mistake in the if() and corrected Undefinded to Undefined
Sorry, I forgot you are on openHAB 1.8. UNDEF in openHAB 2 is Undefined in openHAB 1. Don’t use quotes for states like ON, OFF, Undefined. You seem to be trying Undefinded when Undefined should work.
Glad you got it working and I’m sorry you had such a challenge getting it to work. I’ve become a complete Expire binding convert largely because working with Timers can be so error prone and the errors seen can be very challenging to figure out what went wrong.
No need to be sorry…
It has nothing to do with you…
As I said, most of these cases I read on the forum did not end up with a resolution… and the ongoing issue of cryptic errors the average, let alone newbie, cannot resolve.