Hi.
I have this rule.
It basically calculates a delta from a last weeks value of the item.
rule "EtaOpHoursWeek"
Time cron "0 59 23 ? * SUN"
then
logInfo("EtaOpHoursWeek", "setting last weeks avg eta op hours...")
logInfo("EtaOpHoursWeek", "Retrieving historic state...")
var historicItem = HeatingETAOperatingHours.minimumSince(now.minusWeeks(1), "jpa")
if(historicItem == null) {
logError("EtaOpHoursWeek", "Unable to retrieve historic item!")
} else {
logInfo("EtaOpHoursWeek", "Retrieving historic state...done")
logInfo("EtaOpHoursWeek", "hItem state type: " + historicItem.state.getClass().getName())
logInfo("EtaOpHoursWeek", "hItem state: " + historicItem.state)
logInfo("EtaOpHoursWeek", "1")
var previousState = historicItem.state
logInfo("EtaOpHoursWeek", "2")
logInfo("EtaOpHoursWeek", "3")
logInfo("EtaOpHoursWeek", "Historic state: " + previousState)
logInfo("EtaOpHoursWeek", "4")
var diff = HeatingETAOperatingHours.state - previousState
logInfo("EtaOpHoursWeek", "5")
var perDay = diff / 7.0
logInfo("EtaOpHoursWeek", "6")
logInfo("EtaOpHoursWeek", "new per day value: " + perDay)
logInfo("EtaOpHoursWeek", "7")
//HeatingETAOpHoursPerDay.sendCommand(perDay)
logInfo("EtaOpHoursWeek", "setting last weeks avg eta op hours....done")
}
end
On execute I’m seeing this log and exception:
2015-10-12 08:38:00.004 [INFO ] [.s.model.script.EtaOpHoursWeek] - setting last weeks avg eta op hours...
2015-10-12 08:38:00.004 [INFO ] [.s.model.script.EtaOpHoursWeek] - Retrieving historic state...
2015-10-12 08:38:00.350 [INFO ] [.s.model.script.EtaOpHoursWeek] - Retrieving historic state...done
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - hItem state type: org.eclipse.smarthome.core.library.types.DecimalType
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - hItem state: 10094
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - 1
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - 2
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - 3
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - Historic state: 10094
2015-10-12 08:38:00.351 [INFO ] [.s.model.script.EtaOpHoursWeek] - 4
2015-10-12 08:38:00.352 [ERROR] [.m.r.r.i.engine.ExecuteRuleJob] - Error during the execution of rule EtaOpHoursWeek
java.lang.RuntimeException: The name '<XMemberFeatureCallImplCustom> - <XFeatureCallImplCustom>' cannot be resolved to an item or type.
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:110) ~[na:na]
The exception is throws when accessing HeatingETAOperatingHours.state.
Why the heck is this exception thrown?
This item should be known, it is regularly updated.
What am I doing wrong here?
Manfred
P.S.: this is OH2