Notify OpenHAB of incoming calls on my smartphone

I’m looking for a way to let my OpenHAB know when I get a call on my mobile (Android). So it would be possible that, for example, the playback on my SONOS, Kodi or Chromecast is automatically paused. With my landline phone, I have already realized this with the help of FritzBox binding.

I came up with a solution with the Android app Tasker, which sends an HTTP request to the REST API of my OpenHAB for certain events (eg incoming call). This solution is in the configuration on the smartphone, however, quite cumbersome and the login data for openHAB are stored in plain text in this app. Therefore I am not 100% satisfied with it.

Now I have thought about programming my own little Android app for this use case, which addresses OpenHAB via the REST API during the corresponding events and changes the status of individual items. Are there any other people here who might be interested in such a solution? Are there any additional ideas or suggestions? Or maybe someone has already realized something like that?

(Please excuse me if this is not the place for this post.) :slightly_smiling_face:

I’ve had some luck with Caller ID notifications the other way around using “Notifications for Android TV” from the Google Play store. I use it to send notifications from OpenHAB to my Android TV using a CURL script, but it seems like it might be fairly simple to use the phone client half to send notifications the other way to a listening socket on the same network. Would not work with the REST API since you would have to adapt to the protocol already in the app. The payload data was pretty easy to decipher.

Just a thought…

1 Like

I’m doing it with tasker and mqtt client

I’d rather see the openHAB Android app accept intents from Tasker. Then we can let the app keep the username/password and figure out whether it needs to go through myopenhab.org or can connect locally.

It’s been asked for before and there may even be an Issue open to address it.

Other ideas:

  • set up OpenVPN and connect to the server port 8080 directly. No more need for username password and then you can set up something like PiHole to use while you are out and about

  • set up an SSH tunnel using JuiceSSH and have Tasker communicate to your OH server through the tunnel

  • Create your Tasker app then use the App Creator to convert your task to an apk. Then at least your username and password would be embedded in compiled code instead of plain text. Not much of an improvement but better than nothing.

  • Use one of the MQTT plugins to Tasker and issue an MQTT message over a secure/cert protected connection to your broker, or using one of the free external brokers like CloudMQTT.

  • Set up AutoRemote on a machine on your home network and have Tasker issue a message though AutoRemote and on the home machine issue the REST command locally, bypassing the need for username and password.

Thanks for your Feadback.

Another fundamental problem with using Tasker for this use case is unfortunately that the phone number can not be passed if I let a task trigger as soon as my phone rings. Although there are the variables %CNUM and %CNAME, the number and name of the caller should contain, but unfortunately, these always include only the number zero for me.
However, this would be a nice extra feature if, for example, in Kodi a notification would be displayed who is calling.

I’ve not done much with the call events in Tasker but perhaps a brief wait in the task will give those variables time to be populated?

Unfortunately, this does not change anything.
When I trigger an event on a missed or answered call, the variables contain the correct values, but the incoming call event (phone ringing) does not appear to fill these variables.

Perhaps with IFTTT installed on your phone ?

Aymeric

Just to throw my hat in the ring…

I think, (based on very old information from when I had dealing with mobile phones) it’s something to do with the phone not knowing which list to add the number to.

When the phone is ringing… The number hasn’t been answered, missed or dialed.

Did this go anywhere? The android openhab integration would be nice

Yes, it works well for me now. The reason why the incoming phone number was not transmitted, was actually the parallel installed IFTTT app, which I therefore have now uninstalled.
Using the REST API, the Tasker App now reliably sends the phone number and the corresponding name to corresponding items on my openHAB. The only not so good point in this solution: The OpenHAB access data (HTTP authentication) must be stored in plain text within the server URL in the Tasker app.

Hi Jan

Thanks for the reply. Can you share your rules, items and Tasker setup on your phone?

Ive begun doing this, Ive never used Tasker but can successfully post updates to the item from app.

Thank you!

Hi @Jan.S could you make a Solutions&Tutorials post on how to do this, please?

1 Like

Mabe this yould be made easier with the new TaskerNET.

1 Like

Can someone test out the following shared Task?

https://taskernet.com/shares/?user=AS35m8kUuK3OLwOeerzwoTliAX%2B%2FTPWRXm474S3LSRumiYN32eEodwHjMBursvN2IFK1&id=Task%3ASend+Command+to+openHAB

In particular, I want to know whether the variables also get exported and whether they retain the values I have them populated with. I couldn’t find the answer in my search through the docs and can’t figure out how to test this myself short of destroying my Tasker setup.

I’ve a couple of Tasks I’d like to share that are relevant to OH but need to make sure I’m not sharing passwords and the like in the process. :wink:

The Task is just a stub for how to send a command to OH. It requires some editing to work:

  • populate OHSERVER ad OHPORT variables
  • modify the http action in the task with the Item name and command to send.

If the variables do get populated in the export I’ll probably default to openhabian and 8080 for them.

Many thanks!

Done
Does not do anything

“Failed to issue command to openHAB:-1”

Right, you need to modify it to make it do something per the description.

Can you check to see if it created the two variables and if so what is in them? If the server has argus.koshak.net then it is copying my full variable. If the variable doesn’t exist then you will need to create it.

The task is really just a stub. You will need to edit at a minimum the OHSERVER variable to point to your OH server or user:password@myopenhab.org and edit the task itself with an Item name and command to send.

The failed message is what you get if Tasker cannot connect to OH.

Thanks for checking!

It has the variables created
I have changed them to 192.168.0.12 and 8080 respectively.
I have modified the item to one of my lights and the command to ON
Doesn’t work.
But maybe it’s a network problem not your task
I’ll have to double check later

Thanks! Were the variables populated? That is good to know.

The variables were there but “null”. There was no value. I has to set them.