Sync to Home Assistant
Push Apple Health metrics directly to Home Assistant as sensor states. Each metric becomes a sensor.<prefix>_<metric> entity you can use in dashboards, automations, and Lovelace cards.
Prerequisites
- Health Data Export app (iPhone)
- Home Assistant instance accessible from your iPhone (local network or Nabu Casa)
- A long-lived access token from Home Assistant
Setup
- Open the app → Settings → Sync
- Tap the provider selector and choose Home Assistant
- Enter your Home Assistant URL (e.g.
http://homeassistant.local:8123or your Nabu Casa URL) - Generate a long-lived access token: HA Profile page → scroll to Long-Lived Access Tokens → Create Token
- Paste the token — stored securely in the iOS Keychain
- Set your entity prefix (e.g.
health) — sensors will be namedsensor.health_steps,sensor.health_sleep, etc. - Tap Test Connection to confirm HA can be reached
- Enable Auto-Sync and choose your sync interval
Sensor Reference
| Entity ID | State | Unit | Attributes |
|---|---|---|---|
sensor.<prefix>_steps |
daily step count | steps | friendly_name, source |
sensor.<prefix>_sleep |
sleep duration | hours | friendly_name, unit_of_measurement |
sensor.<prefix>_resting_heart_rate |
resting HR | bpm | friendly_name, source |
sensor.<prefix>_hrv |
HRV SDNN | ms | friendly_name, source |
sensor.<prefix>_active_energy |
active calories | kcal | friendly_name, source |
sensor.<prefix>_weight |
body weight | kg | friendly_name, source |
Example Automation
automation:
- alias: "Recovery Mode when Sleep < 6h"
trigger:
platform: state
entity_id: sensor.health_sleep
condition:
condition: numeric_state
entity_id: sensor.health_sleep
below: 6
action:
service: scene.turn_on
target:
entity_id: scene.recovery_mode
Troubleshooting
- "Connection refused" — Check your HA URL. Must be reachable from the iPhone (same network, or use Nabu Casa remote access).
- "401 Unauthorized" — Token is invalid or expired. Generate a new long-lived token in HA.
- Sensors not appearing — They are created on first sync. Trigger a manual sync, then check HA Developer Tools → States.
- HTTPS + self-signed cert — iOS may reject self-signed certs. Use a trusted cert or Nabu Casa.
See also: Home Assistant setup guide and Local API Reference.