How do I invoke Android "Find my device" from Openhab?

I know this is possible for Apple devices using the iCloud binding but I am i looking for a way to do the same thing for Google devices.

The android device manager has similar functionality - however I have been unable to find any API to invoke for find my android. Searching various forums reveals that google does not make this API public.

There are some solutions using multiple ifttt rules. This is one possible solution path, but it is nowhere near as optimal as using the native android device manager:

  • Will require a more complex set of rules for multiple phones (1 to increase volume, wait a bit, then 1 to ring)
  • The phone will go to voicemail fairly quickly, as opposed to find my device which will ring for 5 minutes

While there is no official method to invoke the find my device from Google, has anyone hacked anything together into a script that can call the appropriate web function?

Have others solved this problem in a different way? I assume there is a tasker route I could pursue, but historically I have had limited reliability with my tasker automations.

I came up with a solution that works, but I don’t think it is as good as using the native “Find my Device”.

I am using tasker as described here except that I am using tasker autoremote which I then invoke from an HTTP binding. I expose the switch to alexa and I can then ask Alexa to “Turn on find my phone” and it works.

I don’t like that I have to rely on tasker and tasker auto remote. But for right now it works.

@broconne did you find a more native solution?

I just figured out that the google search for “find my android” allows you to let your phone ring.
it calls: POST https://www.google.de/android/find/xhr/dc/ring?xtdc=token
body: [“numericId”, “hexid”] + auth cookie

If I copy everything to postman I can trigger multiple rings - but I have not idea how to create those tokens or keeping them alive… (but the token can be used after some hours - let’s see how log it lasts…)

Nope, I am still using my tasker solution. It works but is still not as good as the pure android solution.

Anything new on this topic, is there a native solution for using “Find my device”?

I think you should be able to use Selenium to execute the call.
Selenium is an interface / web driver between programming language like python and a browser to remote control a ( headless ) browser.

I actually did this - but it’s not so easy. Google is blocking selenium logins and I have 2factor enabled.
So I decided to use and refresh the login cookies. Also the headless Browser needs to run somewhere (headless). Took me a few tries to get it running in docker.

I uploaded my solution here: https://github.com/lukeIam/MqttFindMyPhone
Feel free to use/adapt it on your own risk.

2 Likes

@broconne check out Android Phone Finder from OpenHAB (Google Assistant and Alexa)

Inspired by @JustLuke’s mqtt idea