SMA Q2 extracting data.
See my SMA-Q2 first impressions and do-not-disturb-automation blogs about SMA Q2.
SMA Care
SMA Care app fetches Activity and Sleep data from SMA Q2 watch and store them in SQLITE3 database.
SMA Care: Detailed HR data: Detailed Sleep data:
Data are stored in a very light text based server less database: SQLITE3.
Sqlite is very popular in android apps because data can be handled with standard SQL commands.
Fast and efficient way to store recurring data.
Place of databases:
You can find SMA Care application files (config files and data) on your Android device root directory:
/data/data/com.szabh.sma_new/
The databases are here: /data/data/com.szabh.sma_new/databases
Copy these database files to your SDCard and send to your PC.
I copy databases directory to SDcard with Tasker :

Then I send this directory to my NAS storage server with SCP.
See detailes here.
Copy databases to PC to further export and analysis.
Python for data analysis
Python is very popular language for data analysis.You will soon understand why?
Database read with Python:
import sqlite3
import pandas as pd
from sqlalchemy import create_engine
db=sqlite3.connect('python/sma/mydb') # data/data/com.szabh.sma_new/databases
engine = create_engine('sqlite:///python/sma/mydb')
df = pd.read_sql_query('SELECT * FROM sqlite_master WHERE type="table" ', db)df.head(6) # List tables in database.
import pandas as pd
from sqlalchemy import create_engine
db=sqlite3.connect('python/sma/mydb') # data/data/com.szabh.sma_new/databases
engine = create_engine('sqlite:///python/sma/mydb')
Read Table names from Database:
df = pd.read_sql_query('SELECT * FROM sqlite_master WHERE type="table" ', db)df.head(6) # List tables in database.Export all tables to CSV:
tables=['Sport','Sleep','HeartRate','Alarm']for table in tables:
df = pd.read_sql_table(table, engine)
df.to_csv(table+'.csv')
You will find 4 CSV file in your home directory
- Sport.csv
- Sleep.csv
- HeartRate.csv
- Alarm.csv
for example HR data seems like this:
I also made data export in python.
df = pd.read_sql_query('SELECT * FROM Sleep WHERE date like "2017-02-18%" ', db)df.head(5)