Applehealth Autoexport

hello everyone, I know this could be necroposting but I look for advice: I successfully managed to create InfluxDB and Grafana so now new record are visible in dashboard.

I noticed that Auto export allow also to sync historical data. Any one know how to allow influxdb to have also old record store in Apple Health app?

Thanks

I’ve ended up using a simple route for getting just my step count into Home Assistant using ios shortcuts. This negates the need for setting up any of the export options in the actual Auto Export app which seemed a bit confusing. If you’re just trying to get step data into home assistant you can see this up in 2 minutes by following these steps.

Step 1 - open Shortcuts and Create a new shortcut

Step 2 - Search for an ‘Export a single Health Metric’ action (it will have the Health Auto Export app logo) and set it to Step Count using Days as JSON. I’m sure this will work for other data but you’ll need to figure that out for yourself

Step 3 - add a ‘Get text’ action which takes the JSON data and converts it into text

Step 4 - add a ‘Get dictionary from input’ action which takes that text and allows you to drill down into it to get the step value

Step 5 - then add a ‘Get dictionary value’ action 4 times, which basically tells the shortcut to drill down through the hierarchy in the JSON. In the ‘key field’ put the following:

1st ‘get dictionary value’ action - the key should be: data
2nd ‘get dictionary value’ action - the key should be: metrics
3rd ‘get dictionary value’ action - the key should be: data
4th ‘get dictionary value’ action - the key should be: qty

this gets you to the actual number of steps in the JSON data. This will certainly vary if you’re trying to bring in more/different health data. If you put a ‘quick look’ action after the ‘get text’ action you can have a look at the JSON data and see what would be right for your situation.

Step 6 - Use a ‘Calculate’ action to add zero to that number which prevents it from wigging out when your step count is zero

Step 7 - Add a ‘Round number’ action, and set to Integer to get whole numbers

Step 8 - Add a home assistant Call Service action set to call input_number.set_value with the following JSON data:

{
“entity_id”: “input_number.steps_today”,
“value”: Rounded Number
}

which just feeds it to a helper of the same name (which you’ll need to create yourself) in Home Assistant. The ‘Rounded Number’ in that JSON data should be using the variable that is the output of the Round Number action above.

And that’s it!

The only thing I found to be problematic is it can’t get the data from AutoHealthExport while the phone is locked - but I’ve got around this by using ios shortcut automations that run the script every time I open a few of my mostly used apps, which keeps it as up to date as I need, as like everyone else I pick that devil up every two minutes anyway.

Hope that helps somebody