diff --git a/app/mifit_to_influxdb.py b/app/mifit_to_influxdb.py
--- a/app/mifit_to_influxdb.py
+++ b/app/mifit_to_influxdb.py
#
@@ -133,7 +133,7 @@ def extract_sleep_data(ts, slp):
#
stage = f"unknown_{sleep['mode']}"
#
- "timestamp": sleep['start'] * 60 * 1000000000, # Convert to nanos
#
+ "timestamp": int(sleep['start']) * 60 * 1000000000, # Convert to nanos
#
"total_sleep_min" : sleep['stop'] - sleep['start']
#
@@ -168,6 +168,54 @@ def dump_step_data(day, stp):
#
print(format(minutes_as_time(activity['start'])),"-",minutes_as_time(activity['stop']),
#
activity['step'],'steps',activity_type)
#
+def extract_step_data(ts, stp):
#
+ ''' Extract step data and return in a format ready for feeding
#
+ "timestamp": int(ts) * 1000000000, # Convert to nanos
#
+ "total_steps" : stp['ttl'],
#
+ "calories" : stp['cal'],
#
+ "distance_m" : stp['dis']
#
+ "activity_type" : "steps"
#
+ # Iterate through any listed stages
#
+ for activity in stp['stage']:
#
+ if activity['mode'] == 1:
#
+ activity_type = 'slow_walking'
#
+ elif activity['mode'] == 3:
#
+ activity_type = 'fast_walking'
#
+ elif activity['mode'] == 4:
#
+ activity_type = 'running'
#
+ elif activity['mode'] == 7:
#
+ activity_type = 'light_activity'
#
+ activity_type = f"unknown_{activity['mode']}"
#
+ "timestamp": int(activity['start']) * 60 * 1000000000, # Convert to nanos TODO
#
+ "total_steps" : activity['step'],
#
+ "calories" : activity['cal'],
#
+ "distance_m" : stp['dis'],
#
+ "activity_duration_m" : activity['stop'] - activity['start'],
#
+ "activity_type" : activity_type
#
def get_band_data(auth_info):
#
''' Retrieve information for the band/watch associated with the account
#
@@ -216,6 +264,7 @@ def get_band_data(auth_info):
#
for k,v in summary.items():
#
+ result_set = result_set + extract_step_data(ts, v)
#
# dump_sleep_data(day,v)