various updates
This commit is contained in:
BIN
Pub_Sub/.DS_Store
vendored
BIN
Pub_Sub/.DS_Store
vendored
Binary file not shown.
374
Pub_Sub/cameratrailer_hk/thingsboard/cameratrailer_hk_tb_v6.cfg
Normal file
374
Pub_Sub/cameratrailer_hk/thingsboard/cameratrailer_hk_tb_v6.cfg
Normal file
File diff suppressed because one or more lines are too long
691
Pub_Sub/dual_flowmeter/mistaway/baylee_pit_config.cfg
Normal file
691
Pub_Sub/dual_flowmeter/mistaway/baylee_pit_config.cfg
Normal file
File diff suppressed because one or more lines are too long
192
Pub_Sub/flowmeterskid/mistaway/terri-pit-inlet-command.py
Normal file
192
Pub_Sub/flowmeterskid/mistaway/terri-pit-inlet-command.py
Normal file
@@ -0,0 +1,192 @@
|
||||
# Enter your python code.
|
||||
import json, time
|
||||
from datetime import datetime as dt
|
||||
from quickfaas.measure import recall
|
||||
from common.Logger import logger
|
||||
from quickfaas.remotebus import publish
|
||||
|
||||
def sync(mac,value,topic, wizard_api):
|
||||
#get new values and send
|
||||
try:
|
||||
data = recall()#json.loads(recall().decode("utf-8"))
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
logger.info(data)
|
||||
|
||||
for controller in data:
|
||||
if controller["name"] == "flowmeter":
|
||||
path = "/var/user/files/totalizers.json"
|
||||
unit = ""
|
||||
suffix = ""
|
||||
mac = topic.split("/")[-1] #':'.join(re.findall('..', '%012x' % uuid.getnode()))
|
||||
elif controller["name"] == "flowmeter2":
|
||||
#logger.debug("processing flow meter 2!!!!!!!!!!")
|
||||
path = "/var/user/files/totalizers2.json"
|
||||
unit = "2"
|
||||
suffix = "_2"
|
||||
time.sleep(5)
|
||||
elif controller["name"] == "flowmeter3":
|
||||
path = "/var/user/files/totalizers3.json"
|
||||
unit = "3"
|
||||
suffix = "_3"
|
||||
time.sleep(10)
|
||||
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||
resetPayload = {"ts": "", "values": {}}
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
for measure in controller["measures"]:
|
||||
if measure["health"]:
|
||||
try:
|
||||
logger.debug(measure["name"])
|
||||
logger.debug(measure["value"])
|
||||
|
||||
if measure["name"] in ["totalizer_1", "totalizer_1_2", "totalizer_1_3"]:
|
||||
totalizers = get_totalizers(path)
|
||||
logger.debug(totalizers)
|
||||
if totalizers:
|
||||
payload["values"]["day_volume" + suffix], dayReset = totalizeDay(measure["value"], totalizers, path)
|
||||
payload["values"]["week_volume" + suffix], weekReset = totalizeWeek(measure["value"], totalizers, path)
|
||||
payload["values"]["month_volume" + suffix], monthReset = totalizeMonth(measure["value"], totalizers, path)
|
||||
payload["values"]["year_volume" + suffix], yearReset = totalizeYear(measure["value"], totalizers, path)
|
||||
payload["values"][measure["name"]] = measure["value"]
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
#publish(__topic__, json.dumps(payload), __qos__)
|
||||
for measure in payload["values"].keys():
|
||||
ma_payload = {"value": payload["values"][measure]}
|
||||
meshifyName = mapMeasure(measure)
|
||||
logger.debug(f"Publishing: {measure} | {meshifyName}")
|
||||
if meshifyName:
|
||||
logger.debug("meshify/db/194/_/tenflowmeterskid/" + mac.lower() + "/" + meshifyName )
|
||||
publish("meshify/db/194/_/tenflowmeterskid/" + mac.lower() + "/" + meshifyName, json.dumps([ma_payload]),1)
|
||||
|
||||
|
||||
|
||||
def saveTotalizers(path, totalizers):
|
||||
try:
|
||||
with open(path, "w") as t:
|
||||
json.dump(totalizers,t)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
def totalizeDay(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["dayHolding"]
|
||||
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||
totalizers["dayHolding"] = lifetime
|
||||
totalizers["day"] = int(now.strftime("%d"))
|
||||
saveTotalizers(path,totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeWeek(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["weekHolding"]
|
||||
if not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun":
|
||||
totalizers["weekHolding"] = lifetime
|
||||
totalizers["week"] = now.strftime("%U")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
|
||||
def totalizeMonth(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["monthHolding"]
|
||||
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||
totalizers["monthHolding"] = lifetime
|
||||
totalizers["month"] = now.strftime("%m")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeYear(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["yearHolding"]
|
||||
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||
totalizers["yearHolding"] = lifetime
|
||||
totalizers["year"] = now.strftime("%Y")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
|
||||
def get_totalizers(path):
|
||||
try:
|
||||
with open(path, "r") as t:
|
||||
logger.info(f"OPEN FILE FOR {path}")
|
||||
totalizers = json.load(t)
|
||||
logger.info(f"LOADED JSON FOR {path}")
|
||||
if not totalizers:
|
||||
logger.info("-----INITIALIZING TOTALIZERS-----")
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in get_totalizers {path}: {e}")
|
||||
return False
|
||||
return totalizers
|
||||
|
||||
|
||||
def mapMeasure(measure):
|
||||
measuremap = {
|
||||
"flowrate": "fm1_flowrate",
|
||||
"totalizer_1": "fm1_lifetime",
|
||||
"month_volume": "fm1_month",
|
||||
"day_volume": "fm1_todays",
|
||||
"yesterday_volume": "fm1_yesterdays",
|
||||
"last_month_volume": "fm1_lastmonth",
|
||||
"flowrate_2": "fm2_flowrate",
|
||||
"totalizer_1_2": "fm2_lifetime",
|
||||
"month_volume_2": "fm2_month",
|
||||
"day_volume_2": "fm2_todays",
|
||||
"yesterday_volume_2": "fm2_yesterdays",
|
||||
"last_month_volume_2": "fm2_lastmonth"
|
||||
}
|
||||
return measuremap.get(measure, None)
|
||||
|
||||
def writeplctag(mac, value, wizard_api):
|
||||
try:
|
||||
value = json.loads(value.replace("'",'"'))
|
||||
logger.debug(value)
|
||||
message = {"advvfdipp":{value["tag"]: value["val"]}}
|
||||
wizard_api.write_plc_values(message)
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
|
||||
def receiveCommand(topic, payload, wizard_api):
|
||||
logger.debug(topic)
|
||||
logger.debug(json.loads(payload))
|
||||
p = json.loads(payload)[0]
|
||||
command = p["payload"]["name"].split(".")[1]
|
||||
commands = {
|
||||
"sync": sync,
|
||||
"writeplctag": writeplctag,
|
||||
}
|
||||
commands[command](p["mac"].lower(),p["payload"]["value"],topic, wizard_api)
|
||||
#logger.debug(command)
|
||||
ack(p["msgId"], p["mac"], command, p["payload"]["name"].split(".")[1], p["payload"]["value"], wizard_api)
|
||||
|
||||
def ack(msgid, mac, name, command, value, wizard_api):
|
||||
#logger.debug(mac)
|
||||
macsquish = "".join(mac.split(":")[:-2])
|
||||
maclower = ":".join(mac.split(":")[:-2])
|
||||
maclower = maclower.lower()
|
||||
#logger.debug(msgid)
|
||||
#logger.debug(mac)
|
||||
#logger.debug(name)
|
||||
#logger.debug(value)
|
||||
wizard_api.mqtt_publish("meshify/responses/" + str(msgid), json.dumps([{"value": "{} Success Setting: {} To: {}".format(macsquish,name, value), "msgid": str(msgid)}]))
|
||||
wizard_api.mqtt_publish("meshify/db/194/_/mainMeshify/" + maclower + ":00:00/commands", json.dumps([{"value": {"status": "success", "value": str(value), "channel": command}, "msgid": str(msgid)}]))
|
||||
|
||||
|
||||
394
Pub_Sub/flowmeterskid/mistaway/terri-pit-inlet-send.py
Normal file
394
Pub_Sub/flowmeterskid/mistaway/terri-pit-inlet-send.py
Normal file
@@ -0,0 +1,394 @@
|
||||
import json, os, time, uuid
|
||||
from datetime import datetime as dt
|
||||
from common.Logger import logger
|
||||
from quickfaas.remotebus import publish
|
||||
from mobiuspi_lib.gps import GPS
|
||||
from paho.mqtt import client
|
||||
from quickfaas.global_dict import get as get_params
|
||||
from quickfaas.global_dict import _set_global_args
|
||||
from quickfaas.measure import recall
|
||||
|
||||
def reboot(reason="Rebooting for config file update"):
|
||||
#basic = Basic()
|
||||
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||
logger.info(reason)
|
||||
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||
logger.info(f"REBOOT : {r}")
|
||||
|
||||
def checkFileExist(filename):
|
||||
path = "/var/user/files"
|
||||
try:
|
||||
if not os.path.exists(path):
|
||||
logger.debug("no folder making files folder in var/user")
|
||||
os.makedirs(path)
|
||||
with open(path + "/" + filename, "a") as f:
|
||||
json.dump({}, f)
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkFileExist while making folder: {e}")
|
||||
|
||||
try:
|
||||
if not os.path.exists(path + "/" + filename):
|
||||
logger.debug("no creds file making creds file")
|
||||
with open(path + "/" + filename, "a") as f:
|
||||
json.dump({}, f)
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkFileExist while making file: {e}")
|
||||
|
||||
def convertDStoJSON(ds):
|
||||
j = dict()
|
||||
try:
|
||||
for x in ds:
|
||||
j[x["key"]] = x["value"]
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in convertDStoJSON: {e}")
|
||||
return j
|
||||
|
||||
def convertJSONtoDS(j):
|
||||
d = []
|
||||
try:
|
||||
for key in j.keys():
|
||||
d.append({"key": key, "value": j[key]})
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in convertJSONtoDS: {e}")
|
||||
return d
|
||||
|
||||
def checkCredentialConfig():
|
||||
logger.debug("CHECKING CONFIG")
|
||||
cfgpath = "/var/user/cfg/device_supervisor/device_supervisor.cfg"
|
||||
credspath = "/var/user/files/creds.json"
|
||||
cfg = dict()
|
||||
with open(cfgpath, "r") as f:
|
||||
try:
|
||||
cfg = json.load(f)
|
||||
clouds = cfg.get("clouds")
|
||||
logger.debug(clouds)
|
||||
#if not configured then try to configure from stored values
|
||||
if clouds[0]["args"]["clientId"] == "unknown" or clouds[0]["args"]["username"] == "unknown" or not clouds[0]["args"]["passwd"] or clouds[0]["args"]["passwd"] == "unknown":
|
||||
try:
|
||||
checkFileExist("creds.json")
|
||||
except Exception as e:
|
||||
logger.error(f"Error in checkFileExist: {e}")
|
||||
with open(credspath, "r") as c:
|
||||
try:
|
||||
creds = json.load(c)
|
||||
if creds:
|
||||
logger.debug("updating config with stored data")
|
||||
clouds[0]["args"]["clientId"] = creds["clientId"]
|
||||
clouds[0]["args"]["username"] = creds["userName"]
|
||||
clouds[0]["args"]["passwd"] = creds["password"]
|
||||
cfg["clouds"] = clouds
|
||||
cfg = checkParameterConfig(cfg)
|
||||
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||
reboot()
|
||||
except Exception as e:
|
||||
logger.error(f"Error trying to load credentials from file: {e}")
|
||||
else:
|
||||
#assuming clouds is filled out, if data is different then assume someone typed in something new and store it, if creds is empty fill with clouds' data
|
||||
checkFileExist("creds.json")
|
||||
with open(credspath, "r") as c:
|
||||
logger.debug("updating stored file with new data")
|
||||
cfg = checkParameterConfig(cfg)
|
||||
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||
creds = json.load(c)
|
||||
if creds:
|
||||
if creds["clientId"] != clouds[0]["args"]["clientId"]:
|
||||
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||
if creds["userName"] != clouds[0]["args"]["username"]:
|
||||
creds["userName"] = clouds[0]["args"]["username"]
|
||||
if creds["password"] != clouds[0]["args"]["passwd"]:
|
||||
creds["password"] = clouds[0]["args"]["passwd"]
|
||||
else:
|
||||
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||
creds["userName"] = clouds[0]["args"]["username"]
|
||||
creds["password"] = clouds[0]["args"]["passwd"]
|
||||
with open(credspath, "w") as cw:
|
||||
json.dump(creds,cw)
|
||||
except Exception as e:
|
||||
logger.error(f"Somethign went wrong in checkCredentialConfig: {e}")
|
||||
|
||||
def checkParameterConfig(cfg):
|
||||
try:
|
||||
logger.debug("Checking Parameters!!!!")
|
||||
paramspath = "/var/user/files/params.json"
|
||||
cfgparams = convertDStoJSON(cfg.get("labels"))
|
||||
#check stored values
|
||||
checkFileExist("params.json")
|
||||
with open(paramspath, "r") as f:
|
||||
logger.debug("Opened param storage file")
|
||||
params = json.load(f)
|
||||
if params:
|
||||
if cfgparams != params:
|
||||
#go through each param
|
||||
#if not "unknown" and cfg and params aren't the same take from cfg likely updated manually
|
||||
#if key in cfg but not in params copy to params
|
||||
logger.debug("equalizing params between cfg and stored")
|
||||
for key in cfgparams.keys():
|
||||
try:
|
||||
if cfgparams[key] != params[key] and cfgparams[key] != "unknown":
|
||||
params[key] = cfgparams[key]
|
||||
except:
|
||||
params[key] = cfgparams[key]
|
||||
cfg["labels"] = convertJSONtoDS(params)
|
||||
_set_global_args(convertJSONtoDS(params))
|
||||
with open(paramspath, "w") as p:
|
||||
json.dump(params, p)
|
||||
else:
|
||||
with open(paramspath, "w") as p:
|
||||
logger.debug("initializing param file with params in memory")
|
||||
json.dump(convertDStoJSON(get_params()), p)
|
||||
cfg["labels"] = get_params()
|
||||
|
||||
return cfg
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkParameterConfig: {e}")
|
||||
os.system(f'rm {paramspath}')
|
||||
return cfg
|
||||
|
||||
payload = {}
|
||||
|
||||
def get_totalizers(path):
|
||||
try:
|
||||
with open(path, "r") as t:
|
||||
logger.info(f"OPEN FILE FOR {path}")
|
||||
totalizers = json.load(t)
|
||||
logger.info(f"LOADED JSON FOR {path}")
|
||||
if not totalizers:
|
||||
logger.info("-----INITIALIZING TOTALIZERS-----")
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in get_totalizers {path}: {e}")
|
||||
return False
|
||||
return totalizers
|
||||
|
||||
def aggregate():
|
||||
try:
|
||||
data = recall()#json.loads(recall().decode("utf-8"))
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return
|
||||
logger.debug(data)
|
||||
|
||||
flowrate, totalday, totalweek, totalmonth, totalyear = 0, 0, 0, 0, 0
|
||||
for controller in data:
|
||||
if controller.get("name") == "flowmeter":
|
||||
path = "/var/user/files/totalizers.json"
|
||||
checkCredentialConfig()
|
||||
elif controller.get("name") == "flowmeter2":
|
||||
path = "/var/user/files/totalizers2.json"
|
||||
elif controller.get("name") == "flowmeter3":
|
||||
path = "/var/user/files/totalizers3.json"
|
||||
for measure in controller["measures"]:
|
||||
if measure.get("name") in ["flowrate", "flowrate_2", "flowrate_3"]:
|
||||
flowrate += measure.get("value")
|
||||
if measure.get("name") in ["totalizer_1", "totalizer_1_2", "totalizer_1_3"]:
|
||||
totalizers = get_totalizers(path)
|
||||
totalday += measure.get("value") - totalizers.get("dayHolding")
|
||||
totalweek += measure.get("value") - totalizers.get("weekHolding", 0.0)
|
||||
totalmonth += measure.get("value") - totalizers.get("monthHolding")
|
||||
totalyear += measure.get("value") - totalizers.get("yearHolding", 0.0)
|
||||
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||
payload["values"]["flowrateSum"] = flowrate
|
||||
payload["values"]["day_volume_sum"] = totalday
|
||||
payload["values"]["week_volume_sum"] = totalweek
|
||||
payload["values"]["month_volume_sum"] = totalmonth
|
||||
payload["values"]["year_volume_sum"] = totalyear
|
||||
logger.debug(payload)
|
||||
publish(__topic__, json.dumps(payload), __qos__)
|
||||
|
||||
|
||||
lwtData = {
|
||||
"init":False,
|
||||
"client": client.Client(client_id=str(uuid.uuid4()), clean_session=True, userdata=None, protocol=client.MQTTv311, transport="tcp")
|
||||
}
|
||||
def lwt(mac):
|
||||
try:
|
||||
#if not lwtData["connected"]:
|
||||
if not lwtData["init"]:
|
||||
print("INITIALIZING LWT CLIENT")
|
||||
lwtData["client"].username_pw_set(username="admin", password="columbus")
|
||||
lwtData["client"].will_set("meshify/db/194/_/mainHP/" + mac + ":00:00/connected",json.dumps([{"value":False}]))
|
||||
lwtData["client"].reconnect_delay_set(min_delay=10, max_delay=120)
|
||||
lwtData["init"] = True
|
||||
print("Connecting to MQTT Broker for LWT purposes!!!!!!!")
|
||||
lwtData["client"].connect("mq194.imistaway.net",1883, 1200)
|
||||
lwtData["client"].reconnect()
|
||||
lwtData["client"].publish("meshify/db/194/_/mainHP/" + mac + ":00:00/connected", json.dumps([{"value":True}]))
|
||||
except Exception as e:
|
||||
print("LWT DID NOT DO THE THING")
|
||||
print(e)
|
||||
|
||||
def mapMeasure(measure):
|
||||
measuremap = {
|
||||
"flowrate": "fm1_flowrate",
|
||||
"totalizer_1": "fm1_lifetime",
|
||||
"month_volume": "fm1_month",
|
||||
"day_volume": "fm1_todays",
|
||||
"yesterday_volume": "fm1_yesterdays",
|
||||
"last_month_volume": "fm1_lastmonth",
|
||||
"flowrate_2": "fm2_flowrate",
|
||||
"totalizer_1_2": "fm2_lifetime",
|
||||
"month_volume_2": "fm2_month",
|
||||
"day_volume_2": "fm2_todays",
|
||||
"yesterday_volume_2": "fm2_yesterdays",
|
||||
"last_month_volume_2": "fm2_lastmonth"
|
||||
}
|
||||
return measuremap.get(measure, None)
|
||||
|
||||
def sendData(message,wizard_api):
|
||||
logger.debug(message) #{'group': 'default', 'measures': [{'ctrlName': 'test2', 'name': 't', 'health': 1, 'timestamp': 1682609511, 'value': 0}]}
|
||||
if message["group_name"] == "default":
|
||||
path = "/var/user/files/totalizers.json"
|
||||
unit = ""
|
||||
suffix = ""
|
||||
mac = __topic__.split("/")[-1] #':'.join(re.findall('..', '%012x' % uuid.getnode()))
|
||||
lwt(mac)
|
||||
checkCredentialConfig()
|
||||
elif message["group_name"] == "default2":
|
||||
#logger.debug("processing flow meter 2!!!!!!!!!!")
|
||||
path = "/var/user/files/totalizers2.json"
|
||||
unit = "2"
|
||||
suffix = "_2"
|
||||
time.sleep(5)
|
||||
elif message["group_name"] == "default3":
|
||||
path = "/var/user/files/totalizers3.json"
|
||||
unit = "3"
|
||||
suffix = "_3"
|
||||
time.sleep(10)
|
||||
|
||||
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||
resetPayload = {"ts": "", "values": {}}
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
for measure in message["values"]["flowmeter"+ unit].keys():
|
||||
if message["values"]["flowmeter"+ unit][measure]["status"]:
|
||||
try:
|
||||
if measure in ["totalizer_1", "totalizer_1_2", "totalizer_1_3"]:
|
||||
totalizers = get_totalizers(path)
|
||||
if totalizers:
|
||||
payload["values"]["day_volume" + suffix], dayReset = totalizeDay(message["values"]["flowmeter" + unit][measure]["raw_data"], totalizers, path)
|
||||
payload["values"]["week_volume" + suffix], weekReset = totalizeWeek(message["values"]["flowmeter"+ unit][measure]["raw_data"], totalizers, path)
|
||||
payload["values"]["month_volume" + suffix], monthReset = totalizeMonth(message["values"]["flowmeter"+ unit][measure]["raw_data"], totalizers, path)
|
||||
payload["values"]["year_volume" + suffix], yearReset = totalizeYear(message["values"]["flowmeter"+ unit][measure]["raw_data"], totalizers, path)
|
||||
payload["values"][measure] = message["values"]["flowmeter" + unit][measure]["raw_data"]
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
#publish(__topic__, json.dumps(payload), __qos__)
|
||||
for measure in payload["values"].keys():
|
||||
ma_payload = {"value": payload["values"][measure]}
|
||||
meshifyName = mapMeasure(measure)
|
||||
#logger.debug(f"Publishing: {measure} | {meshifyName}")
|
||||
if meshifyName:
|
||||
logger.debug(__topic__ + ":01:99/" + meshifyName )
|
||||
publish(__topic__ + ":01:99/" + meshifyName, json.dumps([ma_payload]),__qos__)
|
||||
|
||||
if dayReset:
|
||||
resetPayload["values"]["yesterday_volume" + suffix] = payload["values"]["day_volume" + suffix]
|
||||
resetPayload["values"]["day_volume" + suffix] = 0
|
||||
if weekReset:
|
||||
resetPayload["values"]["last_week_volume" + suffix] = payload["values"]["week_volume" + suffix]
|
||||
resetPayload["values"]["week_volume" + suffix] = 0
|
||||
if monthReset:
|
||||
resetPayload["values"]["last_month_volume" + suffix] = payload["values"]["month_volume" + suffix]
|
||||
resetPayload["values"]["month_volume" + suffix] = 0
|
||||
if yearReset:
|
||||
resetPayload["values"]["last_year_volume" + suffix] = payload["values"]["year_volume" + suffix]
|
||||
resetPayload["values"]["year_volume" + suffix] = 0
|
||||
|
||||
if resetPayload["values"]:
|
||||
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||
#publish(__topic__, json.dumps(resetPayload), __qos__)
|
||||
for measure in resetPayload["values"].keys():
|
||||
ma_payload = {"value": resetPayload["values"][measure]}
|
||||
meshifyName = mapMeasure(measure)
|
||||
if meshifyName:
|
||||
publish(__topic__ + ":01:99/" + meshifyName, json.dumps([ma_payload]),__qos__)
|
||||
|
||||
if unit == "3":
|
||||
aggregate()
|
||||
|
||||
def saveTotalizers(path, totalizers):
|
||||
try:
|
||||
with open(path, "w") as t:
|
||||
json.dump(totalizers,t)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
def getGPS():
|
||||
# Create a gps instance
|
||||
gps = GPS()
|
||||
|
||||
# Retrieve GPS information
|
||||
position_status = gps.get_position_status()
|
||||
logger.debug("position_status: ")
|
||||
logger.debug(position_status)
|
||||
latitude = position_status["latitude"].split(" ")
|
||||
longitude = position_status["longitude"].split(" ")
|
||||
lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)
|
||||
lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)
|
||||
if latitude[2] == "S":
|
||||
lat_dec = lat_dec * -1
|
||||
if longitude[2] == "W":
|
||||
lon_dec = lon_dec * -1
|
||||
#lat_dec = round(lat_dec, 7)
|
||||
#lon_dec = round(lon_dec, 7)
|
||||
logger.info("HERE IS THE GPS COORDS")
|
||||
logger.info(f"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}")
|
||||
speedKnots = position_status["speed"].split(" ")
|
||||
speedMPH = float(speedKnots[0]) * 1.151
|
||||
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||
|
||||
def totalizeDay(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["dayHolding"]
|
||||
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||
totalizers["dayHolding"] = lifetime
|
||||
totalizers["day"] = int(now.strftime("%d"))
|
||||
saveTotalizers(path,totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeWeek(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["weekHolding"]
|
||||
if not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun":
|
||||
totalizers["weekHolding"] = lifetime
|
||||
totalizers["week"] = now.strftime("%U")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
|
||||
def totalizeMonth(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["monthHolding"]
|
||||
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||
totalizers["monthHolding"] = lifetime
|
||||
totalizers["month"] = now.strftime("%m")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeYear(lifetime, totalizers, path):
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["yearHolding"]
|
||||
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||
totalizers["yearHolding"] = lifetime
|
||||
totalizers["year"] = now.strftime("%Y")
|
||||
saveTotalizers(path, totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
382
Pub_Sub/flowmeterskid/thingsboard/flowmeterskid_tb_v3.cfg
Normal file
382
Pub_Sub/flowmeterskid/thingsboard/flowmeterskid_tb_v3.cfg
Normal file
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
import json, os, time
|
||||
import json, os, time, shutil
|
||||
from datetime import datetime as dt
|
||||
from common.Logger import logger
|
||||
from quickfaas.remotebus import publish
|
||||
@@ -146,35 +146,43 @@ def checkParameterConfig(cfg):
|
||||
|
||||
payload = {}
|
||||
|
||||
def get_totalizers():
|
||||
def initialize_totalizers():
|
||||
return {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
|
||||
def getTotalizers(file_path="/var/user/files/totalizers.json"):
|
||||
"""
|
||||
Retrieves totalizer data from a JSON file.
|
||||
|
||||
:param file_path: Path to the JSON file storing totalizer data.
|
||||
:return: Dictionary containing totalizer values.
|
||||
"""
|
||||
try:
|
||||
with open("/var/user/files/totalizers.json", "r") as t:
|
||||
with open(file_path, "r") as t:
|
||||
totalizers = json.load(t)
|
||||
if not totalizers:
|
||||
logger.info("-----INITIALIZING TOTALIZERS-----")
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
except:
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
if not totalizers or not isinstance(totalizers, dict):
|
||||
logger.info("Invalid data format in the file. Initializing totalizers.")
|
||||
totalizers = initialize_totalizers()
|
||||
except FileNotFoundError:
|
||||
logger.info("File not found. Initializing totalizers.")
|
||||
totalizers = initialize_totalizers()
|
||||
except json.JSONDecodeError:
|
||||
timestamp = dt.now().strftime("%Y%m%d_%H%M%S")
|
||||
# Split the file path and insert the timestamp before the extension
|
||||
file_name, file_extension = os.path.splitext(file_path)
|
||||
backup_file_path = f"{file_name}_{timestamp}{file_extension}"
|
||||
shutil.copyfile(file_path, backup_file_path)
|
||||
logger.error(f"Error decoding JSON. A backup of the file is created at {backup_file_path}. Initializing totalizers.")
|
||||
totalizers = initialize_totalizers()
|
||||
return totalizers
|
||||
|
||||
# Helper function to split the payload into chunks
|
||||
@@ -195,12 +203,13 @@ def sendData(message,wizard_api):
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
for measure in message["values"]["flowmeter"].keys():
|
||||
try:
|
||||
if measure in ["totalizer_1"]:
|
||||
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
||||
if message["values"]["flowmeter"][measure]["status"] == 1:
|
||||
if measure in ["totalizer_1"]:
|
||||
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
try:
|
||||
@@ -230,12 +239,19 @@ def sendData(message,wizard_api):
|
||||
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||
publish(__topic__, json.dumps(resetPayload), __qos__)
|
||||
|
||||
def saveTotalizers(totalizers):
|
||||
def saveTotalizers(totalizers, file_path="/var/user/files/totalizers.json"):
|
||||
"""
|
||||
Saves totalizer data to a JSON file.
|
||||
|
||||
:param totalizers: Dictionary containing totalizer values to be saved.
|
||||
:param file_path: Path to the JSON file where totalizer data will be saved.
|
||||
"""
|
||||
try:
|
||||
with open("/var/user/files/totalizers.json", "w") as t:
|
||||
json.dump(totalizers,t)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
with open(file_path, "w") as t:
|
||||
json.dump(totalizers, t)
|
||||
except (IOError, OSError, json.JSONEncodeError) as e:
|
||||
logger.error(f"Error saving totalizers to {file_path}: {e}")
|
||||
raise # Optionally re-raise the exception if it should be handled by the caller
|
||||
|
||||
def getGPS():
|
||||
# Create a gps instance
|
||||
@@ -261,50 +277,129 @@ def getGPS():
|
||||
speedMPH = float(speedKnots[0]) * 1.151
|
||||
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||
|
||||
def totalizeDay(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save daily totalizers based on the lifetime value.
|
||||
|
||||
:param lifetime: The current lifetime total.
|
||||
:param max_retries: Maximum number of save attempts.
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["dayHolding"]
|
||||
|
||||
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||
totalizers["dayHolding"] = lifetime
|
||||
totalizers["day"] = int(now.strftime("%d"))
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeWeek(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||
if attempt < max_retries - 1:
|
||||
time.sleep(retry_delay)
|
||||
else:
|
||||
logger.error("All attempts to save totalizers failed.")
|
||||
return (None, False)
|
||||
|
||||
return (value, reset)
|
||||
|
||||
def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save weekly totalizers based on the lifetime value.
|
||||
|
||||
:param lifetime: The current lifetime total.
|
||||
:param max_retries: Maximum number of save attempts.
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["weekHolding"]
|
||||
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
||||
totalizers["weekHolding"] = lifetime
|
||||
totalizers["week"] = now.strftime("%U")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||
if attempt < max_retries - 1:
|
||||
time.sleep(retry_delay)
|
||||
else:
|
||||
logger.error("All attempts to save totalizers failed.")
|
||||
return (None, False)
|
||||
return (value, reset)
|
||||
|
||||
def totalizeMonth(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save monthly totalizers based on the lifetime value.
|
||||
|
||||
:param lifetime: The current lifetime total.
|
||||
:param max_retries: Maximum number of save attempts.
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["monthHolding"]
|
||||
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||
totalizers["monthHolding"] = lifetime
|
||||
totalizers["month"] = now.strftime("%m")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||
if attempt < max_retries - 1:
|
||||
time.sleep(retry_delay)
|
||||
else:
|
||||
logger.error("All attempts to save totalizers failed.")
|
||||
return (None, False)
|
||||
|
||||
return (value,reset)
|
||||
|
||||
def totalizeYear(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save yearly totalizers based on the lifetime value.
|
||||
|
||||
:param lifetime: The current lifetime total.
|
||||
:param max_retries: Maximum number of save attempts.
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["yearHolding"]
|
||||
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||
totalizers["yearHolding"] = lifetime
|
||||
totalizers["year"] = now.strftime("%Y")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||
if attempt < max_retries - 1:
|
||||
time.sleep(retry_delay)
|
||||
else:
|
||||
logger.error("All attempts to save totalizers failed.")
|
||||
return (None, False)
|
||||
return (value, reset)
|
||||
310
Pub_Sub/flowmeterskid/thingsboard/sendData_old.py
Normal file
310
Pub_Sub/flowmeterskid/thingsboard/sendData_old.py
Normal file
@@ -0,0 +1,310 @@
|
||||
import json, os, time
|
||||
from datetime import datetime as dt
|
||||
from common.Logger import logger
|
||||
from quickfaas.remotebus import publish
|
||||
from mobiuspi_lib.gps import GPS
|
||||
from quickfaas.global_dict import get as get_params
|
||||
from quickfaas.global_dict import _set_global_args
|
||||
|
||||
def reboot(reason="Rebooting for config file update"):
|
||||
#basic = Basic()
|
||||
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||
logger.info(reason)
|
||||
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||
logger.info(f"REBOOT : {r}")
|
||||
|
||||
def checkFileExist(filename):
|
||||
path = "/var/user/files"
|
||||
try:
|
||||
if not os.path.exists(path):
|
||||
logger.debug("no folder making files folder in var/user")
|
||||
os.makedirs(path)
|
||||
with open(path + "/" + filename, "a") as f:
|
||||
json.dump({}, f)
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkFileExist while making folder: {e}")
|
||||
|
||||
try:
|
||||
if not os.path.exists(path + "/" + filename):
|
||||
logger.debug("no creds file making creds file")
|
||||
with open(path + "/" + filename, "a") as f:
|
||||
json.dump({}, f)
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkFileExist wihle making file: {e}")
|
||||
|
||||
def convertDStoJSON(ds):
|
||||
j = dict()
|
||||
try:
|
||||
for x in ds:
|
||||
j[x["key"]] = x["value"]
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in convertDStoJSON: {e}")
|
||||
return j
|
||||
|
||||
def convertJSONtoDS(j):
|
||||
d = []
|
||||
try:
|
||||
for key in j.keys():
|
||||
d.append({"key": key, "value": j[key]})
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in convertJSONtoDS: {e}")
|
||||
return d
|
||||
|
||||
def checkCredentialConfig():
|
||||
logger.debug("CHECKING CONFIG")
|
||||
cfgpath = "/var/user/cfg/device_supervisor/device_supervisor.cfg"
|
||||
credspath = "/var/user/files/creds.json"
|
||||
cfg = dict()
|
||||
with open(cfgpath, "r") as f:
|
||||
try:
|
||||
cfg = json.load(f)
|
||||
clouds = cfg.get("clouds")
|
||||
logger.debug(clouds)
|
||||
#if not configured then try to configure from stored values
|
||||
if clouds[0]["args"]["clientId"] == "unknown" or clouds[0]["args"]["username"] == "unknown" or not clouds[0]["args"]["passwd"] or clouds[0]["args"]["passwd"] == "unknown":
|
||||
try:
|
||||
checkFileExist("creds.json")
|
||||
except Exception as e:
|
||||
logger.error(f"Error in checkFileExist: {e}")
|
||||
with open(credspath, "r") as c:
|
||||
try:
|
||||
creds = json.load(c)
|
||||
if creds:
|
||||
logger.debug("updating config with stored data")
|
||||
clouds[0]["args"]["clientId"] = creds["clientId"]
|
||||
clouds[0]["args"]["username"] = creds["userName"]
|
||||
clouds[0]["args"]["passwd"] = creds["password"]
|
||||
cfg["clouds"] = clouds
|
||||
cfg = checkParameterConfig(cfg)
|
||||
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||
reboot()
|
||||
except Exception as e:
|
||||
logger.error(f"Error trying to load credentials from file: {e}")
|
||||
else:
|
||||
#assuming clouds is filled out, if data is different then assume someone typed in something new and store it, if creds is empty fill with clouds' data
|
||||
checkFileExist("creds.json")
|
||||
with open(credspath, "r") as c:
|
||||
logger.debug("updating stored file with new data")
|
||||
cfg = checkParameterConfig(cfg)
|
||||
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||
creds = json.load(c)
|
||||
if creds:
|
||||
if creds["clientId"] != clouds[0]["args"]["clientId"]:
|
||||
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||
if creds["userName"] != clouds[0]["args"]["username"]:
|
||||
creds["userName"] = clouds[0]["args"]["username"]
|
||||
if creds["password"] != clouds[0]["args"]["passwd"]:
|
||||
creds["password"] = clouds[0]["args"]["passwd"]
|
||||
else:
|
||||
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||
creds["userName"] = clouds[0]["args"]["username"]
|
||||
creds["password"] = clouds[0]["args"]["passwd"]
|
||||
with open(credspath, "w") as cw:
|
||||
json.dump(creds,cw)
|
||||
except Exception as e:
|
||||
logger.error(f"Somethign went wrong in checkCredentialConfig: {e}")
|
||||
|
||||
def checkParameterConfig(cfg):
|
||||
try:
|
||||
logger.debug("Checking Parameters!!!!")
|
||||
paramspath = "/var/user/files/params.json"
|
||||
cfgparams = convertDStoJSON(cfg.get("labels"))
|
||||
#check stored values
|
||||
checkFileExist("params.json")
|
||||
with open(paramspath, "r") as f:
|
||||
logger.debug("Opened param storage file")
|
||||
params = json.load(f)
|
||||
if params:
|
||||
if cfgparams != params:
|
||||
#go through each param
|
||||
#if not "unknown" and cfg and params aren't the same take from cfg likely updated manually
|
||||
#if key in cfg but not in params copy to params
|
||||
logger.debug("equalizing params between cfg and stored")
|
||||
for key in cfgparams.keys():
|
||||
try:
|
||||
if cfgparams[key] != params[key] and cfgparams[key] != "unknown":
|
||||
params[key] = cfgparams[key]
|
||||
except:
|
||||
params[key] = cfgparams[key]
|
||||
cfg["labels"] = convertJSONtoDS(params)
|
||||
_set_global_args(convertJSONtoDS(params))
|
||||
with open(paramspath, "w") as p:
|
||||
json.dump(params, p)
|
||||
else:
|
||||
with open(paramspath, "w") as p:
|
||||
logger.debug("initializing param file with params in memory")
|
||||
json.dump(convertDStoJSON(get_params()), p)
|
||||
cfg["labels"] = get_params()
|
||||
|
||||
return cfg
|
||||
except Exception as e:
|
||||
logger.error(f"Something went wrong in checkParameterConfig: {e}")
|
||||
os.system(f'rm {paramspath}')
|
||||
return cfg
|
||||
|
||||
payload = {}
|
||||
|
||||
def get_totalizers():
|
||||
try:
|
||||
with open("/var/user/files/totalizers.json", "r") as t:
|
||||
totalizers = json.load(t)
|
||||
if not totalizers:
|
||||
logger.info("-----INITIALIZING TOTALIZERS-----")
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
except:
|
||||
totalizers = {
|
||||
"day": 0,
|
||||
"week": 0,
|
||||
"month": 0,
|
||||
"year": 0,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 0,
|
||||
"weekHolding": 0,
|
||||
"monthHolding": 0,
|
||||
"yearHolding": 0
|
||||
}
|
||||
return totalizers
|
||||
|
||||
# Helper function to split the payload into chunks
|
||||
def chunk_payload(payload, chunk_size=20):
|
||||
chunked_values = list(payload["values"].items())
|
||||
for i in range(0, len(chunked_values), chunk_size):
|
||||
yield {
|
||||
"ts": payload["ts"],
|
||||
"values": dict(chunked_values[i:i+chunk_size])
|
||||
}
|
||||
|
||||
|
||||
def sendData(message,wizard_api):
|
||||
logger.debug(message)
|
||||
checkCredentialConfig()
|
||||
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||
resetPayload = {"ts": "", "values": {}}
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
for measure in message["values"]["flowmeter"].keys():
|
||||
try:
|
||||
if measure in ["totalizer_1"]:
|
||||
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
try:
|
||||
payload["values"]["latitude"], payload["values"]["longitude"], payload["values"]["speed"] = getGPS()
|
||||
except:
|
||||
logger.error("Could not get GPS coordinates")
|
||||
for chunk in chunk_payload(payload=payload):
|
||||
publish(__topic__, json.dumps(chunk), __qos__)
|
||||
time.sleep(2)
|
||||
|
||||
publish("v1/devices/me/attributes", json.dumps({"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}), __qos__)
|
||||
|
||||
if dayReset:
|
||||
resetPayload["values"]["yesterday_volume"] = payload["values"]["day_volume"]
|
||||
resetPayload["values"]["day_volume"] = 0
|
||||
if weekReset:
|
||||
resetPayload["values"]["last_week_volume"] = payload["values"]["week_volume"]
|
||||
resetPayload["values"]["week_volume"] = 0
|
||||
if monthReset:
|
||||
resetPayload["values"]["last_month_volume"] = payload["values"]["month_volume"]
|
||||
resetPayload["values"]["month_volume"] = 0
|
||||
if yearReset:
|
||||
resetPayload["values"]["last_year_volume"] = payload["values"]["year_volume"]
|
||||
resetPayload["values"]["year_volume"] = 0
|
||||
|
||||
if resetPayload["values"]:
|
||||
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||
publish(__topic__, json.dumps(resetPayload), __qos__)
|
||||
|
||||
def saveTotalizers(totalizers):
|
||||
try:
|
||||
with open("/var/user/files/totalizers.json", "w") as t:
|
||||
json.dump(totalizers,t)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
def getGPS():
|
||||
# Create a gps instance
|
||||
gps = GPS()
|
||||
|
||||
# Retrieve GPS information
|
||||
position_status = gps.get_position_status()
|
||||
logger.debug("position_status: ")
|
||||
logger.debug(position_status)
|
||||
latitude = position_status["latitude"].split(" ")
|
||||
longitude = position_status["longitude"].split(" ")
|
||||
lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)
|
||||
lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)
|
||||
if latitude[2] == "S":
|
||||
lat_dec = lat_dec * -1
|
||||
if longitude[2] == "W":
|
||||
lon_dec = lon_dec * -1
|
||||
#lat_dec = round(lat_dec, 7)
|
||||
#lon_dec = round(lon_dec, 7)
|
||||
logger.info("HERE IS THE GPS COORDS")
|
||||
logger.info(f"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}")
|
||||
speedKnots = position_status["speed"].split(" ")
|
||||
speedMPH = float(speedKnots[0]) * 1.151
|
||||
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||
|
||||
def totalizeDay(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["dayHolding"]
|
||||
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||
totalizers["dayHolding"] = lifetime
|
||||
totalizers["day"] = int(now.strftime("%d"))
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeWeek(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["weekHolding"]
|
||||
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
||||
totalizers["weekHolding"] = lifetime
|
||||
totalizers["week"] = now.strftime("%U")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
|
||||
def totalizeMonth(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["monthHolding"]
|
||||
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||
totalizers["monthHolding"] = lifetime
|
||||
totalizers["month"] = now.strftime("%m")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value,reset)
|
||||
|
||||
def totalizeYear(lifetime):
|
||||
totalizers = get_totalizers()
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["yearHolding"]
|
||||
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||
totalizers["yearHolding"] = lifetime
|
||||
totalizers["year"] = now.strftime("%Y")
|
||||
saveTotalizers(totalizers)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
1851
Pub_Sub/plcfreshwater/mistaway/dawn-to-terri.cfg
Normal file
1851
Pub_Sub/plcfreshwater/mistaway/dawn-to-terri.cfg
Normal file
File diff suppressed because one or more lines are too long
BIN
Pub_Sub/rigpump/.DS_Store
vendored
BIN
Pub_Sub/rigpump/.DS_Store
vendored
Binary file not shown.
@@ -105,7 +105,7 @@
|
||||
"ctrlName": "rigpump",
|
||||
"group": "default",
|
||||
"uploadType": "periodic",
|
||||
"dataType": "INT",
|
||||
"dataType": "BIT",
|
||||
"addr": "mode_Auto",
|
||||
"readWrite": "ro",
|
||||
"unit": "",
|
||||
|
||||
25
Pub_Sub/sp_booster/thingsboard/sp_booster_measures.csv
Normal file
25
Pub_Sub/sp_booster/thingsboard/sp_booster_measures.csv
Normal file
@@ -0,0 +1,25 @@
|
||||
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId
|
||||
suction_01,sp_transfer,default,periodic,,FLOAT,,,,,Suction_PSI_TP1_Scaled,2,,ro,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
suction_02,sp_transfer,default,periodic,,FLOAT,,,,,Suction_PSI_TP2_Scaled,2,,ro,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
discharge_01,sp_transfer,default,periodic,,FLOAT,,,,,Discharge_PSI_TP1_Scaled,2,,ro,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
discharge_02,sp_transfer,default,periodic,,FLOAT,,,,,Discharge_PSI_TP2_Scaled,2,,ro,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
flow_rate_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAl_1_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
flow_rate_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAl_2_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
totalizer_01_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAL_1_Flow_Meter_T1,2,,ro,bbls,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
totalizer_01_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAL_2_Flow_Meter_T1,2,,ro,gal,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
pump_01_start,sp_transfer,default,periodic,,BIT,,,,0,PF1_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
pump_01_stop,sp_transfer,default,periodic,,BIT,,,,0,PF1_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
pump_01_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF1_SpeedRef,,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
pump_02_start,sp_transfer,default,periodic,,BIT,,,,0,PF2_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
pump_02_stop,sp_transfer,default,periodic,,BIT,,,,0,PF2_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
pump_02_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF2_SpeedRef,,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
pump_01_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF1_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
low_suction_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_1_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
low_suction_01_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
hi_discharge_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_1_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
hi_discharge_01_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
pump_02_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF2_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
low_suction_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_2_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
low_suction_02_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_2_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
hi_discharge_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_2_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||
hi_discharge_02_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_2_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||
|
4358
Pub_Sub/sp_pond/thingsboard/plc_tags_2024-02-22.json
Normal file
4358
Pub_Sub/sp_pond/thingsboard/plc_tags_2024-02-22.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import json, os, time, shutil
|
||||
import json, os, time, shutil, re
|
||||
from datetime import datetime as dt
|
||||
from common.Logger import logger
|
||||
from quickfaas.remotebus import publish
|
||||
@@ -195,49 +195,75 @@ def chunk_payload(payload, chunk_size=20):
|
||||
}
|
||||
|
||||
|
||||
def sendData(message,wizard_api):
|
||||
def sendData(message):
|
||||
logger.debug(message)
|
||||
checkCredentialConfig()
|
||||
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||
resetPayload = {"ts": "", "values": {}}
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
for measure in message["values"]["flowmeter"].keys():
|
||||
regexPattern = r"fm_\d{2}_t\d"
|
||||
pondLevels = {}
|
||||
for measure in message["measures"]:
|
||||
try:
|
||||
if message["values"]["flowmeter"][measure]["status"] == 1:
|
||||
if measure in ["totalizer_1"]:
|
||||
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
||||
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
||||
if measure["health"] == 1:
|
||||
if re.search(regexPattern, measure["name"]):
|
||||
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||
file_name = f"/var/user/files/totalizer_{measure['name']}.json"
|
||||
payload["values"][measure["name"] + "_day_volume"], dayReset = totalizeDay(measure["value"], file_path=file_name)
|
||||
payload["values"][measure["name"] + "_week_volume"], weekReset = totalizeWeek(measure["value"], file_path=file_name)
|
||||
payload["values"][measure["name"] + "_month_volume"], monthReset = totalizeMonth(measure["value"], file_path=file_name)
|
||||
payload["values"][measure["name"] + "_year_volume"], yearReset = totalizeYear(measure["value"], file_path=file_name)
|
||||
|
||||
if dayReset:
|
||||
resetPayload["values"][measure["name"] + "_yesterday_volume"] = payload["values"][measure["name"] + "_day_volume"]
|
||||
resetPayload["values"][measure["name"] + "_day_volume"] = 0
|
||||
if weekReset:
|
||||
resetPayload["values"][measure["name"] + "_last_week_volume"] = payload["values"][measure["name"] + "_week_volume"]
|
||||
resetPayload["values"][measure["name"] + "_week_volume"] = 0
|
||||
if monthReset:
|
||||
resetPayload["values"][measure["name"] + "_last_month_volume"] = payload["values"][measure["name"] + "_month_volume"]
|
||||
resetPayload["values"][measure["name"] + "_month_volume"] = 0
|
||||
if yearReset:
|
||||
resetPayload["values"][measure["name"] + "_last_year_volume"] = payload["values"][measure["name"] + "_year_volume"]
|
||||
resetPayload["values"][measure["name"] + "_year_volume"] = 0
|
||||
if "pond_level" in measure["name"]:
|
||||
pondLevels[measure["name"]] = measure["value"]
|
||||
payload["values"][measure["name"]] = measure["value"]
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
try:
|
||||
payload["values"]["latitude"], payload["values"]["longitude"], payload["values"]["speed"] = getGPS()
|
||||
except:
|
||||
logger.error("Could not get GPS coordinates")
|
||||
|
||||
# GPT4: Loop through the pondLevels dictionary to calculate deviations with error checking
|
||||
for i in range(1, 4): # Assuming pod IDs range from 01 to 03
|
||||
pod_id = f"pod_{i:02d}" # Format pod ID
|
||||
level_keys = [key for key in pondLevels if key.startswith(pod_id)]
|
||||
levels = [pondLevels[key] for key in level_keys]
|
||||
|
||||
# Check if both pond levels are present
|
||||
if len(levels) == 2:
|
||||
# Calculate average and percent deviation when levels are present
|
||||
avg_level = sum(levels) / len(levels) if sum(levels) > 0 else 1
|
||||
deviation_percent = ((max(levels) - min(levels)) / avg_level) * 100 if avg_level != 0 else 0
|
||||
payload["values"][f"{pod_id}_pond_level_deviation"] = deviation_percent
|
||||
payload["values"][f"{pod_id}_pond_level_alm"] = 0 # Reset alarm to 0
|
||||
else:
|
||||
# Set alarm value if one or both levels are missing
|
||||
payload["values"][f"{pod_id}_pond_level_alm"] = 1
|
||||
|
||||
|
||||
for chunk in chunk_payload(payload=payload):
|
||||
publish(__topic__, json.dumps(chunk), __qos__)
|
||||
time.sleep(2)
|
||||
|
||||
publish("v1/devices/me/attributes", json.dumps({"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}), __qos__)
|
||||
|
||||
if dayReset:
|
||||
resetPayload["values"]["yesterday_volume"] = payload["values"]["day_volume"]
|
||||
resetPayload["values"]["day_volume"] = 0
|
||||
if weekReset:
|
||||
resetPayload["values"]["last_week_volume"] = payload["values"]["week_volume"]
|
||||
resetPayload["values"]["week_volume"] = 0
|
||||
if monthReset:
|
||||
resetPayload["values"]["last_month_volume"] = payload["values"]["month_volume"]
|
||||
resetPayload["values"]["month_volume"] = 0
|
||||
if yearReset:
|
||||
resetPayload["values"]["last_year_volume"] = payload["values"]["year_volume"]
|
||||
resetPayload["values"]["year_volume"] = 0
|
||||
|
||||
if resetPayload["values"]:
|
||||
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||
publish(__topic__, json.dumps(resetPayload), __qos__)
|
||||
for chunk in chunk_payload(payload=resetPayload):
|
||||
publish(__topic__, json.dumps(chunk), __qos__)
|
||||
time.sleep(2)
|
||||
|
||||
def saveTotalizers(totalizers, file_path="/var/user/files/totalizers.json"):
|
||||
"""
|
||||
@@ -277,7 +303,7 @@ def getGPS():
|
||||
speedMPH = float(speedKnots[0]) * 1.151
|
||||
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||
|
||||
def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||
def totalizeDay(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save daily totalizers based on the lifetime value.
|
||||
|
||||
@@ -286,7 +312,7 @@ def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
totalizers = getTotalizers(file_path=file_path)
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["dayHolding"]
|
||||
@@ -297,7 +323,7 @@ def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
saveTotalizers(totalizers, file_path=file_path)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
@@ -310,7 +336,7 @@ def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
return (value, reset)
|
||||
|
||||
def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||
def totalizeWeek(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save weekly totalizers based on the lifetime value.
|
||||
|
||||
@@ -319,7 +345,7 @@ def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
totalizers = getTotalizers(file_path=file_path)
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["weekHolding"]
|
||||
@@ -329,7 +355,7 @@ def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
saveTotalizers(totalizers, file_path=file_path)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
@@ -341,7 +367,7 @@ def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||
return (None, False)
|
||||
return (value, reset)
|
||||
|
||||
def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||
def totalizeMonth(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save monthly totalizers based on the lifetime value.
|
||||
|
||||
@@ -350,7 +376,7 @@ def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
totalizers = getTotalizers(file_path=file_path)
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["monthHolding"]
|
||||
@@ -360,7 +386,7 @@ def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
saveTotalizers(totalizers, file_path=file_path)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
@@ -373,7 +399,7 @@ def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
return (value,reset)
|
||||
|
||||
def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
||||
def totalizeYear(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||
"""
|
||||
Update and save yearly totalizers based on the lifetime value.
|
||||
|
||||
@@ -382,7 +408,7 @@ def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
||||
:param retry_delay: Delay in seconds between retries.
|
||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||
"""
|
||||
totalizers = getTotalizers()
|
||||
totalizers = getTotalizers(file_path=file_path)
|
||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||
reset = False
|
||||
value = lifetime - totalizers["yearHolding"]
|
||||
@@ -392,7 +418,7 @@ def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
||||
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
saveTotalizers(totalizers)
|
||||
saveTotalizers(totalizers, file_path=file_path)
|
||||
reset = True
|
||||
return (value, reset)
|
||||
except Exception as e:
|
||||
972
Pub_Sub/sp_pond/thingsboard/pub/sendData_message_example.json
Normal file
972
Pub_Sub/sp_pond/thingsboard/pub/sendData_message_example.json
Normal file
@@ -0,0 +1,972 @@
|
||||
{
|
||||
"timestamp": 1708470659,
|
||||
"group": "default",
|
||||
"measures": [
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_pond_level_02",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_pond_level_01",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_04_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_04_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_04_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_04_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_03_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_03_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_03_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_03_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_02_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_02_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_02_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_02_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_01_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_01_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_01_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_fm_01_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_pond_level_02",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_pond_level_01",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_04_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_04_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_04_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_04_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_03_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_03_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_03_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_03_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_02_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_02_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_02_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_02_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_01_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_01_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_01_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_fm_01_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_pond_level_02",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_pond_level_01",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_04_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_04_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_04_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_04_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_03_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_03_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_03_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_03_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_02_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_02_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_02_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_02_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_01_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_01_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_01_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_fm_01_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_03_enable",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_02_enable",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "pod_01_enable",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_run_permissive",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_discharge_lo_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_discharge_psi",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": -0.08
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_lo_clear_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_discharge_lo_lockout_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_discharge_lo_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_hoa_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_auto_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "cp_01_run_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_type",
|
||||
"health": 0,
|
||||
"timestamp": 1708470632,
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_run_permissive",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm2_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm2_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm2_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm2_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm1_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.4
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm1_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1.44
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm1_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.49
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm1_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_hi_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 200.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_lo_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 20.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_psi",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": -0.14
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_cmd_speed",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_output_current",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_dc_bus",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 662.41
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_output_voltage",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_actual_speed",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_speed_ref_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fault_code",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fm_active_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_alarm_lockout",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_timeout_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_hi_lockout_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_lo_lockout_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_hi_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_discharge_lo_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_error",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_commsloss",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_faulted",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_ready",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_vfd_running",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_stop_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_start_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_jog_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_02_fault_clear_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_type",
|
||||
"health": 0,
|
||||
"timestamp": 1708470632,
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_run_permissive",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm2_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm2_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm2_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm2_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm1_t3",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": -1.04
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm1_t2",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.77
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm1_t1",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": -0.97
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm1_fr",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_hi_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 200.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_lo_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 20.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_psi",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": -0.09
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_cmd_speed",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_output_current",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_dc_bus",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 660.44
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_output_voltage",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_actual_speed",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_speed_ref_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fault_code",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fm_active_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_alarm_lockout",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_timeout_spt",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_hi_lockout_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_lo_lockout_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_hi_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_discharge_lo_alm",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_error",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_commsloss",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_faulted",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_ready",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_vfd_running",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_stop_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_start_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_jog_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"ctrlName": "sp_pond",
|
||||
"name": "wtp_01_fault_clear_cmd",
|
||||
"health": 1,
|
||||
"timestamp": 1708470632,
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
179
Pub_Sub/sp_pond/thingsboard/sp_pond_measures.csv
Normal file
179
Pub_Sub/sp_pond/thingsboard/sp_pond_measures.csv
Normal file
@@ -0,0 +1,179 @@
|
||||
MeasuringPointName,ControllerName,GroupName,UploadType,DataType,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,DataEndianReverse,ReadOffset,ReadLength,DataParseMethod,BitId,storageLwTSDB
|
||||
cp_01_auto,sp_pond,default,periodic,BIT,,,0,FBK_Charge_Pump_Auto,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_auto_alm,sp_pond,default,periodic,BIT,,,0,AL0_CP1_Not_in_Auto,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_discharge_lo_alm,sp_pond,default,periodic,BIT,,,0,AL0_CP1_Discharge_PSI_Lo,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_discharge_lo_lockout_alm,sp_pond,default,periodic,BIT,,,0,AL0_CP1_Low_Disch_PSI_Lock_Out,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_discharge_lo_spt,sp_pond,default,periodic,FLOAT,,,,SPT_CP1_Low_Discharge_PSI,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
cp_01_discharge_psi,sp_pond,default,periodic,FLOAT,,,,Val_CP1_Disch_PSI,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
cp_01_faulted,sp_pond,default,periodic,BIT,,,0,FBK_Charge_Pump_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_hand,sp_pond,default,periodic,BIT,,,0,FBK_Charge_Pump_Hand,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_hoa_alm,sp_pond,default,periodic,BIT,,,0,AL0_CP1_HOA_Off,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_in_hand_alm,sp_pond,default,periodic,BIT,,,0,AL0_Charge_Pump_In_Hand,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_lo_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_CP1_LO_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_run_cmd,sp_pond,default,periodic,BIT,,,0,CMD_CP1_Run,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_01_run_permissive,sp_pond,default,periodic,DINT,0,,,CP1_Run_Permissive,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
cp_01_running,sp_pond,default,periodic,BIT,,,0,FBK_Charge_Pump_Running,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
cp_02_discharge_psi,sp_pond,default,periodic,FLOAT,,,,Val_CP2_Disch_PSI,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_10_fr,sp_pond,default,periodic,FLOAT,,,,Val_FM_10in_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_10_t1,sp_pond,default,periodic,FLOAT,,,,Val_FM_10in_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_10_t2,sp_pond,default,periodic,FLOAT,,,,Val_FM_10in_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_10_t3,sp_pond,default,periodic,FLOAT,,,,Val_FM_10in_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_12_fr,sp_pond,default,periodic,FLOAT,,,,Val_FM_12in_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_12_t1,sp_pond,default,periodic,FLOAT,,,,Val_FM_12in_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_12_t2,sp_pond,default,periodic,FLOAT,,,,Val_FM_12in_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
fm_12_t3,sp_pond,default,periodic,FLOAT,,,,Val_FM_12in_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
hmi_fault_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_HMI_Fault_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
hmi_system_start_cmd,sp_pond,default,periodic,BIT,,,0,CMD_HMI_System_Start,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
hmi_system_stop_cmd,sp_pond,default,periodic,BIT,,,0,CMD_HMI_System_Stop,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
pod_01_enable,sp_pond,default,periodic,BIT,,,0,CFG_Remote_Pod_1_Enable,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
pod_01_fm_01_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM1_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_01_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM1_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_01_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM1_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_01_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM1_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_02_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM2_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_02_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM2_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_02_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM2_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_02_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM2_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_03_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM3_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_03_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM3_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_03_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM3_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_03_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM3_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_04_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM4_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_04_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM4_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_04_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM4_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_fm_04_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_FM4_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_pond_level_01,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_Pond_Level_1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_01_pond_level_02,sp_pond,default,periodic,FLOAT,,,,Val_Pod1_Pond_Level_2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_enable,sp_pond,default,periodic,BIT,,,0,CFG_Remote_Pod_2_Enable,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
pod_02_fm_01_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM1_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_01_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM1_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_01_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM1_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_01_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM1_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_02_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM2_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_02_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM2_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_02_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM2_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_02_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM2_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_03_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM3_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_03_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM3_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_03_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM3_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_03_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM3_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_04_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM4_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_04_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM4_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_04_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM4_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_fm_04_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_FM4_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_pond_level_01,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_Pond_Level_1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_02_pond_level_02,sp_pond,default,periodic,FLOAT,,,,Val_Pod2_Pond_Level_2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_enable,sp_pond,default,periodic,BIT,,,0,CFG_Remote_Pod_3_Enable,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
pod_03_fm_01_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM1_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_01_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM1_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_01_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM1_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_01_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM1_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_02_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM2_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_02_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM2_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_02_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM2_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_02_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM2_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_03_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM3_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_03_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM3_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_03_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM3_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_03_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM3_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_04_fr,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM4_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_04_t1,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM4_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_04_t2,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM4_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_fm_04_t3,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_FM4_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_pond_level_01,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_Pond_Level_1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
pod_03_pond_level_02,sp_pond,default,periodic,FLOAT,,,,Val_Pod3_Pond_Level_2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
power_supply_faulted,sp_pond,default,periodic,BIT,,,0,FBK_Power_Supply_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
power_suppy_faulted,sp_pond,default,periodic,BIT,,,0,AL0_PS_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
scada_fault_clear_cmd,sp_pond,default,periodic,BIT,,,0,cmd_Scada_clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
scada_start_cmd,sp_pond,default,periodic,BIT,,,0,CMD_Scada_Start,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
scada_stop_cmd,sp_pond,default,periodic,BIT,,,0,CMD_Scada_Stop,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_01_discharge_hi_lockout,sp_pond,default,periodic,BIT,,,0,TP1_Lockout_Counter_Hi_Disch,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_01_hi_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP1_Hi_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_01_lo_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP1_Lo_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_01_pid_manual_spt,sp_pond,default,periodic,FLOAT,,,,SPT_TP1_PID_Manual_Speed,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_01_pid_mode_spt,sp_pond,default,periodic,INT,0,,,SPT_TP1_Mode,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_01_pid_spt,sp_pond,default,periodic,FLOAT,,,,SPT_TP1_PID_Setpoint,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_02_hi_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP2_Hi_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_02_lo_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP2_Lo_Clear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_02_pid_inverse_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP2_PID_Inverse,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_02_pid_loop_pv,sp_pond,default,periodic,FLOAT,,,,TP2_PID_Loop_PV,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_02_pid_manual_cmd,sp_pond,default,periodic,BIT,,,0,CMD_TP2_PID_Manual,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
tp_02_pid_manual_spt,sp_pond,default,periodic,FLOAT,,,,SPT_TP2_PID_Manual_Speed,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_02_pid_mode_spt,sp_pond,default,periodic,INT,0,,,SPT_TP2_Mode,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_02_pid_spt,sp_pond,default,periodic,FLOAT,,,,SPT_TP2_PID_Setpoint,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
tp_vfds_faulted_alm,sp_pond,default,periodic,BIT,,,0,AL0_Both_TP_VFDs_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
ups_faulted,sp_pond,default,periodic,BIT,,,0,FBK_UPS_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
ups_faulted_alm,sp_pond,default,periodic,BIT,,,0,AL0_UPS_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_alarm_lockout,sp_pond,default,periodic,INT,0,,,WTP1_Alarm_Lockout,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_discharge_hi_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP1_High_Discharge_PSI,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_discharge_hi_lockout_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP1_Hi_Disch_Lockout,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_discharge_hi_spt,sp_pond,default,periodic,FLOAT,,,,SPT_WTP1_High_Discharge_PSI,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_discharge_lo_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP1_Low_Discharge_PSI,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_discharge_lo_lockout_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP1_Lo_Disch_Lockout,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_discharge_lo_spt,sp_pond,default,periodic,FLOAT,,,,SPT_WTP1_Low_Discharge_PSI,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_discharge_psi,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_Discharge_PSI,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fault_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP1_FaultClear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_fault_code,sp_pond,default,periodic,INT,0,,,FBK_WTP1_FaultCode,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_01_fr,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM1_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_01_t1,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM1_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_01_t2,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM1_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_01_t3,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM1_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_02_fr,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM2_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_02_t1,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM2_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_02_t2,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM2_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_02_t3,sp_pond,default,periodic,FLOAT,,,,Val_WTP1_FM2_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_fm_active_spt,sp_pond,default,periodic,INT,0,,,SPT_WTP1_FM_Active,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_jog_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP1_Jog,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_run_permissive,sp_pond,default,periodic,DINT,0,,,WTP1_Run_Permissive,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_speed_ref_cmd,sp_pond,default,periodic,FLOAT,,,,WTP1_Speed_Ref,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_start_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP1_Start,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_stop_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP1_Stop,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_actual_speed,sp_pond,default,periodic,FLOAT,,,,FBK_WTP1_VFD_Actual_Speed,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_cmd_speed,sp_pond,default,periodic,FLOAT,,,,FBK_WTP1_VFD_CMD_Speed,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_commsloss,sp_pond,default,periodic,BIT,,,0,FBK_WTP1_VFD_CommsLoss,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_dc_bus,sp_pond,default,periodic,FLOAT,,,,FBK_WTP1_VFD_DCBus,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_error,sp_pond,default,periodic,BIT,,,0,FBK_WTP1_VFD_Error,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_faulted,sp_pond,default,periodic,BIT,,,0,FBK_WTP1_VFD_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_output_current,sp_pond,default,periodic,FLOAT,,,,FBK_WTP1_VFD_OutputCurrent,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_output_voltage,sp_pond,default,periodic,FLOAT,,,,FBK_WTP1_VFD_OutputVoltage,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_ready,sp_pond,default,periodic,BIT,,,0,FBK_WTP1_VFD_Ready,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_running,sp_pond,default,periodic,BIT,,,0,FBK_WTP1_VFD_Running,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_01_vfd_timeout_spt,sp_pond,default,periodic,SINT,0,,,SPT_WTP1_VFD_TimeOut,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_01_vfd_type,sp_pond,default,periodic,STRING,,,,FBK_WTP1_VFD_Type,,16,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_alarm_lockout,sp_pond,default,periodic,INT,0,,,WTP2_Alarm_Lockout,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_discharge_hi_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP2_High_Discharge_PSI,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_discharge_hi_lockout_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP2_Hi_Disch_Lockout,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_discharge_hi_spt,sp_pond,default,periodic,FLOAT,,,,SPT_WTP2_High_Discharge_PSI,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_discharge_lo_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP2_Low_Discharge_PSI,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_discharge_lo_lockout_alm,sp_pond,default,periodic,BIT,,,0,AL0_WTP2_Lo_Disch_Lockout,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_discharge_lo_spt,sp_pond,default,periodic,FLOAT,,,,SPT_WTP2_Low_Discharge_PSI,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_discharge_psi,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_Discharge_PSI,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fault_clear_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP2_FaultClear,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_fault_code,sp_pond,default,periodic,INT,0,,,FBK_WTP2_FaultCode,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_01_fr,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM1_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_01_t1,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM1_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_01_t2,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM1_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_01_t3,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM1_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_02_fr,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM2_FR,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_02_t1,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM2_T1,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_02_t2,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM2_T2,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_02_t3,sp_pond,default,periodic,FLOAT,,,,Val_WTP2_FM2_T3,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_fm_active_spt,sp_pond,default,periodic,INT,0,,,SPT_WTP2_FM_Active,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_jog_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP2_Jog,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_run_permissive,sp_pond,default,periodic,DINT,0,,,WTP2_Run_Permissive,,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_speed_ref_cmd,sp_pond,default,periodic,FLOAT,,,,WTP2_Speed_Ref,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_start_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP2_Start,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_stop_cmd,sp_pond,default,periodic,BIT,,,0,CMD_WTP2_Stop,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_actual_speed,sp_pond,default,periodic,FLOAT,,,,FBK_WTP2_VFD_Actual_Speed,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_cmd_speed,sp_pond,default,periodic,FLOAT,,,,FBK_WTP2_VFD_CMD_Speed,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_commsloss,sp_pond,default,periodic,BIT,,,0,FBK_WTP2_VFD_CommsLoss,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_dc_bus,sp_pond,default,periodic,FLOAT,,,,FBK_WTP2_VFD_DCBus,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_error,sp_pond,default,periodic,BIT,,,0,FBK_WTP2_VFD_Error,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_faulted,sp_pond,default,periodic,BIT,,,0,FBK_WTP2_VFD_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_output_current,sp_pond,default,periodic,FLOAT,,,,FBK_WTP2_VFD_OutputCurrent,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_output_voltage,sp_pond,default,periodic,FLOAT,,,,FBK_WTP2_VFD_OutputVoltage,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_ready,sp_pond,default,periodic,BIT,,,0,FBK_WTP2_VFD_Ready,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_running,sp_pond,default,periodic,BIT,,,0,FBK_WTP2_VFD_Running,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||
wtp_02_vfd_timeout_spt,sp_pond,default,periodic,SINT,0,,,SPT_WTP2_VFD_TimeOut,,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_02_vfd_type,sp_pond,default,periodic,STRING,,,,FBK_WTP2_VFD_Type,,16,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
wtp_system_start_spt,sp_pond,default,periodic,FLOAT,,,,SPT_WTP_System_Start,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||
|
29
Pub_Sub/sp_pond/thingsboard/terri_inlet_totalizers.json
Normal file
29
Pub_Sub/sp_pond/thingsboard/terri_inlet_totalizers.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"totalizer10.json": {
|
||||
"day": 22,
|
||||
"week": "07",
|
||||
"month": "02",
|
||||
"year": 2024,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 9746523.0,
|
||||
"monthHolding": 9102475.0,
|
||||
"weekHolding": 9617539.0,
|
||||
"yearHolding": 8666085
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
"totalizer12.json": {
|
||||
"day": 22,
|
||||
"week": "07",
|
||||
"month": "02",
|
||||
"year": 2024,
|
||||
"lifetime": 0,
|
||||
"dayHolding": 749363.43999999994,
|
||||
"monthHolding": 3.9399999999999999,
|
||||
"weekHolding": 578304.43999999994,
|
||||
"yearHolding": 0
|
||||
}
|
||||
}
|
||||
|
||||
BIN
code snippets/__pycache__/convert_config.cpython-39.pyc
Normal file
BIN
code snippets/__pycache__/convert_config.cpython-39.pyc
Normal file
Binary file not shown.
@@ -4,15 +4,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"abbflow_tcp_tb_v3.cfg\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import convert_config\n",
|
||||
"import os\n",
|
||||
@@ -32,9 +24,35 @@
|
||||
" return max_version + 1\n",
|
||||
"\n",
|
||||
"# Example usage\n",
|
||||
"root = \"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub\"\n",
|
||||
"devicetype = \"abbflow_tcp\"\n",
|
||||
"platform = \"thingsboard\" # or \"mistaway\"\n",
|
||||
"root = \"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub\"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"devicetype = \"flowmeterskid\"\n",
|
||||
"platform = \"thingsboard\" # or \"mistaway\"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"flowmeterskid_tb_v4.cfg\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"platform_short = \"tb\" if platform == \"thingsboard\" else \"ma\" \n",
|
||||
"startversion = get_latest_version(root, devicetype, platform)\n",
|
||||
"\n",
|
||||
@@ -47,18 +65,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/abbflow_tcp/thingsboard\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/abbflow_tcp/thingsboard\n",
|
||||
"Path did not exist creating path: /Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/abbflow_tcp/thingsboard/abbflow_tcp_tb_v3.cfg\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/abbflow_tcp/thingsboard/pub\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/abbflow_tcp/thingsboard/sub\n"
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/flowmeterskid/thingsboard\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/flowmeterskid/thingsboard\n",
|
||||
"Path did not exist creating path: /Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/flowmeterskid/thingsboard/flowmeterskid_tb_v4.cfg\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/flowmeterskid/thingsboard/pub\n",
|
||||
"<DirEntry 'receiveCommand.py'>\n",
|
||||
"{'name': 'Receive Command', 'topic': 'v1/devices/me/rpc/request/+', 'qos': 1, 'funcName': 'receiveCommand', 'payload_type': 'JSON', 'script': 'import json\\nfrom datetime import datetime as dt\\nfrom common.Logger import logger\\nfrom quickfaas.measure import write\\nfrom quickfaas.remotebus import publish\\n\\n\\ndef get_totalizers():\\n try:\\n with open(\"/var/user/files/totalizers.json\", \"r\") as t:\\n totalizers = json.load(t)\\n if not totalizers:\\n logger.info(\"-----INITIALIZING TOTALIZERS-----\")\\n totalizers = {\\n \"day\": 0,\\n \"week\": 0,\\n \"month\": 0,\\n \"year\": 0,\\n \"lifetime\": 0,\\n \"dayHolding\": 0,\\n \"weekHolding\": 0,\\n \"monthHolding\": 0,\\n \"yearHolding\": 0\\n }\\n except:\\n totalizers = {\\n \"day\": 0,\\n \"week\": 0,\\n \"month\": 0,\\n \"year\": 0,\\n \"lifetime\": 0,\\n \"dayHolding\": 0,\\n \"weekHolding\": 0,\\n \"monthHolding\": 0,\\n \"yearHolding\": 0\\n }\\n return totalizers\\n\\ndef saveTotalizers(totalizers):\\n try:\\n with open(\"/var/user/files/totalizers.json\", \"w\") as t:\\n json.dump(totalizers,t)\\n except Exception as e:\\n logger.error(e)\\n\\ndef resetTotalizers():\\n try:\\n totalizers = get_totalizers()\\n \\n totalizers[\"dayHolding\"] = 0\\n totalizers[\"weekHolding\"] = 0\\n totalizers[\"monthHolding\"] = 0\\n totalizers[\"yearHolding\"] = 0\\n saveTotalizers(totalizers) \\n return True\\n except Exception as e:\\n logger.error(e)\\n return e\\n\\ndef receiveCommand(topic, payload):\\n logger.debug(topic)\\n logger.debug(json.loads(payload))\\n p = json.loads(payload)\\n command = p[\"method\"]\\n if command == \"resetTotalizers\":\\n r = resetTotalizers()\\n \\n if r == True:\\n message = [{\"name\": \"flowmeter\", \"measures\":[{\"name\":\"reset_totalizers\", \"value\": 1}]}]\\n try:\\n resp = write(message)\\n payload = {\\n \"ts\": (round(dt.timestamp(dt.now())/600)*600)*1000,\\n \"values\": {\\n \"day_volume\": 0,\\n \"yesterday_volume\": 0,\\n \"week_volume\": 0,\\n \"last_week_volume\": 0,\\n \"month_volume\": 0,\\n \"last_month_volume\": 0,\\n \"year_volume\": 0,\\n \"last_year_volume\": 0\\n }\\n }\\n publish(\"v1/devices/me/telemetry\",json.dumps(payload))\\n except Exception as e:\\n logger.error(\"Failed to write message\")\\n logger.error(e)\\n \\n ack(topic.split(\"/\")[-1], r)\\n\\ndef ack(msgid, r):\\n #logger.debug(msgid)\\n #logger.debug(mac)\\n #logger.debug(name)\\n #logger.debug(value)\\n publish(\"v1/devices/me/rpc/response/\" + str(msgid), json.dumps({\"msg\": {\"time\": (round(dt.timestamp(dt.now())/600)*600)*1000, \"response\": r}, \"metadata\": \"\", \"msgType\": \"\"}))', 'msgType': 0, 'cloudName': 'default', 'trigger': 'command_event'}\n",
|
||||
"/Users/nico/Documents/GitHub/HP_InHand_IG502/Pub_Sub/flowmeterskid/thingsboard/sub\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -86,7 +106,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.5"
|
||||
"version": "3.9.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
2418
code snippets/getPLCData.ipynb
Normal file
2418
code snippets/getPLCData.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
1922
getPLCData.ipynb
1922
getPLCData.ipynb
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user