As it happened that something was blocking the fridge door a couple of times recently, I added a window/door sensor to it and created this script to notify all notification devices when it’s left open for more than a minute. That is, in my case to the mobile devices of all family members and a notification popup on the TV running Kodi.
Thought I’d share it for inspiration to others. Would be nice if you guys could share some of yours too.
import QtQuick 2.0
import nymea 1.0
Item {
ThingState {
id: fridge
thingId: "{7fa11a09-1370-43e4-bfdc-d8b5260cc6cf}" // Fridge
stateName: "closed"
}
Timer {
interval: 60000
running: fridge.value == false
repeat: false
onTriggered: {
for (var i= 0; i < notifications.count; i++) {
var thing = notifications.get(i)
thing.executeAction("notify", {"title": "Warning", "body": "Fridge is open!"})
}
}
}
Things {
id: notifications
filterInterface: "notifications"
}
}