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?
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!
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.