This repository has been archived by the owner on May 23, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 91
Rule Designer: Example 1
Chris Jackson edited this page May 28, 2015
·
1 revision
This rule will simply update an item RainGauge_Change24hr
from the value of difference of the item Outside_RainGauge_Counter
now, and 24 hours ago.
// This rule file is autogenerated by HABmin.
// Any changes made manually to this file will be overwritten next time HABmin rules are saved.
// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.java.math.*
rule "Rain in past 24 hours"
when
Time cron "0 */2 * * * ?"
or
Item RainGauge_Change24Hour changed
then
postUpdate(RainGauge_Change24Hour, (RainGauge_Change24Hour.state as DecimalType - RainGauge_Change24Hour.historicState(now.minusHours(24)).state as DecimalType))
end