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
#
@@ -144,11 +144,17 @@ def extract_sleep_data(ts, slp, day):
#
elif sleep['mode'] == 5:
#
+ elif sleep['mode'] == 7:
#
+ elif sleep['mode'] == 8:
#
stage = f"unknown_{sleep['mode']}"
#
+ start_epoch = minute_to_timestamp(sleep['start'], day)
#
- "timestamp": minute_to_timestamp(sleep['start'], day) * 1000000000, # Convert to nanos
#
+ "timestamp": start_epoch * 1000000000, # Convert to nanos
#
"total_sleep_min" : sleep['stop'] - sleep['start']
#
@@ -158,7 +164,25 @@ def extract_sleep_data(ts, slp, day):
#
+ # Create points for every minute in this state.
#
+ stop_epoch = minute_to_timestamp(sleep['stop'], day)
#
+ while s <= stop_epoch:
#
+ "timestamp": s * 1000000000, # Convert to nanos
#
+ "current_sleep_state" : stage,
#
+ "current_sleep_state_int" : sleep['mode'],
#
+ "activity_type" : "sleep_stage_tracker"
#
# Increment the counter for the type
#
# initialising if not already present
#
if stage not in stages_counters:
#
@@ -241,9 +265,11 @@ def extract_step_data(ts, stp, day):
#
activity_type = 'light_activity'
#
activity_type = f"unknown_{activity['mode']}"
#
+ start_epoch = minute_to_timestamp(activity['start'], day)
#
- "timestamp": minute_to_timestamp(activity['start'], day) * 1000000000, # Convert to nanos TODO
#
+ "timestamp": start_epoch * 1000000000, # Convert to nanos TODO
#
"total_steps" : activity['step'],
#
"calories" : activity['cal'],
#
@@ -261,6 +287,24 @@ def extract_step_data(ts, stp, day):
#
activity_counters[activity_type] = 0
#
activity_counters[activity_type] += 1
#
+ # Create an entry for each minute of this activity
#
+ end_epoch = minute_to_timestamp(activity['stop'], day)
#
+ while s <= end_epoch:
#
+ "timestamp": s * 1000000000, # Convert to nanos
#
+ "current_activity_type" : activity_type,
#
+ "current_activity_type_int" : activity['mode'],
#
+ "activity_type" : "activity_type_tracker"
#
# Record the number of activities