OpenHAB – Low Temperature Alert via Pushover & Email

Netatmo Weather Station

I’ve had quite a few problems with our central heating and hot water boiler recently. So, I decided to modify the OpenHAB Sample Rule for monitoring battery powered devices, to monitor the internal temperature.

I use a Netatmo Weather Station to pull the internal temperature, and it’s in a group called ‘Temperature’, so if I was to add other temperature sensors around the house, I can pull the temperature from all of them.

import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import java.lang.String
import org.openhab.core.library.types.DecimalType

val String mailTo = "myemail@address.com"
val int lowInternalTemperature = 14.2


rule "Temperature Monitor"
when Time cron "0 0/15 * * * ?"
then
 if (! Temperature.allMembers.filter([state < lowInternalTemperature]).empty) {
 val report = Temperature.allMembers.filter([state instanceof DecimalType]).sortBy([state]).map[
 name + ": " + state.format("%s")
 ].join("\n")

val message = "Temperature levels:\n\n" + report + "\n\nRegards,\n\nopenHab"
sendMail(mailTo, "Low Temperature alert", message)
 pushover(message)
 }
end

The values from the sensors are then sent as an alert to my email account, and via Pushover straight to my phone.

Leave a Reply

%d bloggers like this: