Looking for app to interact with openHAB, give human input when rules can not decide

I have probably not looked at the right places, or missed the obvious but I am not able to find a solution to this problem:
With increasing automation of my home, I now and then find myself in situations where openHAB is not able to make decisions that are appropriate for me based on rules only. One example to hopefully clarify what I mean:
I load up the washing machine and hit the start button. When the machine starts up, openHAB detects that I am about to run the washer and checks the current price of electrical energy and the price for the next few hours (or whatever time frame is). Assuming that the price right now is very high but it will drop in e.g. four hours, I would like openHAB to push a question to my phone asking me if I want to run the machine now or if it is OK to wait until later. The problem is that openHAB can’t tell if i need to run the machine now or if i can wait until later; it needs a human input in order for the rule to proceed.
So, what I am looking for is an application for the phone with the following:

  • Ability to receive and display a text/question (or possibly also information in other formats) pushed from openHAB
  • Present valid responses (e.g Yes, No, Wait)
  • Return my response to openHAB to allow the rule to proceed according to my choice
  • Not be dependent on any kind of cloud service; pure TCP/IP-communication
  • Using the available bindings in openHAB as much as possible
  • It is desirable that the app communicates the location of the phone relative to the openHAB installation because it doesn’t make sense to ask a person 200km away what he/she wants to do with the washing machine :wink:
  • Have a configurable timeout for each situation; like in the above example, if the human has not responded in, say, 30 minutes then go ahead and run the machine regardless of the energy price.

I wrote a clumsy GOlang hack a year ago and a very ugly UI for the phone that does some of this just to test the idea but now I either want to find something better or I have to sit down and write some code…

Surely, I can not be the only one looking for this functionality? Any pointers to a solution would be appreciated.
TIA/Brus-Per

1 Like
1 Like

What @hafniumzinc said. Telegram has interactive notifications.

My general recommendation is to only automate things that should happen 99% of the time, and not automate anything that regularly requires user input. All of my automations start after a human has made a decision.

In this particular example, I’d have a way to tell openHAB that I want a delayed start to the washing machine. The easiest solution would be a proxy item that can then be triggered by a wireless button, a rule (e.g. toggle the light switch), or a voice assistant. Alternatively, you could just use your phone and go to an openHAB UI. That’s almost the same as having to look at your phone to respond to a notification.

Functionally, it’s the difference between this:

  1. “Start the washing machine.”
  2. “Do you want me to start it now or when the electricity price drops?”
  3. “Start the washing machine when the electricity price drops.”

And this:

  1. “Start the washing machine when the electricity price drops.”

That doesn’t seem like a big difference, but I’d get annoyed having to respond to a notification after I’ve already decided to start the washing machine. Also, I think it’s easier to build and maintain.

I have a similar example, which is turning off my 3D printer (connected to openHAB via octoPrint). Sometimes I want it to turn off immediately after the printer has cooled down, and sometimes I want it to stay on to do another print. So, I’ve put a Z-Wave button next to the printer. If I want it to turn off, then I can press the button and a few minutes later (after I’ve walked away and stopped thinking about it) it turns off. I can also do this from an openHAB UI or Google Assistant.

This is just my personal preference, stemming from a desire to keep my automations simple and straightforward. I don’t use Telegram, but if I did then I’d have it notify me when something changes that may require my intervention. That’s different from triggering an automation and then immediately getting asked to intervene.

I think there are two things that makes a difference, at least in this example:

  • by the time I start the washer, I have no clue of the energy price, I just prepare the machine. If (and only if) the price is high and will be followed by a substantially lower price will the automation halt and ask me.
  • sometimes I want the automation to proceed (here, clothes to be washed) regardless of the price, e.g I’m on my way away and wants it to be done before leaving.

As our automations becomes more elaborate and also rely on outside data (energy prices, weather forecasts, et.c) I think situations occur where the vast majority of the “work” is done by the automation but where human input now and then is beneficial. But I agree, I am not a fan of being nagged by my own automations.
ymmv… :wink:

Interesting! I will take a look at the Telegram binding. Thank you.

Later: Unfortunately, Telegram is a cloud service and if at all possible, I’d like to avoid using the cloud (see item four on my bullet list) for my home automation.

That’s what I try to avoid: “sometimes”.

  • You know that “start immediately” is the less likely choice
  • When you load the washer, you know whether or not you want it to start immediately

So every time you push the Start button, one of two things is guaranteed to happen:

  1. The machine will start immediately (because electricity prices are low)
  2. openHAB will ask if you want to start the machine immediately or wait until later

Rather than wait to see what happens and maybe have to respond to a notification, I prefer to make the decision in advance and walk away.

Note: I failed to mention earlier that with my 3D printer, I can press the button to turn it off at any time (including while a print is in progress). I sometimes press it just when a print is starting. I think this would have made the comp[arison a little more relevant. :wink:

I think that’s where we disagree. In my mind, when a human has to intervene via a user interface, one automation ends in favour of user control…which may trigger another automation. There’s no right or wrong to that–it’s just a question of whether or not human interventions are considered part of the automation.

If so, then I can’t think of anything that’s going to notify you. Even built-in notifications require a connection to myopenHAB (or your own cloud server).

If you want the washing done regardless of cost, press button 1.

If you want it to start only during low electricity cost, press button 2.

Then walk away.

Either way The decision is made once before it started.

If you changed your mind, press the appropriate button to override previous decision.

The buttons can be physical buttons and/or one in openhab UI.

Yep, you’re absolutely correct - that is where we (or our use cases) disagree :slight_smile:

In part, the reason might be like the old game of “truth or consequence”; here in Sweden, the electric energy prices are extremely volatile, we seems to be supplying most of EU with electricity on a market that is a roller coaster ride de luxe. Tonight, the baseprice is 0.045 SEK/kWh. Earlier today the price was 2.69 SEK/kWh (almost 60x). Thanks to automations using openHAB, my total cost of energy is slightly less than half of my neighbor next door even if we “consume” approximately the same amount of energy. Thanks to the openHAB crew!

1 Like

I use the NextCloud Talk plugin as my self-hosted notification system. There’s an extensive API for sending and receiving messages so I can not only get notifications from OH but send responses that trigger events and rules. You do have to have the separate NextCloud Talk app on your device.

The only thing it doesn’t offer that Telegram does is the pre-set response options. Although the newest version of the API does include polling so it may be possible to use that to get the equivalent of pre-set options; I just haven’t had a chance to try it yet.

I have this all set up through the http binding. I’m sure someone more versed than I in the nuts and bolts of binding development could easily whip up a very useful binding for NextCloud Talk.

2 Likes

Interesting. I’ve missed seeing all of the discussion about NextCloud Talk.

Does the app only connect to your local server?

Putting up a tutorial thread is on my to do list, but I’m in that part of the year where things are added to the list far more rapidly than I can knock them back off.

Yep. It just uses your NextCloud server connection however you’ve got that setup.

2 Likes

There was discussion around smart/actionable notifications for the OpenHAB applications (phone/tablet/watch) in the OpenHAB 4 wish list thread. It remains to be seen if any of the developers pick it up or not.
Pushcut (iOS) is another option for those in the Apple ecosystem.

You might need to expose your NC instance to the Internet somehow or use a VPN to get these notifications when away from your LAN. When you are home it uses your local server only.

NextCloud is a pretty decent replacement for most of the common cloud services. I’ve not yet tried using Talk but it’s on my list. But like @JustinG, my todo list grows faster than I can work it off, and that’s even if I just count the OH stuff, let alone the bathroom I’m remodeling, the fact I’m almost out of beer and it’s time to brew :scream:, and shuttling the little one from one activity to the next.

I wonder if HABot had an action to access the NLP could be useful here. :thinking:

Yes, and that is the fall back for any message that I send from the Talk app. First there’s a check to see if the message is a response to a direct query from OH if it is not a recognized response to the most recent specific query then the text of the message is processed by the HABot NLP and HABot’s response is sent back to the the NC chat.

Right, this is what I meant by “It just uses your NextCloud server connection however you’ve got that setup.” only, as usual, clearer.

I hear that. I’ve got a brand new fermenter I’ve been dying to try out and just haven’t found the time yet.