Hello,
I’m the author of the Zibase binding and I’m encountering problem trying to use item value to do some tests and comparison.
I tried to simplify things to make it easy to understand.
Item file :
Number Sonde_SDE_Hum "Humidite SDE [%d %%]" {zibase="EMT,OS439187201,hum" }
rule file:
rule "my rule"
when
Item Sonde_SDE_Hum received update
then
logInfo( “FILE”, “***************** state =” + Sonde_SDE_Hum.state)
if( !(Sonde_SDE_Hum.state instanceof UnDefType)) {
logInfo( “FILE”, "***************** State UndefType !!! ")
}
if (Sonde_SDE_Hum.state instanceof DecimalType) {
logInfo( “FILE”, “***************** DecimalType”)
}
end
log file :
22:31:15.546 INFO runtime.busevents[:26] - Sonde_SDE_Hum state updated to 46
22:31:15.548 DEBUG o.o.m.r.i.engine.RuleEngine[:298] - Executing rule 'my rule’
22:31:15.547 DEBUG o.o.b.z.internal.ZibaseBinding[:255] - value of item state 46
22:31:15.555 INFO org.openhab.model.script.FILE[:53] - ***************** state =46
22:31:15.561 INFO org.openhab.model.script.FILE[:53] - ***************** State UndefType !!!
==> I don’t undertstand why the state is undeftype : there is a value assigned to it… and when I run in debug mode in eclipse, I can even see that the value passed to postUpdate() is of type “DecimalType”.
I even tried to do the following in by binding, but no luck ;(
DecimalType value = new DecimalType(52);
eventPubisher.postUpdate(itemName, value);
Reading item works perfectly, I can see values, but I can use rules with some comparison (eg: testing if value is < 52) because of this undeftype ;(
What am I doing wrong ? Any idea is welcome !