|
|
|
@ -60,9 +60,10 @@ def get_table_cols(hus, fam, typ): |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_table_col_fam(sen, typ): |
|
|
|
|
for table_name in TABLE_FAMILIES_SENSORS: |
|
|
|
|
for col in TABLE_COLS[table_name]: |
|
|
|
|
def get_table_col_fam(hus, sen, typ): |
|
|
|
|
for table_name in TABLE_FAMILIES_SENSORS[hus]: |
|
|
|
|
for col in TABLE_COLS[hus][table_name]: |
|
|
|
|
print(table_name, col) |
|
|
|
|
match = re.match(f'(.*)\.{sen}\.{typ}', col) |
|
|
|
|
if match: |
|
|
|
|
return table_name, col, match[1] |
|
|
|
@ -234,7 +235,7 @@ def grid_yearly(): |
|
|
|
|
conn = sqlite3.connect(DB_NAMES[hus]) |
|
|
|
|
|
|
|
|
|
# Get the columns for the sensor |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(sen, typ) |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(hus, sen, typ) |
|
|
|
|
sql_col_names = f'"{date_col}","{time_col}","{col_name}"' |
|
|
|
|
|
|
|
|
|
query = f'SELECT {sql_col_names} FROM "{table_name}"' |
|
|
|
@ -264,7 +265,7 @@ def grid_monthly(): |
|
|
|
|
conn = sqlite3.connect(DB_NAMES[hus]) |
|
|
|
|
|
|
|
|
|
# Get the columns for the sensor |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(sen, typ) |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(hus, sen, typ) |
|
|
|
|
sql_col_names = f'"{date_col}","{time_col}","{col_name}"' |
|
|
|
|
|
|
|
|
|
query = f'SELECT {sql_col_names} FROM "{table_name}" ' |
|
|
|
@ -299,7 +300,7 @@ def grid_weekly(): |
|
|
|
|
#print(weekdays) |
|
|
|
|
|
|
|
|
|
# Get the columns for the sensor |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(sen, typ) |
|
|
|
|
table_name, col_name, fam = get_table_col_fam(hus, sen, typ) |
|
|
|
|
sql_col_names = f'"{date_col}","{time_col}","{col_name}"' |
|
|
|
|
|
|
|
|
|
query = f'SELECT {sql_col_names} FROM "{table_name}" ' |
|
|
|
|