Alternative way to pull data from Apple Health?

I have a Meditation-Minutes goal that is unfortunately not working so well due to technical issues

  • I meditate using Headspace and the Breathe app on the Apple Watch
  • The data from both of these apps get pulled to Apple Health and labeled as “mindful minutes”
  • The Beeminder iPhone app pulls data from my Apple Health stats and sends it to this “meditation” goal.

The problem is that the Apple Health data is not being correctly transferred to Beeminder.
I’ve done several tests and I’m confident that the issues happen when I meditate several times a day and Beeminder goes nuts and doesn’t log everything correctly.

I’ve already reported this to @shanaqui and @Andy_Brett but I’m anxious to be able to trust my Beeminder system wholeheartedly again.

Does anyone have any creative idea of how to get my data from Apple Health being transferred to any other app/system and then have this app/system sending the cumulative meditated minutes to Beeminder at the end of the day?

2 Likes

You can also pull from Apple Heath via Shortcuts and feed Beeminder the data via the API, skipping the official Beeminder iOS app.

2 Likes

I have a bunch of goals fed this way. Usually I have the shortcuts set up to be triggered manually but in your case maybe you could set up ‘automation’ to run the ‘log my meditation for the day’ shortcut once per day at a set time.

2 Likes

This sounds like EXACTLY what I need!!

I’ve already invested an hour on this but I didn’t make much progress :frowning:
@ubdhtvqeakj9 , would you be so kind and help me out by sharing with me your Shortcuts (especially if they pull Health Data) and also how you set it up on Beeminder?

(since I’m not a dev and relatively unfamiliar with APIs, I was thinking of sending the Mindful Minutes to IFTTT every night and connect my goal to iftt instead of receiving the data directly from the shortcut. I know… it’s not the most efficient way but sounded like the easiest to me now. If you send the data directly to Beeminder, I’d love to learn how you did it!)

1 Like

I’ve put in at least 3 hours on it already but I’m having troubles with pulling the Mindful Minutes data using the Shortcuts app.

I’m following this guy’s tutorial on how to create a shortcut that pulls Health Data.
I’m following his steps on my Shortcuts app and It works perfectly with steps, sleep, heart rate… all different sorts of data BUT the godamned mindful minutes.

Heartrate:

Mindful minutes (always returns empty)

Can anyone with an iphone test it and see if Shortcut is working with mindful minutes?
(I’ve checked my data permissions and I’ve made double sure I have mindful minutes logged for today)

1 Like

Hello. I tried here too and see that shortcuts seems to be showing blanks instead of the minutes.
I will look into it a little.

Thanks for learning about shortcuts! Sorry for the rabbit hole. :slight_smile:

1 Like

Thanks for jumping in!

Thx for introducing me to Shortcuts. I had heard about them before but couldn’t think of any application for them yet. Now I know how to use them (except with mindful minutes haha).

1 Like

Doubtless you’ve thought of this, but before adding the complexity of looping in Zapier, make sure using the Show Notification step in Shortcuts that you’ve found the data on device. That way, you can quickly cycle through the different available fields and figure out what’s got data.

In the case of Mindful Minutes, the data seems to be in the Duration field rather than the Value field. Testing with a manually-entered datapoint in Health, five minutes is shown as 5:00 in my notification of the duration field.

2 Likes

Ah, thanks for the tip, @philip. That worked for me.

A ‘find health samples’ followed by
a ‘get details from samples’

(Previously I was using just the find samples and not also the get details. The output appeared blank but would contain more blanks when including a wider search range, so I should have know something was being found.)

Was able to pull out the almost 18min mindfulness session (here 17min and 37sec).

1 Like

And now that I look more closely at my own mindfulness goal, I see a day where there were two sessions on a single day and the value of the datapoint created by the official Beeminder app is off, showing, in this case, fewer minutes than available in Health.

2 Likes

Doubtless I didn’t think/know about the “Show Notification” trick hahaha
Thanks for teaching :slight_smile:

And also thanks for cracking the code on getting the Duration instead of Value for Mindful Minutes!

1 Like

Now I’m stuck at another step - haha

The value that Shortcuts sends is exactly 1:00, with the “:”

When IFTTT sends this value to Beeminder, it causes an error to occur. How do you convert minutes to numerals or even delete everything that comes after the “:”?
Can I do it on Shortcuts level? IFTTT level? How? (I told ya, I’m a newbie)


Once I get this done with IFTTT, my next step will be getting rid of IFTTT and sending the data directly to Beeminder :slight_smile:

It’s been fun to play with this

I think you would want to cover this from hh:mm into hh + mm/60 and send that over to Beeminder.

Perhaps you could use the ‘split’ on : then perform the math like mentioned.

1 Like

You would also not need ifttt going this route. The Beeminder api can be used directly.

sorry for the very basic question: how does one do it? using the scripts function?

Update:
Someone commented on my personal blog and his/her comment led me abandon IFTTT sooner than later.

I’m now able to get data from my health app and post directly on my Beeminder goal!

The problem I was having with IFTTT’s value not being recognized by Beeminder is now gone.
I suspect that by setting the “value” field as a number and sending directly to through the API fixes this. IFTTT most likely sends this as a string/text and when the value includes “:” it breaks.


Is it working as I intended? No! Not yet.
It’s just as faulty as the Beeminder iOS app: when used with Meditation Minutes, it only gets how many minutes the last meditation session took.

Anyone has any clue on how to make Shortcuts read and sum all Mindful Minutes logged on a given day?

2 Likes

Update: it’s working!!

Thanks @ubdhtvqeakj9 @philip @krugerk and an anonymous beeminder user that commented on my personal blog. You rock!!

Here are the screenshots in case you want to copy it for yourself (apple does not allow for sharing Automations)




Case closed!

5 Likes

Case reopened:

iphone Automations doesn’t work because it requires human authorization everytime the automation is fired (and at the time it fires I’m laying in bed)

Workaround: I gave up on the automation path and created a Shortcut that I’ll trigger everyday before sleeping. Not ideal but good enough until the iOS app is fixed :slight_smile:

4 Likes