OH1.8: The name 'unkown' ... cannot be resolved to an item or type

True… link is broken (it’s because since the release of openHAB2 stable (2.0.0) all binding snapshots have been renumbered from 1.9.x to 1.10.x (and for OH2 from 2.0.x to 2.1.x)… so https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.expire/target/org.openhab.binding.expire-1.10.0-SNAPSHOT.jar works :))

Try also: https://openhab.ci.cloudbees.com/job/openHAB1-Addons/lastBuild/org.openhab.binding$org.openhab.binding.expire/
(place org.openhab.binding.expire-1.10.0-SNAPSHOT.jar in your addons folder… it should load it up… I am not familiar with OH1)

I don’t know if it will work on OH1… it should (since it’s a 1.x binding)

1 Like

It does work with 1.8.

Clearly the wiki needs to be updated.

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?

1 Like

OK… after Rich second your suggestion, I tried the expire binding.
In principle it works. :slight_smile: 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. :frowning:

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
1 Like

Ouch… This hurts!
Thank you for enlightening me…
I wondered how I could incorporate the if()… doh.
Again, thank you very much…

(Reading through the Please test the new Expire Binding, which has some really good bits in it.)

Hmmm…

tried the suggestion, winch results in an error:

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.

1 Like

Thank you again! … and for spotting my mistake!

With the correction it works!! :slight_smile:

(Have updated my code above, so others who might copy mau not experience this problem.)

Clearly, I have been on this timer thing for too long – 2 days now – and don not see the forest because of the trees. :unamused:

To demonstrate what I wanted to achieve…

2 Likes

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… :slight_smile:
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.

At least , we’ve got something working now… :slight_smile: