diff --git a/config.py b/config.py index da37a5c..97918ef 100644 --- a/config.py +++ b/config.py @@ -70,11 +70,20 @@ def warning_sql(deviceId, type): template = "warning" match type: case 0: - return RFID_template(template, deviceId) + rfid = RFID_template(template, deviceId) + rfid.append(f"CREATE TIMESERIES root.{template}.{deviceId}.reason(rs) WITH datatype=TEXT,ENCODING=PLAIN") + rfid.append(f"CREATE TIMESERIES root.{template}.{deviceId}.solve(s) WITH datatype=TEXT,ENCODING=PLAIN") + return rfid case 1: - return air_template(template, deviceId) + air = air_template(template, deviceId) + air.append(f"CREATE TIMESERIES root.{template}.{deviceId}.reason(rs) WITH datatype=TEXT,ENCODING=PLAIN") + air.append(f"CREATE TIMESERIES root.{template}.{deviceId}.solve(s) WITH datatype=TEXT,ENCODING=PLAIN") + return air case _: - return common_template(template, deviceId) + common = common_template(template, deviceId) + common.append(f"CREATE TIMESERIES root.{template}.{deviceId}.reason(rs) WITH datatype=TEXT,ENCODING=PLAIN") + common.append(f"CREATE TIMESERIES root.{template}.{deviceId}.solve(s) WITH datatype=TEXT,ENCODING=PLAIN") + return common def rfid_deviceId(rfid, deviceId): @@ -125,6 +134,12 @@ def is_warning(deviceId, v, t): def insert_to_warning_sql(deviceId, v, t): + measurements[t].append("reason") + measurements[t].append("solve") + dataTypes[t].append("TEXT") + dataTypes[t].append("TEXT") + v.append("无") + v.append("无") return { "devices": ["root.warning." + deviceId], "timestamps": [int(time.time() * 1000)],