[SOLVED] Send email with a exception

Hello all,

I have created a rule that sends out a email when the temperature is higher the 80C

rule "Temperature  above 80°"

when
    Item temperature  received update
then
    if (temperature.state >= 18) {
       sendMail("myemail@adress", "Kachel Temperatuur Waarschuwing", "Kachel temperatuur is 80C of hoger$
       }
end

Now my question: is it possible to change the rule so that when the temperature is higher then 80C it will send a email unless the email has already been send in the past 10 minutes?

Greatings

Yes

Use another item and the expire binding
Install the expire binding

Item:

Switch MailSent { expire="10m, command=OFF" }

Rules:

rule "Temperature  above 80°"

when
    Item temperature received update
then
    if (temperature.state >= 18 && MailSent.state != ON) {
        sendMail("email@email.com", "Kachel Temperatuur Waarschuwing", "Kachel temperatuur is 80C of hoger")
        MailSent.sendCommand(ON)
    }

end

The rule will sent a command ON to MailSent. MailSent is like a timer and will turn itself to OFF after 10 minutes.

2 Likes

@ vzorglub thanks for the leply.
Also thanks for the example this wil help me alotte