hi all,i am trying to create a warning rule for my freezer.My goal is if the freezer temperature is over -10 C to warn me and check again in 30 mins.
var Timer sfreezer_timer = null
rule "small_freezer"
when
Item SmallFreezer_Temperature changed
then
if (SmallFreezer_Temperature.state > -10) {
deskhall.sendCommand(ON)
say("the big freezer temperature is"+SmallFreezer_Temperature.state.format("%.1f")+"degrees , something is wrong")
val mailActions = getActions("mail","mail:smtp:mailserver")
mailActions.sendMail("xxxxxxxxxx@gmail.com, xxxxxxxxx@yahoo.co.uk", "Small Freezer", "check the small freezer,the temperature is over -10C")
sfreezer_timer = createTimer(now.plusMinutes(30)) [|
if (SmallFreezer_Temperature.state > -10) {
say("the big freezer temperature is"+SmallFreezer_Temperature.state.format("%.1f")+"degrees , something is wrong")
val mailActions = getActions("mail","mail:smtp:mailserver")
mailActions.sendMail("costascontis@gmail.com, oxlagogi@yahoo.co.uk", "Small Freezer", "check the small freezer,the temperature is over -10C")
sfreezer_timer.reschedule(now.plusMinutes(30))
}
else {
if (sfreezer_timer !== null) {
sfreezer_timer.cancel
sfreezer_timer = null
}
}
]
}
end
after 2 hours i cant make it work…my temp sensor is reporting temps as a Number for example:
2021-04-22 10:44:49.937 [vent.ItemStateChangedEvent] - SmallFreezer_Temperature changed from -19.42 °C to -19.6 °C
but i thing the problem is at the
if (SmallFreezer_Temperature.state > -10)
tried to reverce the > symbol ,but nothing works…Any idea?