External integration - Apple Device Tracker

Hello,

Here is an external Apple Device Tracker integration:

This allows you to track your Apple devices via Find My and use them as presence sensors.

It should be available on the store soon

Feel free to give me your feedback regarding this external integration.

That’s a great idea @prohand, thanks!
But I can’t see it on the store, even after pressing ‹ refresh â€ş. Do you know if there’s another step I should take? Or just wait a little longer?

I think we need to wait because this hasn’t run since 16:30:

It would be great to have a push button to make your phone ring in addition to the action :slight_smile: :sweat_smile:

Yes, there is another method. There’s a „Install from GitHub“ button for this.
image

You just need to specify the repository and click „Install“

@prohand, I installed and tested it. The iCloud connection is fine, and the discovery tab displays my iPhone. However, it doesn’t detect the 6 AirTags associated with my iCloud account and visible in the Find My app.

I read your documentation, which is very clear by the way. But I didn’t see any specific action to take. And you write « What you get: One Gladys device per Apple device (iPhone,…, AirTag…) Â» so there must be something to adjust somewhere :wink:.

Thanks in advance for your advice.

Thanks for your feedback.
I hadn’t noticed that mine weren’t present :sweat_smile:

Here’s Claude’s feedback on the subject:

The « Objects » (AirTag, third-party trackers) have an end-to-end encrypted position: only the Find My app on Apple hardware decrypts it. iCloud.com only displays the Devices tab.

I’m correcting the info in the doc for version 1.0.2 as well as the cover.png

You can do this in the configuration menu at the bottom:

Oh well… I would have loved to design scenes based on the location of the AirTags. Never mind.

The goal is to have quick access via the dashboard :sweat_smile:

Often, my wife loses her phone and asks me to call her. Then, with my tablets, which are not admin, I just need to click a button and trigger the action.

It’s in place in the new version :wink:
You just need to update the integration as well as the device you’ve already added :slight_smile:

For information, version 1.0.9 has been released, which fixes an issue where you would receive this type of message from Gladys:

You must recreate the devices to avoid the bug

Note that when the device is charging, it no longer appears under the « Battery Â» feature but in a new feature

image

Hello since the update I am no longer connected and when I try to log in I get errors

[2026-09-20T17:25:42.545Z] [INFO] Starting the Apple Device Tracker integration...
[2026-09-20T17:25:42.785Z] [INFO] [gladys-sdk] connected to Gladys (http://172.30.0.1:8455)
[2026-09-20T17:25:43.482Z] [INFO] [icloud] Signed in to iCloud with the saved session
[2026-09-20T17:25:43.706Z] [INFO] [tracker] The iCloud session expired, signing in again
[2026-09-20T17:25:44.437Z] [INFO] [icloud] Signed in to iCloud with the saved session
[2026-09-20T17:25:44.596Z] [ERROR] iCloud connection failed: The iCloud session expired while reading Find My SessionExpiredError: The iCloud session expired while reading Find My
    at ICloudClient.refreshClient (file:///app/src/icloud/client.js:721:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async ICloudClient.fetchDevices (file:///app/src/icloud/client.js:758:19)
    at async AppleDeviceTracker.doRefresh (file:///app/src/tracker.js:504:20)
    at async AppleDeviceTracker.refresh (file:///app/src/tracker.js:464:23)
    at async AppleDeviceTracker.start (file:///app/src/tracker.js:156:5)
    at async initialize (file:///app/index.js:206:20)
    at async GladysIntegration.<anonymous> (file:///app/index.js:464:3)

Help?

Thanks for your feedback, here’s Claude’s response:

Bug cause (visible in your logs):

  • Find My rejects the session (401/421/450) → the tracker calls login()
  • but login() sees a token in memory → it just does accountLogin() again, which Apple still accepts → log « Signed in with the saved session »
  • the retry falls back to the same Find My rejection → « iCloud connection failed » and the integration remains dead

In short: it never really reconnected, it reused the already rejected session.

What I fixed (branch claude/magical-knuth-gqdra9, commit 18109a3):

  • login({ force: true }) : skips the saved session and performs the real password connection (SRP). The trust token is kept → no new 2FA code to enter.
  • The tracker uses this force when Find My rejects.
  • The normal login() also clears rejected tokens + cookies before going back to SRP (before, it resubmitted them).
  • If the first refresh fails on startup, the refresh loop still starts → the integration repairs itself on the next tick, instead of staying silent until the container is restarted.

Fix available in version 1.0.10 that just released :slight_smile:

Version 2 is out with widgets, triggers, and actions :slight_smile:

I use 2 Factor, and have several trusted devices, but I am unable to enter the code as it always results in errors. Even if I request another code (which works!), the aforementioned message still appears and the code still doesn’t go through. Logs attached:

[2026-10-18T13:15:03.596Z] [INFO] Starting the Apple Device Tracker integration...
[2026-10-18T13:15:05.006Z] [INFO] [gladys-sdk] connected to Gladys (http://172.30.0.1:8420)
[2026-10-18T13:15:05.044Z] [INFO] Home coordinates pre-filled from the Gladys house
[2026-10-18T13:15:05.749Z] [INFO] Waiting for the Apple ID and password to be filled in
[2026-10-18T13:17:55.527Z] [INFO] [home-location] Presence is measured from the picked Gladys house
[2026-10-18T13:17:55.527Z] [INFO] onConfigUpdated -> the Apple account changed, signing in again
[2026-10-18T13:17:55.552Z] [INFO] [home-location] Presence is measured from the picked Gladys house
[2026-10-18T13:17:56.874Z] [INFO] [icloud] iCloud accepted the password and is asking for a two-factor code
[2026-10-18T13:17:57.147Z] [INFO] [icloud] Apple two-factor state: trusted device(s) available, 0 trusted phone number(s)
[2026-10-18T13:17:57.498Z] [INFO] [icloud] Apple pushed a two-factor code to the trusted devices
[2026-10-18T13:17:57.603Z] [INFO] Two-factor code required
[2026-10-18T13:18:26.365Z] [INFO] [icloud] Apple two-factor state: trusted device(s) available, 0 trusted phone number(s)
[2026-10-18T13:18:26.892Z] [WARN] [icloud] Apple did not push the code to the trusted devices (HTTP 409) [HTTP 409]
[2026-10-18T13:18:53.679Z] [INFO] [home-location] Presence is measured from the picked Gladys house
[2026-10-18T13:19:51.343Z] [INFO] [icloud] Apple two-factor state: trusted device(s) available, 0 trusted phone number(s)
[2026-10-18T13:19:51.835Z] [WARN] [icloud] Apple did not push the code to the trusted devices (HTTP 409) [HTTP 409]

Thanks for the logs and screenshot, that helped find the issue right away :+1:

The cause: recently, Apple responds with « HTTP 409 » even when the code is correct. The actual result is hidden in the response, and the integration was taking this 409 as a rejection. That’s why all your codes were being declined.

Fixed in version 2.4.1, which just came out:

  • a correct code is now accepted, even if Apple responds with 409;
  • the « new code » button no longer stops on error 409;
  • trusted phone numbers are better detected, so SMS sending works if needed.

To do:

  1. Update the integration to 2.4.1.
  2. Click on « Request New Two-Factor Code » (request a new code).
  3. Enter the received code in « Submit Two-Factor Code ».

If it still gets stuck, send me the new logs, especially if they contain a message right after entering the code.

The button names are in German as in the screenshot. I can also provide a German version if you’d like.

If that’s not Claude chatting, @prohand thinks he’s Alain Delon :joy:

Lmao the extra copy-pasted line :sweat_smile:

Thank you very much. It works now :slight_smile:

I found two more things that seem to be a problem:

a) No battery status is being transmitted from any of my Apple devices (8 in total). All log:

[2026-10-18T15:30:30.025Z] [INFO] [tracker] iPad: Find My reports no charging state (batteryStatus: Unknown), so the Charging feature stays empty

b) Although Family Sharing is enabled in the configuration, I only see my own devices, no shared devices from my family. There is nothing in the log.

The battery issue is resolved. It took about 5 minutes for the battery value to be transmitted. The property is now available. :call_me_hand: