Delay notification

Hi
This should be simple but I can’t find out how to do it.
I have a temperature sensor in my frezzer and I want a notification send to me when the temperature is above -5 C
BUT the notification should not be send until after 30 minutes if the temperature still is above -5 C

[quote=“olaeke, post:1, topic:186700”]Hi
This should be simple but I can’t find out how to do it.
I have a temperature sensor in my frezzer and I want a notification send to me when the temperature is above -5 C
BUT the notification should not be send until after 30 minutes if the temperature still is above -5 C[/quote]

This would be easy to achieve using PLEG. I believe there have been solutions posted previously. If you don’t already use PLEG, see PLEG Basics for an introduction.

It could also be done using Lua code in a scene. If the scene is triggered when the temperature rises above -5 C, you would start a delay for 30 minutes. When the delay call-back happens, check the temperature. If it is still high, send the notification and start the delay again. There is example code for most of this in Conditional Scene Execution.

How do I “send notification” in Lua code?

The best way is to use the Vera Alerts plugin - from the App Store. There is a dedicated Vera Alerts board.

But if I don’t want to use plugin for everything how can I program it in Lua ?

Create a scene with the required notification. Run the scene using:

luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = 123}, 0)

Just for reference for other with the same question, here is working luup block:

--Wait 45 min for new temp reading
luup.call_delay("checkFrezzerTemp", 2700)

function checkFrezzerTemp()
  local thisTemp = tonumber((luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 38)))
  if thisTemp > -7 then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = 16}, 0)
    luup.call_delay("checkFrezzerTemp", 2700)
  end
end

Create this in one scene
Create another scene which do the notification, in my example this is scene #16

Just hope that Vera does NOT restart during that 45 minute interval … your delayed action will be lost.