191 lines
7.1 KiB
INI
191 lines
7.1 KiB
INI
{
|
|
"controllers": [
|
|
{
|
|
"protocol": "virtualcontroller",
|
|
"name": "cameratrailer",
|
|
"args": {},
|
|
"samplePeriod": 10,
|
|
"expired": 10000
|
|
}
|
|
],
|
|
"groups": [
|
|
{
|
|
"name": "default",
|
|
"uploadInterval": 600,
|
|
"reference": 45
|
|
}
|
|
],
|
|
"measures": [
|
|
{
|
|
"name": "t",
|
|
"ctrlName": "cameratrailer",
|
|
"group": "default",
|
|
"uploadType": "periodic",
|
|
"dataType": "BIT",
|
|
"addr": "",
|
|
"decimal": 2,
|
|
"len": 1,
|
|
"readWrite": "ro",
|
|
"unit": "",
|
|
"desc": "",
|
|
"transformType": 0,
|
|
"maxValue": "",
|
|
"minValue": "",
|
|
"maxScaleValue": "",
|
|
"minScaleValue": "",
|
|
"gain": "",
|
|
"offset": ""
|
|
}
|
|
],
|
|
"alarms": [],
|
|
"misc": {
|
|
"maxAlarmRecordSz": 2000,
|
|
"logLvl": "DEBUG",
|
|
"coms": [
|
|
{
|
|
"name": "rs232",
|
|
"baud": 9600,
|
|
"bits": 8,
|
|
"stopbits": 1,
|
|
"parityChk": "n"
|
|
},
|
|
{
|
|
"name": "rs485",
|
|
"baud": 19200,
|
|
"bits": 8,
|
|
"stopbits": 1,
|
|
"parityChk": "n"
|
|
}
|
|
]
|
|
},
|
|
"clouds": [
|
|
{
|
|
"cacheSize": 10000,
|
|
"enable": 1,
|
|
"type": "Standard MQTT",
|
|
"args": {
|
|
"host": "thingsboard.cloud",
|
|
"port": 1883,
|
|
"clientId": "camera-trailer-",
|
|
"auth": 1,
|
|
"tls": 0,
|
|
"cleanSession": 0,
|
|
"mqttVersion": "v3.1.1",
|
|
"keepalive": 60,
|
|
"key": "",
|
|
"cert": "",
|
|
"rootCA": "",
|
|
"verifyServer": 0,
|
|
"verifyClient": 0,
|
|
"username": "assmqtt",
|
|
"passwd": "assmqtt@1903"
|
|
}
|
|
}
|
|
],
|
|
"labels": [
|
|
{
|
|
"key": "SN",
|
|
"value": "GF5022137006251"
|
|
},
|
|
{
|
|
"key": "MAC",
|
|
"value": "00:18:05:1a:e5:36"
|
|
},
|
|
{
|
|
"key": "MAC_UPPER",
|
|
"value": "00:18:05:1A:E5:37"
|
|
},
|
|
{
|
|
"key": "MAC_LOWER",
|
|
"value": "00:18:05:1a:e5:37"
|
|
}
|
|
],
|
|
"quickfaas": {
|
|
"uploadFuncs": [
|
|
{
|
|
"qos": 1,
|
|
"funcName": "sendData",
|
|
"script": "# Enter your python code.\nimport json\nfrom common.Logger import logger\nfrom quickfaas.remotebus import publish\nfrom mobiuspi_lib.gps import GPS \n\ndef getGPS():\n # Create a gps instance\n gps = GPS()\n\n # Retrieve GPS information\n position_status = gps.get_position_status()\n logger.debug(\"position_status: \")\n logger.debug(position_status)\n latitude = position_status[\"latitude\"].split(\" \")\n longitude = position_status[\"longitude\"].split(\" \")\n lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)\n lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)\n if latitude[2] == \"S\":\n lat_dec = lat_dec * -1\n if longitude[2] == \"W\":\n lon_dec = lon_dec * -1\n #lat_dec = round(lat_dec, 7)\n #lon_dec = round(lon_dec, 7)\n logger.info(\"HERE IS THE GPS COORDS\")\n logger.info(f\"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}\")\n publish(__topic__, json.dumps({\"latitude\":f\"{lat_dec:.8f}\", \"longitude\":f\"{lon_dec:.8f}\"}), __qos__)\n\ndef sendData(message,wizard_api):\n logger.debug(message)\n #publish(__topic__, json.dumps(message), __qos__)\n getGPS()",
|
|
"name": "sendData",
|
|
"trigger": "measure_event",
|
|
"topic": "v1/devices/me/telemetry",
|
|
"msgType": 0,
|
|
"groups": [
|
|
"default"
|
|
]
|
|
},
|
|
{
|
|
"qos": 1,
|
|
"funcName": "sendSnapshot",
|
|
"script": "# Enter your python code.\nimport json\nfrom common.Logger import logger\nfrom quickfaas.remotebus import publish\nimport requests\nfrom requests.auth import HTTPDigestAuth\nfrom requests.exceptions import ConnectionError\nimport base64\n\ndef getImage():\n with open('./snapshot.jpg', 'wb') as handle:\n resp = requests.get(\"http://192.168.1.97:3097/cgi-bin/SnapshotJPEG?Resolution=640x360\", auth=HTTPDigestAuth(\"ASS\", \"amerus@1903\"), stream=True)\n for block in resp.iter_content(1024):\n if not block:\n break\n handle.write(block)\n \n with open('./snapshot.jpg', 'rb') as image_file:\n encoded_string = base64.b64encode(image_file.read())\n publish(__topic__, json.dumps({\"snapshot\": encoded_string.decode(\"UTF-8\"), \"camera_error\": \"OK\"}), __qos__)\n\n\ndef sendSnapshot(message,wizard_api):\n logger.debug(message)\n try:\n getImage()\n except ConnectionError as ce:\n logger.error(\"Could not connect to Camera\")\n logger.error(ce)\n publish(__topic__, json.dumps({\"camera_error\": f\"Could not connect to camera, check camera connection and power\\n\\n{ce}\"}), __qos__)\n except Exception as e:\n logger.error(\"Could not get image\")\n logger.error(e)\n publish(__topic__, json.dumps({\"camera_error\": f\"Could not connect to camera, check camera connection and power\\n\\n{e}\"}), __qos__)\n ",
|
|
"name": "snapshot",
|
|
"trigger": "measure_event",
|
|
"topic": "v1/devices/me/telemetry",
|
|
"cloudName": "default",
|
|
"groups": [
|
|
"snapshot"
|
|
],
|
|
"msgType": 0
|
|
}
|
|
],
|
|
"downloadFuncs": []
|
|
},
|
|
"modbusSlave": {
|
|
"enable": 0,
|
|
"protocol": "Modbus-TCP",
|
|
"port": 502,
|
|
"slaveAddr": 1,
|
|
"int16Ord": "ab",
|
|
"int32Ord": "abcd",
|
|
"float32Ord": "abcd",
|
|
"maxConnection": 5,
|
|
"mapping_table": []
|
|
},
|
|
"iec104Server": {
|
|
"enable": 0,
|
|
"cotSize": 2,
|
|
"port": 2404,
|
|
"serverList": [
|
|
{
|
|
"asduAddr": 1
|
|
}
|
|
],
|
|
"kValue": 12,
|
|
"wValue": 8,
|
|
"t0": 15,
|
|
"t1": 15,
|
|
"t2": 10,
|
|
"t3": 20,
|
|
"maximumLink": 5,
|
|
"timeSet": 1,
|
|
"byteOrder": "abcd",
|
|
"mapping_table": []
|
|
},
|
|
"opcuaServer": {
|
|
"enable": 0,
|
|
"port": 4840,
|
|
"maximumLink": 5,
|
|
"securityMode": 0,
|
|
"identifierType": "String",
|
|
"mapping_table": []
|
|
},
|
|
"bindConfig": {
|
|
"enable": 0,
|
|
"bind": {
|
|
"modelId": "",
|
|
"modelName": "",
|
|
"srcId": "",
|
|
"srcName": "",
|
|
"devId": "",
|
|
"devName": ""
|
|
},
|
|
"varGroups": [],
|
|
"variables": [],
|
|
"alerts": []
|
|
},
|
|
"southMetadata": {},
|
|
"bindMetadata": {
|
|
"version": "",
|
|
"timestamp": ""
|
|
}
|
|
} |