Push notification with question to intiate action

What possibilities are there to initiate a push notification with a question / input to initiate an action based on the answer?

Possible scenario: Based on presence detection it has been identified that all inhabitants have left the house and the door is unlocked. I would like to create a rule which will be triggered (based on the above situation) and a push notification will be sent to all mobile phones of the house inhabitants: "Nobody is present at home but the door is not locked. Lock the door? [YES] / [NO]

My ask: How would such an implementation look like? Would it be possible with any push notification option or only trough (telegram) chat bots?

You can create a rule to send a notification based on the presents of an item. The rule would look something like this with your notification added:

rule "start gPresent on system start"
when
    System started
then
    Present.sendCommand(OFF) // assume no one is home
end

rule "gPresent updated, at least one change of state"
when
    Item gPresent received update
then
    // someone came home
    if(gPresent.state == ON && Present.state != ON) { 
        Present_Timer.postUpdate(OFF) // cancel the timer if necessary
        Present.sendCommand(ON)
    }

    // no one is home and timer is not yet ticking (otherwise endless loop)
    else if(gPresent.state == OFF && Present.state != OFF && Present_Timer.state != ON) {
        Present_Timer.sendCommand(ON) // start the timer
    }
end

rule "Present_Timer expired"
when
	Item Present_Timer received command OFF
then
	Present.sendCommand(OFF)
end

Look at 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.

Thanks, but this is not what I want. In your example there is an time-out which will trigger the action, but I want to actively ask the user:

I’m looking for an option to receive an answer from the push notification. See my example: “Nobody is present at home but the door is not locked. Lock the door? [YES] / [NO]”

How can I (1) have a input in the notification and (2) receive the input inside the rule?

Hi Dima,

I’m also since a long time on exact this problem. For now I didn’t fount a good solution.

We have here the example, that we have 3 floors and a rule for all Vacuum cleaners that they are running when we are not there (works perfect).

But now we where both at home for two weeks (we where sick) and then no Vacuum cleaner runs.

I will extend the rule, if no complete clean for one day, ask when no movement is in floor (1|2|3) and then ask if for this floor the cleaner can run.

But it’s not possible with: OpenHab App, Telegram, Pushover,…

I’m now on Ifttt, so may be with Tasker together it’s possible.

Jan

Also the Ifttt way together on Shortcuts / Workflows on IOS is working.

  1. Ifttt Trigger (OpenHab Item or Rule with Webhook in Ifttt)
  2. In shortcuts you have to create a workflow with your questions (yes / no) and add there a tigger for
  3. Let Ifttt send a rich notification to your IOS device and add the URL: shortcuts://run-shortcut?name=[ShortCutName]
  4. Ifttt > OpenHab Item via WebHook

Done. Not the best solution, cause it’s working perfect

I just put an iOS app on the App Store to solve this problem for myself.

Hopefully this is useful for others too
https://www.pushcut.io

You can push notifications via HTTP POST, assign shortcuts and run them directly from the notification.
I also plan to add direct support to open URL schemes and maybe HTTP request (like a POST to a URL) directly if anybody is interested (without having to go through extra shortcuts).

I use it to get a „turn off office lights?“ reminder at night und a „washing machine done -> remind me when I get home“ sort of thing.
still playing around myself, any feedback is welcome!

FYI:

Not to take away from the other solutions on this thread, but wanted to post a way via telegram to do this in conjunction with Node Red.

The examples on the page show how easy it can be to just throw up a telegram switch node and you fill out what the question/notification is and what the answers are (along with the number of answers); then you drag lines to the corresponding entries/events you want to occur. Also dig the timeout feature to avoid a mis-press down the road causing an action you didn’t intend.