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