Timed lights, Alerts to push notification?

Hello and thank you for this great place with lot’s of knowledge around openHAB. After many searches I decided to ask his directly in the beginners section, I hope this is Ok?

I want to create a rule: If the garage door opens, turn on lights for 10 mins.

So very easy rule with z-wave components: door sensor, switch…

I’ve tried to accomplish this in HABmin but was not succesful so far, so please help! :slight_smile:

Another question: Is it possible to send out push mails or messages if the garage door is open longer than 30mins.? So like Alert to push notification???

Many thanks in advance!
Uwe

I don’t use HABmin but it can be very helpful to know what specifically you tried and what about it didn’t work.

It also will help to know your Items and how they act.

An understanding of the wider context is needed as well. For example, is opening the garage going to be the only way this light gets turned on?

Look to the openHAB Cloud Connector/myopenhab.org service for good way to send out push notifications. There is also support for a number of push notification services you can use if you prefer. Look to the Actions list of add-ons. Email is one of the options as well.

Here is a Design Pattern showing how to create Expire Binding based Timers. I use these to tell me when my doors have been open for more than an hour.

There is another Design Pattern that specifically shows how to centralize your notification logic so you can experiment with different ways to send notifications without needing to change it all over the place.

So applying the above:

Contact GarageDoor ...
Switch GarageDoor_Timer { expire="30m,command=OFF" }
String Alert
rule "Garage Door Opened"
when
    Item GarageDoor changed to OPEN
then
    GarageDoor_Timer.sendCommand(ON)
end

rule "Garage Door open for 30 minutes"
when
    Item GarageDoor_Timer received command OFF
then
    Alert.sendCommand("The garage door has been open for 30 minutes")
end

rule "Alert notification"
when
    Item Alert received command
then
    logInfo("Alert", Alert.state.toString)
    // make your call to the alert binding chosen
end

Notice these are really simple one-line rules.

The light will be a little more complicated based on the additional information you provide but it will likely look very similar.

1 Like