-
Notifications
You must be signed in to change notification settings - Fork 0
Post Setup Advice
Michael Shaffer edited this page Feb 27, 2026
·
4 revisions
Tips and best practices after the Android Management API integration is configured in Home Assistant.
- Policies are created and managed in the Android Management API (or the Android Management console).
- In the integration’s Options flow, the Apply Policy step requires a policy ID (e.g.
policy1). Create this policy in the console first, or create/update it via theandroid_management_api.set_policyorset_kiosk_policyservice, then use that same ID when applying from the Options flow. - The Options flow fetches the live policy from the enterprise when you open it, so the form reflects what’s currently applied.
To enroll a new Android device using the QR code:
- Open the QR code in Home Assistant — Go to Settings → Devices & Services, select your Android Management API integration, then open the Enrollment QR Code image entity. The QR code is generated (or refreshed) when you open the entity; each token is valid for 24 hours.
- Prepare the Android device — Factory reset the device (or start with a device that has not been set up). During the initial setup wizard, choose the option to Set up as work device or Enroll with QR code (wording may vary by manufacturer and Android version). If you don’t see an enrollment option, tap the setup screen several times (e.g. six times on the Welcome screen) to reveal the QR code scanner.
- Scan the QR code — When prompted, scan the QR code displayed in Home Assistant (e.g. on your computer or phone screen). The device will enroll in your enterprise and apply the policy configured for new enrollments.
- Verify — The new device will appear under your integration after the next coordinator poll (about 60 seconds). You can then assign or adjust its policy via the integration or Options flow.
For custom token duration or to get token data programmatically (e.g. for NFC or other provisioning), use the android_management_api.create_enrollment_token service and listen for the android_management_api_enrollment_token_created event.
- The integration uses a DataUpdateCoordinator that polls the Android Management API. The scan interval (default 60 seconds) can be changed in Configure → General.
- Newly enrolled devices appear after the next poll; removed or wiped devices disappear after the next update.
- If a device doesn’t show up, confirm it’s enrolled in the same enterprise and that the service account has access to that enterprise.
-
Developer Tools → Services: Call
android_management_api.set_policy,android_management_api.set_kiosk_policy,android_management_api.create_enrollment_token, and device-level services (clear_app_data,start_lost_mode,stop_lost_mode,patch_device,wipe,add_esim,remove_esim,request_device_info,issue_command,reset_password) with the parameters documented in the README. - Automations and scripts: Use the same service names and parameters to manage policies, tokens, and devices from automations or scripts.
-
Events: After
create_enrollment_token, listen forandroid_management_api_enrollment_token_createdto get the token payload.
- Per-device buttons (Reboot, Lock, Reset Password, Factory Reset, Unenroll, Relinquish Ownership, Clear app data) send commands through the API. The device must be ACTIVE (or in a state that accepts the command) for the action to apply. Clear app data uses the package names configured in Configure → General.
- Paste JSON: The full contents of the service account JSON key are stored in the integration config. Prefer this if you don’t have filesystem access on the Home Assistant host.
- File path: If you use a path to the JSON file, ensure the path is correct on the Home Assistant host (e.g. in a mounted volume or add-on path). Restart may be required after changing the file.
If you run into errors, enable Debug Logging and check the logs.