Well, thank you! You asked the right questionā¦ and as always: silly me!
It is an item and as such requires .postUpdate()
ar_RainYesterday.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(1), "rrd4j"))
ā¦ which worksā¦ as in, at least it does not throw an error.
However, I noticed further issues with my rules.
rule "Rainfall prior to today"
when
// s m h D M DoW Y
//Time cron "0 1 0 * * ? *"
Time cron "0 0/1 * 1/1 * ? *"
// here: 00:01; use http://www.cronmaker.com/
then
// update yesterday, with last night mm minus night before mm
//logInfo("AR.2.00", "ar_RainYesterday........: {}", ar_RainYesterday)
logInfo("AR.2.01", "ar_RainTotal............: {}", ar_RainTotal)
//logInfo("AR.2.02", "ar_RainTotal...SoD......: {}", ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j"))
ar_RainYesterday.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(1), "rrd4j"))
logInfo("AR.2.03", "ar_RainTotal...SoD-1....: {}", ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(1), "rrd4j"))
// update last 7 days
ar_RainWeek.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(7), "rrd4j"))
logInfo("AR.2.04", "ar_RainWeek.............: {}", ar_RainWeek)
// update last 30 days
ar_RainMonth.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(30), "rrd4j"))
logInfo("AR.2.05", "ar_RainMonth............: {}", ar_RainMonth)
// update last 30 days
ar_RainQuarter.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(90), "rrd4j"))
logInfo("AR.2.06", "ar_RainQuarter..........: {}", ar_RainQuarter)
// update last 365 days
ar_RainYear.postUpdate(ar_RainTotal.deltaSince(now.withTimeAtStartOfDay, "rrd4j") - ar_RainTotal.deltaSince(now.withTimeAtStartOfDay.minusDays(365), "rrd4j"))
logInfo("AR.2.07", "ar_RainYear.............: {}", ar_RainYear)
end
The total rainfall was recorded for the first time on Aug 10th.
The total rainfall is the only value the weather station reports, meaning I have to calculate all other values, and for simplicity/testing sake started with the value prior to today.
However, I am not getting the 573mm as a rainfall for all items but yesterday.
2019-08-13 20:44:00.032 [INFO ] [lipse.smarthome.model.script.AR.2.01] - ar_RainTotal............: ar_RainTotal (Type=NumberItem, State=573.787, Label=Rain Total, Category=clouds_rain, Groups=[gAccuRite])
2019-08-13 20:44:00.056 [INFO ] [lipse.smarthome.model.script.AR.2.03] - ar_RainTotal...SoD-1....: -0.0000000000001
2019-08-13 20:44:00.074 [INFO ] [lipse.smarthome.model.script.AR.2.04] - ar_RainWeek.............: ar_RainWeek (Type=NumberItem, State=0.000, Label=Rainfall last 7 days, Category=clouds_rain, Groups=[gAccuRite])
2019-08-13 20:44:00.087 [INFO ] [lipse.smarthome.model.script.AR.2.05] - ar_RainMonth............: ar_RainMonth (Type=NumberItem, State=0.000, Label=Rainfall last 30 days, Category=clouds_rain, Groups=[gAccuRite])
2019-08-13 20:44:00.099 [INFO ] [lipse.smarthome.model.script.AR.2.06] - ar_RainQuarter..........: ar_RainQuarter (Type=NumberItem, State=0.000, Label=Rainfall last 90 days, Category=clouds_rain, Groups=[gAccuRite])
2019-08-13 20:44:00.115 [INFO ] [lipse.smarthome.model.script.AR.2.07] - ar_RainYear.............: ar_RainYear (Type=NumberItem, State=0.000, Label=Rainfall last 365 days, Category=clouds_rain, Groups=[gAccuRite])
What am I missing?