{% extends "base.html" %} {% block title %}Health · {{ assistant }}{% endblock %} {% block main_class %}form{% endblock %} {% block content %}
Integrations

Health

{% if message %}
✓ DONE{{ message }}
{% endif %} {% if error %}{% endif %}

On the orb

Automatic shows last night's sleep, or without it the week's kilometres from Strava, or without Strava today's steps.

Apple Health · sleep and steps

Apple Health data stays on your iPhone, so a Shortcut sends today's steps and last night's sleep to myOrb through a secret webhook address. It takes about ten minutes to set up, once.

{% if webhook %}
{{ webhook }}
{% if last %}

Last received: {{ last.updated_at | localtime }} (day {{ last.day.strftime("%-d %b") }}).

{% else %}

○ Nothing received yet

{% endif %}

1 · Create the shortcut

  1. In the Shortcuts app, tap + and name the new shortcut Send health to myOrb.
  2. Steps. Add Find Health Samples where All of these are true: Type is Steps, Start Date is today. Then add Calculate Statistics → Sum.
  3. Sleep (skip it if nothing measures your sleep, see below). Add a second Find Health Samples, not Filter, where All of these are true:
    • Type is Sleep
    • Start Date is in the last 1 day
    • Value is not In Bed and Value is not Awake, or the time in bed counts too and the sleep comes out about double.
    Then add Calculate Statistics → Sum.
  4. Send. Add Get Contents of URL with the address above, Method POST and Request Body JSON with two fields:
    • steps: the Sum of the steps' Calculate Statistics
    • sleep_minutes: the Sum of the sleep's Calculate Statistics
    Pick each value with Select Variable, and take the Sum, not the health samples, which would send every sample instead of one number. Both are called Sum: tap one and choose Reveal Action to see which it is. No date is needed; myOrb takes the day the numbers arrive.

2 · Run it once

  1. Add Show Content after the sleep's Sum and run the shortcut with ▶. About 7 means hours: rename the field to sleep_hours. About 430 means minutes: keep sleep_minutes. Then delete Show Content again.
  2. When the iPhone asks to allow sending health samples to {{ callback_domain }}, choose Always Allow; otherwise the daily run stops at that question. It lists the samples behind the sums, but only the two numbers are sent.
  3. Check Last received under the address above, and the number on the orb.

3 · Run it every day

  1. In Shortcuts, open the Automation tab and tap + for a new automation, named for example myOrb Health data.
  2. Add a Time of Day trigger (At 07:00), a time after you wake up. Then add more times to the same automation, e.g. 12:00, 16:00, 20:00 and 23:00; they are joined by or, so it runs at each of them. Steps sent only in the morning would stay the morning's all day: each later run replaces today's steps, and the sleep from the morning stays.
  3. Open each time with its ›: it repeats Daily, and runs without asking for confirmation (Run Immediately).
  4. As the action, add Run Shortcut → Send health to myOrb.
  5. For the morning, Alarm → Is Stopped works instead of a time: it runs when you turn off your wake-up alarm, with the phone in your hand.

Good to know

{% endif %}
{% if webhook %}The old address stops working.{% endif %}

Strava · activities

{% for connection in connections %}
{{ connection.account }}Strava
✓ Connected
{% endfor %}
  1. Open Strava → My API Application and create an application (any name and website will do).
  2. Set Authorization Callback Domain to {{ callback_domain }}.
  3. Copy the Client ID and Client Secret below, save, and connect your account.
{% if client and not connections %}
{% endif %}
{% endblock %}