import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* var Temp1_Setpoint = 24 var Light1_Setpoint = 300 var Humid1 = 60 * The following rules help initializing the demo items with some helpful states.*/ rule "Initialize states" when System started then if (Temp1_Setpoint.state == Uninitialized) Temp1_Setpoint.postUpdate(24) if (Light1_Setpoint.state == Uninitialized) Light1_Setpoint.postUpdate(24) if (Humid1.state == Uninitialized) Humid1.postUpdate(24) Temp1_Setpoint.postUpdate("") Light1_Setpoint.postUpdate("") Humid1.postUpdate("") end rule "Update max and min temperatures" when Item Temp1 changed or Time cron "0 0 0 * * ?" or System started then postUpdate(Temp1_Max, Temp1.maximumSince(now.toDateMidnight).state) postUpdate(Temp1_Min, Temp1.minimumSince(now.toDateMidnight).state) end // Creates an item that stores the last update time of this item rule "Records last temp update time" when Item Temp1 received update then postUpdate(Temp1_LastUpdate, new DateTimeType()) end