Wearables & IoT Devices
The Device Fleet console is where you connect consumer wearables and register bedside IoT devices, see their readings, and set alert rules. This page explains what it does, how a patient is enrolled, how readings are stored, and what is not available yet.
Two separate back ends sit behind the one console:
| Family | Service | How data arrives |
|---|---|---|
| Consumer wearables (Fitbit, WHOOP, and so on) | Wearables service | The service pulls from the provider's cloud API after the patient authorizes access. |
| IoT / bedside devices | Connect (IoT) | The device publishes over MQTT using an mTLS certificate issued when you register it. |
This page is mostly about the wearables service. IoT registration, alert rules and thresholds belong to Connect and are summarized in Alerts.
Open the console
Go to Tiet · Connect > Device Fleet (route /iot-wearables). Each tab has its own address, /iot-wearables/<tab>, so you can bookmark it.
You need at least one of these permissions to see the console: read:iot, manage:iot, read:wearables, manage:wearables. Tabs you cannot use are hidden:
| Tab | Shown when you have |
|---|---|
| Monitoring, Devices, Vitals | any of the four read or manage permissions |
| Providers | read:wearables or manage:wearables |
| Enrollment, Alerts | read:iot or manage:iot |
| Automations | manage:wearables |
| Settings | manage:iot or manage:wearables |
The Onboard device button (top right) needs manage:iot or manage:wearables.
Providers: what really works
The Providers tab lists nine providers seeded by the database migration: Garmin, Apple Health, Samsung Health, Fitbit, Oura Ring, WHOOP, Polar, Suunto and Movesense. Listing a provider does not mean data flows from it. This is what the running service does, read from its code:
| Provider | Connection mechanism | Data collection in the running service |
|---|---|---|
| Fitbit | OAuth 2.0 | Pulled by the sync engine: activity, sleep, heart rate (1-minute detail), body composition, SpO2. Writes vital_readings and publishes to MQTT. |
| WHOOP | OAuth 2.0 | Pulled by the sync engine: recovery, cycles (strain), sleep, workouts. A signed webhook at POST /api/v1/webhooks/whoop triggers a 2-day re-sync; a user.deleted event revokes the connection. |
| Garmin | OAuth | The patient can authorize, but the sync engine has no Garmin branch, so scheduled and manual syncs skip it. The Garmin webhook handler is never mounted. |
| Oura Ring, Polar, Suunto, Samsung Health | Provider packages exist in the repository | Not connected to the running server: the OAuth client factory accepts only fitbit, garmin and whoop, and the sync engine only fitbit and whoop. Oura has no webhooks (its own integration note says data must be polled). |
| Apple Health | Export-file import, no OAuth | An import service that parses an exported HealthKit XML file exists, but no HTTP endpoint or UI calls it. |
| Movesense | Bluetooth research sensors | Planned. Seeded as a row with sync interval 0; no code. |
Configure a provider
- Open Providers and choose Configure on the provider card.
- Enter the Client ID and Client secret you registered with that provider. The drawer also shows the Redirect URI to register, plus a sync Frequency and a webhook setting.
- Choose Test. The result toast shows
ok,warningorerrorwith a message.
Each card shows Auth (OAuth 2.0 or Direct), Credentials (Configured, Missing or a dash), Webhooks (Active or Off) and Sync (every <n>m, the provider's default interval).
Enroll a patient
A clinician invites the patient; the patient approves access on the provider's own sign-in page. Tietai never sees the patient's provider password.
- Open Onboard device and choose Consumer wearable.
- Choose a provider. Each provider shows a status: Ready, Needs creds (OAuth enabled but no client ID and secret saved) or Disabled. Configure a provider that needs credentials first.
- Enter Patient name (required). Add Email or Phone if you will deliver by email or SMS.
- Under Data to sync, keep or change the selected data types. The choices are
heart_rate,resting_heart_rate,heart_rate_variability,breathing_rate,spo2,activity,sleep,skin_temp,weight,temperatureandprofile. The default isheart_rate,activity,sleep. - Under How to deliver, choose Email, SMS, QR code or Copy link. Email and SMS are greyed out when the service has no SendGrid or Twilio credentials configured.
- Choose Send invitation.
You should see Invitation created with a magic link (<frontend>/patient-connect/<token>) and a QR code. If you chose email or SMS, the text says it was sent; otherwise it asks you to share the link.
The patient opens the link, reviews the data types and gives consent, then is redirected to the provider to authorize. When the provider calls back, the service stores the encrypted tokens, creates the device, marks the invitation Connected and starts a 30-day backfill in the background.
Manage invitations
Open Enrollment. The Enrollment invitations panel lists invitations for your organization (up to 100) with a status filter: All, Pending, Consent given, Connected, Expired, Revoked.
| Action | Available when status is |
|---|---|
| Copy invite link | Pending, Consent given |
| Resend invitation | Pending, Expired |
| Revoke invitation (asks "Revoke?") | Pending, Consent given, Connected |
An invitation expires 7 days after it is created. A background job marks old invitations expired every hour. The patient-facing link allows at most 30 requests per hour per token.
The Onboard drawer generates a new random patient ID for each invitation. It does not pick an existing patient record, so the wearable's data is keyed to that new ID. Plan for this when you link readings to a clinical record.
Devices, sync and the schedule
The Devices tab lists IoT devices and wearables together. A row menu offers, depending on your permissions and the device's status:
- Edit device
- Sync now (wearables only)
- Pause syncing / Resume syncing (wearables) or Suspend device / Reactivate device (IoT)
- Delete device
Scheduler
The wearables service runs a scheduler on start and then every SYNC_INTERVAL_MINUTES minutes (default 30; a value under 1 minute falls back to 30). Each run picks up to 50 active devices whose next_sync_at is due and syncs the last 1 day. A device created through the API defaults to a 60-minute interval.
Manual sync
Sync now calls POST /api/v1/devices/{id}/sync. The body is optional; days (1 to 90, default 7) sets the look-back window. The call returns 202 Accepted with "status": "running" and the sync runs in the background. Follow progress under Automations, which lists running and recent sync jobs.
A sync log records status success, partial or failed, plus records fetched and duration.
data_types, from_date and to_date are accepted in the request body but the manual sync uses only days.
Where readings are stored and published
For Fitbit and WHOOP the service does two things with every reading:
- Stores it in the wearables database table
vital_readings(columns: patient, device, organization,metric,recorded_at,value,unit). A reading is unique per patient, metric and timestamp, so a repeated sync updates rather than duplicates. - Publishes it to MQTT, when a broker is configured (
MQTT_BROKER; without it the service logs "MQTT disabled" and keeps running), at QoS 1.
| Topic | Content |
|---|---|
wearables/vitals/{org_id}/{patient_id}/{type} | one vital reading |
wearables/activity/{org_id}/{patient_id} | activity or workout |
wearables/sleep/{org_id}/{patient_id} | sleep session |
wearables/device/status/{org_id}/{device_id} | device status |
wearables/sync/{org_id}/{event} | sync start, complete, failed |
Every vital message carries source_type: "consumer_wearable", clinical_grade: false and a device_class. Treat wearable data as wellness data, not as a clinical-grade measurement.
The wearables service contains no FHIR or LOINC mapping. It does not write FHIR Observations. Connect has a FHIR mapper for IoT device readings that use LOINC codes, but that mapper listens to the IoT broker's tietai/v1/<org>/devices/... topics. No subscriber for the wearables service's wearables/... topics was found. Do not assume wearable readings reach the FHIR store.
Read vitals
GET /api/v1/patients/{patientId}/vitals (requires a JWT with an organization_id claim). The Vitals tab and the device-data-source workflow node both use it.
| Parameter | Meaning | Default |
|---|---|---|
type | One metric name (see below). Empty returns every metric that has data. | all |
resolution | raw, hourly or daily. Applied to heart_rate only; other metrics are returned as stored. | hourly |
from, to | RFC 3339 timestamps, rounded down to the start of the UTC day. | yesterday to end of today (UTC) |
The range is capped at 30 days. Parameters the console also sends, such as limit and metric, are ignored.
Metric names: heart_rate (bpm), resting_heart_rate (bpm), spo2 (%), steps, sleep (hours), calories (kcal), active_minutes (min), distance (km), breathing_rate (brpm), heart_rate_variability (ms), skin_temp and skin_temperature (degrees C), weight (kg), bmi, recovery_score (percent), strain_score.
The response is {"vitals": [...]}, one entry per metric with data:
{
"vitals": [
{
"patient_id": "00000000-0000-4000-8000-000000000001",
"device_id": "00000000-0000-4000-8000-0000000000d1",
"metric": "heart_rate",
"unit": "bpm",
"data_points": [
{"timestamp": "2026-01-01T08:00:00Z", "value": 71.5, "source_device_id": "00000000-0000-4000-8000-0000000000d1"}
],
"summary": {"min": 71.5, "max": 71.5, "avg": 71.5, "count": 1}
}
]
}
If the patient has no active device in your organization, you get {"vitals": []}, not an error.
Alerts
Alerts and rules in the console are served by Connect's IoT service, not by the wearables service. The wearables service has /alerts and /thresholds routes, but they return empty lists and do nothing.
Under Alerts, Define opens the rule editor:
| Field | Meaning |
|---|---|
| Rule name, Description | Free text. |
| Severity | Info, Warning, High, Critical. |
| Measurement | One of Heart rate, SpO2, Blood pressure, Temperature, Glucose, Respiration, ECG, Weight, Spirometry (stored as HEART_RATE, PULSE_OXIMETRY, BLOOD_PRESSURE, BODY_TEMPERATURE, BLOOD_GLUCOSE, RESPIRATORY_RATE, ECG, WEIGHT, SPIROMETRY). |
| Condition (CEL expression) | Evaluated on each reading; the alert fires when it is true. |
| Cooldown (min) | Default 5. |
| Apply to | All devices, Specific devices, Organization units. |
Built-in templates for the condition: value < 90 (SpO2), value > 120 and value < 50 (heart rate), systolic > 180 and systolic < 90 (blood pressure), value > 39.0 (temperature), value > 250 and value < 70 (glucose). Blood pressure conditions can use systolic and diastolic, for example systolic > 180 || diastolic > 110.
Active alerts have an Acknowledge button. Rules can be switched on and off, edited and deleted.
Settings and Automations
- Settings has three sub-tabs, all saved for the current organization: Thresholds (warning and critical vital-sign thresholds), Destinations (where device data is routed) and Organization (care-delivery hierarchy).
- Automations lists each wearable device's sync frequency (
Manual, orEvery <n>m,Every <n>h), a Sync now action, running and recent sync jobs, and deployed pipelines with their cron schedule and a Run now action.
Use device data in a workflow
The device-data-source node (category healthcare) fetches a patient's metrics for a time window and merges wearable and IoT sources.
| Config field | Meaning | Default |
|---|---|---|
patient_id | Patient ID; supports {{token}} from pipeline inputs, falls back to the patient_id input port. Required. | none |
window | {"from": "...", "to": "..."} ISO-8601. Empty values fall back to the window_from and window_to ports. | empty |
metrics | Metric names, such as heart_rate, steps, sleep. | ["heart_rate"] |
sources | wearables, iot, or both. | ["wearables"] |
Output port data (json): patient_id, window, sources, metrics (per metric: summary, raw_url, iot_summary), warnings, alerts, devices. In the code alerts and devices are always empty lists.
For the wearables source the node calls the Vitals API with resolution=daily and signs a 5-minute service JWT when an org_id input and the JWT secret are present. The IoT source calls Connect's /api/analyses/internal/iot-summary. If a single metric fails, the node adds a warning. If every metric fails, the node fails with no device data could be read for patient <id>: ... so a downstream agent never works from invented numbers. A missing patient fails with patient_id is required.
Not available
- Writing wearable readings to FHIR as Observations, and LOINC coding of wearable data.
- Garmin, Oura, Polar, Suunto, Samsung Health and Apple Health data collection in the running server (code exists in the repository but is not wired in), and Movesense.
- Webhook-driven sync for Fitbit and Garmin (handlers exist, are not mounted and only log). Only WHOOP webhooks are active.
- Wearables-service alert rules and thresholds (stub routes).
- A data preview for a connected invitation (
preview_unavailable_reason: "not_implemented").
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| A tab is missing | You lack the permission in the table above. Ask an administrator. |
| Email or SMS delivery button is greyed out | SendGrid or Twilio is not configured. Use QR code or Copy link. |
invitation not found / expired / This link is no longer valid (patient side) | Wrong token, past 7 days, or revoked. Resend or create a new invitation. |
too many requests | The token was opened more than 30 times in an hour. Wait an hour. |
| Connected a Garmin or Oura patient, no readings | The sync engine does not handle these providers. See the provider table. |
| Vitals tab says "No wearable readings for this patient" | No active device in your organization for that patient, or no readings in the range (range is capped at 30 days). Run Sync now and check the sync log. |
Missing organization context (401) | The token has no organization_id claim. |
Something unclear? Send documentation feedback by email.