All,
I would like to achieve the following:
OH should send a message (telegram) once per day for multiple tasks (e.g. warning if CO2 is too high in the living room).
So I have set global counter items like:
Number counterCO2
and use it in the rules like:
rule "CO2@Home"
when
Item Netatmo_Indoor_CO2 changed
then
if(counterCO2 == 0) {
if(Netatmo_Indoor_CO2.state > 1000) {
sendTelegram("OH_TeleBot", "CO2 Konzentration zu hoch!\nIhr solltet lüften!")
counterCO2 = counterCO2 + 1
}
}
end
This counter should be reset every morning:
rule "Set Daytime"
when
Item Weather_Sunrise_Event changed to ON
then
Weather_Daytime.postUpdate(ON)
Weather_Nighttime.postUpdate(OFF)
// reset all "once per day" local counter
counterCO2 = 0
logInfo("weather.rules: ", "Daily counters have been reset")
end
Unfortunately I get an error in OH.log:
2016-10-14 07:51:01 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Set Daytime': org.eclipse.xtext.util.PolymorphicDispatcher$NoSuchMethodException: Couldn't find method ''_assignValue'' for objects [org.eclipse.xtext.common.types.impl.JvmGenericTypeImplCustom@16878be (visibility: PUBLIC, simpleName: NumberItem, identifier: org.openhab.core.library.items.NumberItem) (abstract: false, static: false, final: false, packageName: org.openhab.core.library.items) (interface: false), <null> counterCO2 <XNumberLiteralImpl>, 0, org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext@ce7d90, org.eclipse.xtext.util.CancelIndicator$1@13806b6]
Previously I had this structure in one rule (all rules within one single file and used the counters locally. This was working like a charm.
What might be wrong here?
Any idea?
Thanks