This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
config-*.json
|
|
||||||
src/udi/udi
|
src/udi/udi
|
||||||
src/udi/migrate_schema
|
src/udi/migrate_schema
|
||||||
tmp/
|
tmp/
|
||||||
|
@ -37,3 +37,11 @@ create or replace view gas_v as
|
|||||||
from measurements
|
from measurements
|
||||||
where application = 'Gas' and
|
where application = 'Gas' and
|
||||||
attributes->>'Status' = 'Ok';
|
attributes->>'Status' = 'Ok';
|
||||||
|
|
||||||
|
create or replace view temperature_v as
|
||||||
|
select time,
|
||||||
|
cast(values->'Value'->>'value' as float) as temperature,
|
||||||
|
device
|
||||||
|
from measurements
|
||||||
|
where application in ('Temperature Multisensor', 'Temperature Shelly Plus HT');
|
||||||
|
|
||||||
|
105
src/udi/config-iot-cluster.json
Normal file
105
src/udi/config-iot-cluster.json
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"mqtt": {
|
||||||
|
"broker": "mqtt://emqx01-anonymous-cluster-internal.broker.svc.cluster.local:1883",
|
||||||
|
"tlsEnable": "false"
|
||||||
|
},
|
||||||
|
"topicMappings": [
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/PV/Values" ],
|
||||||
|
"handler": "PV",
|
||||||
|
"id": "PV",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/MBGW3/Measurement" ],
|
||||||
|
"handler": "MBGW3",
|
||||||
|
"id": "MBGW3",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/OneWireGW/Bus 1/#" ],
|
||||||
|
"handler": "SVER",
|
||||||
|
"id": "SVER0",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Heating",
|
||||||
|
"payloadRegex": "(\\d+(\\.\\d+)?)\\s*([^0-9\\s]\\S*)",
|
||||||
|
"deviceFrom": "topic",
|
||||||
|
"devicePart": "3",
|
||||||
|
"valueFrom": "payload",
|
||||||
|
"valuePart": "1",
|
||||||
|
"unitFrom": "payload",
|
||||||
|
"unitPart": "3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "NR/Multisensor/+/Temperatur" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ0",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Multisensor",
|
||||||
|
"deviceSelector": "T:2",
|
||||||
|
"valueSelector": "J:$.CurrentTemperature",
|
||||||
|
"unitSelector": "C:°C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "NR/Multisensor/+/Feuchte" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ1",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Humidity Multisensor",
|
||||||
|
"deviceSelector": "T:2",
|
||||||
|
"valueSelector": "J:$.CurrentRelativeHumidity",
|
||||||
|
"unitSelector": "C:%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "shellyplusht/+/status/temperature:0" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ2",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Shelly Plus HT",
|
||||||
|
"deviceSelector": "T:1",
|
||||||
|
"valueSelector": "J:$.tC",
|
||||||
|
"unitSelector": "C:°C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "shellyplusht/+/status/humidity:0" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVE4",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Humidity Shelly Plus HT",
|
||||||
|
"deviceSelector": "T:1",
|
||||||
|
"valueSelector": "J:$.rh",
|
||||||
|
"unitSelector": "C:%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"archiver": {
|
||||||
|
"dir": "/archive"
|
||||||
|
}
|
||||||
|
}
|
105
src/udi/config-iot.json
Normal file
105
src/udi/config-iot.json
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"mqtt": {
|
||||||
|
"broker": "mqtt://172.23.1.102:1883",
|
||||||
|
"tlsEnable": "false"
|
||||||
|
},
|
||||||
|
"topicMappings": [
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/PV/Values" ],
|
||||||
|
"handler": "PV",
|
||||||
|
"id": "PV",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/MBGW3/Measurement" ],
|
||||||
|
"handler": "MBGW3",
|
||||||
|
"id": "MBGW3",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "IoT/OneWireGW/Bus 1/#" ],
|
||||||
|
"handler": "SVER",
|
||||||
|
"id": "SVER0",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Heating",
|
||||||
|
"payloadRegex": "(\\d+(\\.\\d+)?)\\s*([^0-9\\s]\\S*)",
|
||||||
|
"deviceFrom": "topic",
|
||||||
|
"devicePart": "3",
|
||||||
|
"valueFrom": "payload",
|
||||||
|
"valuePart": "1",
|
||||||
|
"unitFrom": "payload",
|
||||||
|
"unitPart": "3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "NR/Multisensor/+/Temperatur" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ0",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Multisensor",
|
||||||
|
"deviceSelector": "T:2",
|
||||||
|
"valueSelector": "J:$.CurrentTemperature",
|
||||||
|
"unitSelector": "C:°C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "NR/Multisensor/+/Feuchte" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ1",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Humidity Multisensor",
|
||||||
|
"deviceSelector": "T:2",
|
||||||
|
"valueSelector": "J:$.CurrentRelativeHumidity",
|
||||||
|
"unitSelector": "C:%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "shellyplusht/+/status/temperature:0" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVEJ2",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Shelly Plus HT",
|
||||||
|
"deviceSelector": "T:1",
|
||||||
|
"valueSelector": "J:$.tC",
|
||||||
|
"unitSelector": "C:°C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"topics": [ "shellyplusht/+/status/humidity:0" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVE4",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Humidity Shelly Plus HT",
|
||||||
|
"deviceSelector": "T:1",
|
||||||
|
"valueSelector": "J:$.rh",
|
||||||
|
"unitSelector": "C:%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"archiver": {
|
||||||
|
"dir": "./tmp/udi"
|
||||||
|
}
|
||||||
|
}
|
25
src/udi/config-iot2.json
Normal file
25
src/udi/config-iot2.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"mqtt": {
|
||||||
|
"broker": "mqtt://172.23.1.102:1883",
|
||||||
|
"tlsEnable": "false"
|
||||||
|
},
|
||||||
|
"topicMappings": [
|
||||||
|
{
|
||||||
|
"topics": [ "shellyplusht/+/status/temperature:0" ],
|
||||||
|
"handler": "SVEJ",
|
||||||
|
"id": "SVE3",
|
||||||
|
"config": {
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
"application": "Temperature Shelly Plus HT",
|
||||||
|
"deviceSelector": "T:1",
|
||||||
|
"valueSelector": "J:$.tC",
|
||||||
|
"unitSelector": "C:°C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"archiver": {
|
||||||
|
"dir": "./tmp/udi"
|
||||||
|
}
|
||||||
|
}
|
29
src/udi/config-ttn.json
Normal file
29
src/udi/config-ttn.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"mqtt": {
|
||||||
|
"broker": "mqtt://172.23.1.102:1883",
|
||||||
|
"tlsEnable": "false"
|
||||||
|
},
|
||||||
|
"topicMappings": [
|
||||||
|
{
|
||||||
|
"topics": [ "v3/de-hottis-level-monitoring@ttn/devices/+/up" ],
|
||||||
|
"handler": "TTN"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"handlers": [
|
||||||
|
{
|
||||||
|
"name": "TTN",
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "IoT",
|
||||||
|
"databaseConnStr": "",
|
||||||
|
"attributes": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"archiver": {
|
||||||
|
"dir": "./tmp/udi"
|
||||||
|
}
|
||||||
|
}
|
84
src/udi/handlers/ttn/example.json
Normal file
84
src/udi/handlers/ttn/example.json
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
"end_device_ids": {
|
||||||
|
"device_id": "eui-a840419641867eb5",
|
||||||
|
"application_ids": {
|
||||||
|
"application_id": "de-hottis-level-monitoring"
|
||||||
|
},
|
||||||
|
"dev_eui": "A840419641867EB5",
|
||||||
|
"join_eui": "A840410000000101",
|
||||||
|
"dev_addr": "260B91F9"
|
||||||
|
},
|
||||||
|
"correlation_ids": [
|
||||||
|
"gs:uplink:01HH1R112BNDQQ52N9FVV0TKPW"
|
||||||
|
],
|
||||||
|
"received_at": "2023-12-07T08:59:05.369293395Z",
|
||||||
|
"uplink_message": {
|
||||||
|
"session_key_id": "AYa9JUhNJp00t+hKqkQUog==",
|
||||||
|
"f_port": 2,
|
||||||
|
"f_cnt": 25665,
|
||||||
|
"frm_payload": "DAoAaQDJAA==",
|
||||||
|
"decoded_payload": {
|
||||||
|
"Bat": 3.082,
|
||||||
|
"DALARM_count": 0,
|
||||||
|
"Distance_alarm": 0,
|
||||||
|
"Interrupt_alarm": 0,
|
||||||
|
"dis1": 105,
|
||||||
|
"dis2": 201
|
||||||
|
},
|
||||||
|
"rx_metadata": [
|
||||||
|
{
|
||||||
|
"gateway_ids": {
|
||||||
|
"gateway_id": "eui-00005813d35e3021",
|
||||||
|
"eui": "00005813D35E3021"
|
||||||
|
},
|
||||||
|
"timestamp": 1141271036,
|
||||||
|
"rssi": -100,
|
||||||
|
"channel_rssi": -100,
|
||||||
|
"snr": 7.3,
|
||||||
|
"location": {
|
||||||
|
"latitude": 52.17065267448476,
|
||||||
|
"longitude": 7.629437184774199,
|
||||||
|
"source": "SOURCE_REGISTRY"
|
||||||
|
},
|
||||||
|
"uplink_token": "CiIKIAoUZXVpLTAwMDA1ODEzZDM1ZTMwMjESCAAAWBPTXjAhEPzTmaAEGgsI2ZLGqwYQnfLnTSDggLjIm5IF",
|
||||||
|
"channel_index": 6,
|
||||||
|
"received_at": "2023-12-07T08:59:05.163182877Z"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"data_rate": {
|
||||||
|
"lora": {
|
||||||
|
"bandwidth": 125000,
|
||||||
|
"spreading_factor": 7,
|
||||||
|
"coding_rate": "4/5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frequency": "868300000",
|
||||||
|
"timestamp": 1141271036
|
||||||
|
},
|
||||||
|
"received_at": "2023-12-07T08:59:05.163964824Z",
|
||||||
|
"consumed_airtime": "0.056576s",
|
||||||
|
"locations": {
|
||||||
|
"user": {
|
||||||
|
"latitude": 52.1707216912195,
|
||||||
|
"longitude": 7.63066603211241,
|
||||||
|
"altitude": 39,
|
||||||
|
"source": "SOURCE_REGISTRY"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version_ids": {
|
||||||
|
"brand_id": "dragino",
|
||||||
|
"model_id": "lmds200",
|
||||||
|
"hardware_version": "_unknown_hw_version_",
|
||||||
|
"firmware_version": "1.0",
|
||||||
|
"band_id": "EU_863_870"
|
||||||
|
},
|
||||||
|
"network_ids": {
|
||||||
|
"net_id": "000013",
|
||||||
|
"ns_id": "EC656E0000000181",
|
||||||
|
"tenant_id": "ttn",
|
||||||
|
"cluster_id": "eu1",
|
||||||
|
"cluster_address": "eu1.cloud.thethings.network"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user