Home Assistant Viatom Oximeter Integration
Find a file
2026-11-07 11:33:10 -05:00
assets Add Viatom Oximeter integration for SleepImage PO6 over Bluetooth 2026-11-04 11:58:19 -05:00
custom_components Report the recordings average pulse rate from the samples, to 0.1 bpm (the device rounds it down), keep the waveform before the first and latest gaps in diagnostics, and bump the version to 0.4.1 2026-11-07 11:33:10 -05:00
tests Report the recordings average pulse rate from the samples, to 0.1 bpm (the device rounds it down), keep the waveform before the first and latest gaps in diagnostics, and bump the version to 0.4.1 2026-11-07 11:33:10 -05:00
.gitignore Add Viatom Oximeter integration for SleepImage PO6 over Bluetooth 2026-11-04 11:58:19 -05:00
hacs.json Download recordings, sync the clock and use the PO6s setting names 2026-11-05 12:06:25 -05:00
LICENSE Add Viatom Oximeter integration for SleepImage PO6 over Bluetooth 2026-11-04 11:58:19 -05:00
pyproject.toml Add Viatom Oximeter integration for SleepImage PO6 over Bluetooth 2026-11-04 11:58:19 -05:00
README.md Report the recordings average pulse rate from the samples, to 0.1 bpm (the device rounds it down), keep the waveform before the first and latest gaps in diagnostics, and bump the version to 0.4.1 2026-11-07 11:33:10 -05:00

Viatom Oximeter for Home Assistant

Live SpO2, pulse rate and perfusion index from the SleepImage PO6 fingertip oximeter, over a local Bluetooth adapter or ESPHome Bluetooth proxies.

The PO6 is made by Viatom (FCC ID 2ADXK-4708) and speaks the same BLE protocol as Viatom's other PO-family devices (Wellue O2Ring, KidsO2, Checkme O2), so those will probably work too.

Install

  1. Copy custom_components/viatom_oximeter into your Home Assistant config/custom_components/ folder (or add this repo to HACS as a custom repository).
  2. Restart Home Assistant.
  3. Put a finger in the PO6 to switch it on. It advertises as SI PO6 0042, where 0042 is the device ID you registered in the SleepImage app, and is discovered automatically under that name. Otherwise add Viatom Oximeter from Settings → Devices & services → Add integration.

Requires Home Assistant 2026.2 or newer. Available in English and French.

The integration icon (in brand/) shows from Home Assistant 2026.3; older versions show a placeholder. The frontend caches brand images for up to a day, so if the placeholder stays after installing or updating, hard-refresh the browser (Ctrl+Shift+R). The icon's source is assets/icon.svg.

Bluetooth proxies

The PO6 needs an active connection, not just passive advertisements, so proxies must have active connections enabled:

esp32_ble_tracker:
  scan_parameters:
    active: true

bluetooth_proxy:
  active: true

Each connected PO6 holds one of the proxy's connection slots (three by default) for as long as it is on a finger.

Entities

Entity Notes
SpO2 (%) unknown while acquiring signal or with no finger
Pulse rate (bpm)
Perfusion index (%)
Motion Raw movement intensity, 0–255; unknown with no finger
Battery (%) Keeps its last value after the device switches off
Finger detected On the charger, only once a finger gives readings
Charging
Connectivity Whether Home Assistant currently holds the connection
Signal strength (dBm) Disabled by default. From the device's advertisements, which stop while it is connected: it then keeps the level heard just before
Bluetooth adapter Disabled by default. The adapter or proxy holding the connection (when it reports its connections, as ESPHome proxies do), otherwise the one hearing the device best
Live monitoring (switch) Turn off to release the device for the SleepImage app
Signal (event) acquiring when a finger goes in, acquired once SpO2 comes through, lost if it drops out while the finger stays in
Charge (event) complete when a charge with the finger out ends at 100% (or the device reports full)

The two event entities show Unknown until their first event, as all event entities in Home Assistant do.

Live values are unavailable whenever the device is off. The PO6 only powers on while a finger is in the sensor, so this is normal.

The PO6 stays awake while something is connected to it, even with no finger in. So once the finger has been out for 30 seconds, Home Assistant lets go of it and leaves it alone until it has switched itself off. When you put your finger back in, it reconnects within about 10 seconds.

If the finger goes back in before the PO6 has switched off, Home Assistant only notices at its next check-up. Check-ups are 1, 2, 4 and 8 minutes apart, then every 10 minutes, and each lets go again at once if there's still no finger. To connect straight away, turn Live monitoring off and on again.

On the charger the PO6 stays on, but while anything is connected it shows a connection screen instead of its charging screen. So while it charges, Home Assistant reads it and lets go, then comes back every 2 minutes for a few seconds to update the battery level and notice when the charge is complete. After you unplug it and put it on, live readings can take up to those 2 minutes to start; turning Live monitoring off and on connects at once.

Plugged in with a finger still in, the PO6 stops measuring, shows a connection screen and repeats its last reading until it is unplugged. Real readings never stay exactly the same for long, so after 60 seconds of identical readings Home Assistant shows the live values as unknown. It stays connected, so they come back within a poll of unplugging. In that state the PO6 also reports a battery of 100% and flips its charging flag, so Battery keeps its last real level and no charge counts as complete.

The poll interval (default 2 s), the recordings folder and how long to keep recordings (default 12 months) can be changed under the integration's Configure button.

Device settings

Viatom devices report their settings when Home Assistant connects, and models differ in which ones they have. The integration adds an entity for each setting the device reports, and only those:

Entity Setting
Screen lighting (select) Standard or always on
Screen brightness (select) Low, medium or high
Alarm strength (number) 0–100: vibration on rings, alarm volume on the PO6
SpO2 alert (switch) and SpO2 alert threshold (number) Alarm when SpO2 drops to the threshold, 80–95%
Pulse alert (switch), High and Low pulse alert (numbers) Alarm outside 30–250 bpm limits
Sync clock (button) Sets the device clock to Home Assistant's time

The PO6 reports all of these except screen brightness. Despite its manual saying it has no alarm system, it has an audible one: Alarm strength sets its volume, and the alert switches take effect. It doesn't report the alarm strength back (its CurMotor says which alerts are on instead), so that entity shows the last value set, marked as an assumed state.

Values are sent as text, the way the device reports them: it replies OK to a number but ignores it. If a device still leaves a setting as it was, changing it shows an error saying so; a value it clamps to its own range is simply shown as clamped.

Sounding the alarm

The Sound alarm button, and the viatom_oximeter.sound_alarm action for automations and other integrations, make the device sound its alarm (vibrate on rings, beep on the PO6) at the current alarm strength:

action: viatom_oximeter.sound_alarm
data:
  device_id: <the oximeter's device>
  duration: 10  # seconds, 1-120

The device has no command for this, so the integration sets its pulse alert to go off: switched on, with a lower limit of 200 bpm. After duration it puts the pulse alert settings back as they were. If the connection drops before that, it puts them back first thing at the next connection, so a real alert isn't left changed. Because the alert checks the pulse, this only works while the device is on a finger and reading one; otherwise the action fails with a message saying so. The device may take a few seconds to react. The action returns once the settings are back.

Settings changed while Home Assistant isn't connected (the device is off, or charging between its reads every 2 minutes) are kept, even across a restart, and sent the next time it connects. Until then the entity shows the new value as assumed; set back to what the device already has, the change is dropped. If the device then doesn't take a change, a notification says so. Sync clock and Sound alarm need the device there and then, so they are unavailable while it isn't connected. The settings last read are kept across restarts; they are only unavailable until the device has been read once.

The device clock is also set automatically whenever it is more than 2 seconds off, checked at each connection and every 15 minutes during one, once any new recordings have been downloaded (they are dated by that clock). The PO6's clock drifts by about 2 seconds an hour.

Recordings

The device saves a recording when a session ends (the countdown, then "saving" on its screen): SpO2, pulse rate and motion every 2 or 4 seconds, with a summary. During a long session the PO6 also seems to start a new recording about every hour, and it seems to keep only its four newest, so older ones are lost if they aren't downloaded in time.

Home Assistant downloads the recordings it hasn't seen yet at the start of each connection and every 15 minutes during one. This takes a few seconds per recording, and live values (and the waveform feeds) pause meanwhile. Nights when the SleepImage app holds the connection can still lose all but the last four recordings. For each new recording it:

  • saves the raw file and a CSV with real timestamps to <recordings folder>/<address>/, named by the device-clock start time. The recordings folder is /share/viatom_oximeter on Home Assistant OS and Supervised installs, where add-ons and Samba can reach it, and config/viatom_oximeter otherwise.
  • updates the Last recording sensors: start, duration, average and lowest SpO2, average pulse rate (from the samples, to 0.1 bpm: the device's own is rounded down), 3% and 4% dips (desaturations), time below 90%, and O2 score (unknown on the PO6, which doesn't score its recordings)
  • adds the SpO2, pulse rate and motion to long-term statistics as viatom_oximeter:<address>_spo2, _pulse_rate and _motion (hourly mean, minimum and maximum; show them with a Statistics graph card)
  • fires a viatom_oximeter_recording event with the summary and the CSV path

The event data: entry_id, address, device_id, name, start and end (ISO 8601, UTC), duration and interval (s), spo2_average, spo2_lowest, pulse_rate_average, dips_3, dips_4, seconds_below_90, o2_score (null on the PO6) and csv_path. Other integrations can also get a recording's samples without reading the CSV: see Recordings API below.

Recordings older than the time to keep them (12 months unless changed; 0 keeps them all) are deleted: their raw file and CSV, and their summary. This happens at startup, after each new download and when the option changes, and goes by when the recording really started, or for a file without a summary, when it was saved. Only recording files are deleted, and the long-term statistics stay. The integration also forgets the names of recordings the device no longer has, so its stored data doesn't grow either.

What is known about the samples: one every interval seconds (2 or 4 on the models seen so far, set by the device; duration divided by the number of samples). Per Viatom's SDK, motion is the largest movement over that interval; whether SpO2 and pulse rate are averaged over it or taken at that moment isn't documented.

Recordings made while the device clock was wrong are dated using how far off it was at download time, which is right as long as the clock wasn't changed in between (for example by the SleepImage app), apart from the drift since the recording: about 2 seconds for each hour between the two. While the device is in range, recordings are downloaded within 15 minutes and the clock is kept within 2 seconds, so they are dated to within about 2 seconds; one still under way when the clock is set can be off by up to that much.

API for other integrations

Recordings API

api = hass.data.get("viatom_oximeter")  # None until it is set up
recordings = api["recordings"](entry_id)  # summaries, oldest first
recording = await api["get_recording"](entry_id, name)

A summary has the same keys as the viatom_oximeter_recording event (without entry_id, address and device_id). get_recording adds samples, a list of {"t", "spo2", "pulse_rate", "motion"}, with t in UTC epoch seconds and None where the device had no valid value. Both raise ValueError for an entry that isn't loaded or a name that wasn't downloaded.

Beat and waveform feeds

While another integration is subscribed and a finger is in, the integration requests the pulse waveform twice a second (command 0x1B) and turns it into two feeds: beats and the waveform itself. Nothing is sent to the state machine or the recorder, and nothing changes for the entities, which keep being read every poll interval. With no subscriber, the waveform isn't requested at all.

Subscribe without importing this integration:

api = hass.data.get("viatom_oximeter")  # None until it is set up
unsubscribe = api["subscribe"](entry_id, "beats", on_beats)  # or "waveform"

entry_id is the device's config entry. Subscriptions can be made before the device is set up and survive reloads. Callbacks run in the event loop, so they must not block. Add "after_dependencies": ["viatom_oximeter"] to your manifest so the API is there when you load.

Beats: the callback gets a list of beats, about twice a second. Each beat:

Key
t UTC epoch seconds (float) at the steepest point of the upstroke
interval_ms Since the previous beat in the same segment; None for the first, and after a gap
amplitude Peak minus the trough before it, in raw units
trough The trough level, in raw units
quality ok, motion or weak; with the finger out there are no beats
motion The device's motion value at the time, or None
segment_id Unbroken stretch the beat belongs to

Waveform: the callback gets one chunk per reply: segment_id, first_index (sample index within the segment), start (UTC epoch seconds of the first sample), sample_rate (125.0), samples (0–255, flipped so that each beat is a peak, not rescaled), beat_marks (indices in this chunk where the device marked a beat), and the device's spo2, pulse_rate and perfusion_index.

How it works and what to expect:

  • The device returns the samples since the previous request, keeping at most one second's worth. A reply that comes back full means samples were lost around it, so it gets a segment of its own and the next reply starts another. A failed request, the finger coming out or a reconnect also start a new segment. Over a night, full replies came about every 20 minutes, when a reply was held up for over a second, including when the device starts a new recording file each hour.
  • Beats are the ones the device itself detects: it replaces one sample per beat with a marker (filled in from its neighbours in the waveform). Each is timed at the steepest point of its upstroke, between samples. A beat whose upstroke is cut off by the start of a segment is skipped.
  • An interval is a gap, spanning beats the device didn't mark, when it is over 2 s (30 bpm, the device's slowest) or over 1.6 times the median of the last 8 in the segment. Its interval_ms is then None, which keeps it out of variability figures. A slowdown that lasts is taken as it is after four beats.
  • Intervals come from sample counts, so they are exact to the device's sample clock. Absolute times follow when replies arrive, smoothed, and are good to about 0.1 s.
  • No rescaling by the device has been seen so far.
  • Quality: motion when the device's motion value is 20 or more, weak when the perfusion index is below 0.5% or the amplitude below 2. Both thresholds are provisional.

Using it alongside the SleepImage app

The PO6 accepts one Bluetooth connection at a time. While Home Assistant is connected, the SleepImage app can't record a study, and vice versa. Turn off the Live monitoring switch before a recording night, or automate it, for example by switching it off at bedtime on nights you record.

Specifications

From the SleepImage PO6 manual. These are the manufacturer's figures, not something the device reports, so they aren't entities.

SpO2 range 70–100%
SpO2 accuracy ±2% at 80–100%, ±3% at 70–80%
Pulse rate range 30–250 bpm
Pulse rate accuracy ±2 bpm or ±2%, whichever is greater
Battery 12–14 hours of typical use; 2–3 hours to charge
Alarms None, per the manual (but see Device settings)
Storage None, per the manual; in fact it keeps recordings (see Recordings)

Status and caveats

The protocol was worked out from open-source readers for other Viatom devices (ecostech/viatom-ble, MackeyStingray/o2r). It has since been tested on a real SleepImage PO6: SleepImage's firmware speaks the same protocol, and live readings, finger detection, device info (the serial number ends in the device ID), reconnecting and letting the device switch itself off all work.

One difference from other Viatom devices: on the charger, the PO6 sets its finger flag whether or not a finger is in, so there the integration ignores it until the readings are valid.

Perfusion index is read as tenths of a percent. A resting reading of 6.1% fits the typical 1–10% range, but it hasn't been compared against a second oximeter yet.

Setting names follow Viatom's SDK, checked against what the PO6 reports. On a PO6, recordings download, and clock sync, alarm strength, the alert switches and screen lighting (standard, always on) work. The alert thresholds are untried. Sound alarm beeps almost at once, and the settings are put back afterwards.

The beat and waveform feeds are tested against waveform captured from a PO6 and against synthetic waveform. Over a first night, the beat count matched and the heart rate from the intervals was within 3 bpm of the pulse rate in 99% of minutes. That night 1.4% of intervals spanned lost beats, mostly at a slow pulse, where the level stays flat before each beat for longer than the search looked back. With that fixed, a second night lost 80 of the 26,788 beats the device marked, about one per segment start. But the device itself left about 6% of beats unmarked, mostly while awake and at a high perfusion index, sometimes for a minute at a time; those show as gaps. The quality thresholds (motion, weak) are provisional.

If something looks wrong, download diagnostics from the device page. They include the GATT table, the advertisement, the last 50 raw response frames, the downloaded recordings, and counters for the waveform stream (stream: beats the device marked, beats found, gaps, segments, full replies), which is enough to fix the decoding. stream.gaps holds the waveform before the beat that ends each of the first 10 gaps and the latest 10, with the device's marks, to see what it missed. For a live trace, enable debug logging:

logger:
  logs:
    custom_components.viatom_oximeter: debug

Development

pip install pytest-homeassistant-custom-component
pytest

protocol.py has no Home Assistant dependencies and can be reused on its own.

License

MIT, see LICENSE.