icloud integration allows you to detect presence using the iCloud service. iCloud allows users to track their location on iOS devices.
There is currently support for the following platforms within Home Assistant:
It does require that your devices are registered with the Find My service.
There is two ways to integrate iCloud in Home Assistant
Menu: Configuration -> Integrations. Search for “iCloud”, add your credentials, click submit.
If you add the integration for the first time for an account:
- Choose a trusted device from the list and submit.
- It will send you a text message on your trusted device, add the received code to the next form and submit (if you missed the right code, you will be back to the previous step, and retry).
- You are done!
If you already added the integration before, you are done!
Add the following section to your
# Example configuration.yaml entry icloud: - username: USERNAME password: PASSWORD
Your iCloud account email.
Your iCloud account password.
A friendly name for your iCloud account. If this isn’t given, it will use the part before the
@of the username.
Maximum interval in minutes between subsequent location updates. This tracker uses dynamic intervals for requesting location updates. When the iPhone is stationary, the interval will eventually be set to
max_intervalto save battery. When the iPhone starts moving again, the interval will be dynamically updated to 1 min. Note that updating interval to 1 min might be delayed by maximum
max_intervalminutes. Minimum value is 1 min.
iCloud location updates come with some gps_accuracy varying from 10 to 5000 meters. This setting defines the accuracy threshold in meters for a location update. Less accurate updates will be discarded by this tracker. This allows for more precise location monitoring and fewer false-positive zone changes.
For the notification, press “Allow”, then “OK”.
If 2 Step Authentication is enabled for your iCloud account, some time after Home Assistant startup the integration will ask which device you want to use as the Trusted Device via a notification in the Home Assistant UI. The integration will send an SMS prompt to that device with the auth code to enter in Home Assistant. The duration of this authentication is determined by Apple, but is currently 2 months, so you will only need to verify your account every two months.
2 Factor Authentication is the improved version of 2 Step Authentication and is still not supported by the pyicloud library. Therefore it’s not possible to use it with the device_tracker yet.
To prevent excessive battery drainage, a dynamic interval is used for each individual device instead of a fixed interval for all devices linked to one account. The dynamic interval is based on the current zone of a device, the distance towards home and the battery level of the device.
Go into your Home Assistant configuration
.storage folder and delete the “icloud” folder, then retry.
The iCloud integration will track available devices on your iCloud account.
The iCloud integration will add a battery sensor for each iCloud devices available on your iCloud account.
4 services are available:
This service can be used to ask an update of a certain iDevice or all devices linked to an iCloud account. Request will result in new Home Assistant state_changed event describing current iPhone location. It can be used in automations when a manual location update is needed, e.g., to check if anyone is home when a door been opened.
This service will play the Lost iPhone sound on your iDevice. It will still ring if you are on “Mute” or “Do not disturb” mode.
This service will display a message on your iDevice. It can also ring your device.
This service will put your iDevice on “lost” mode (compatible devices only). You have to provide a phone number with a suffixed country code and a message.