diff --git a/vendor/index.yaml b/vendor/index.yaml index 0a3fa24de9..f424b32059 100644 --- a/vendor/index.yaml +++ b/vendor/index.yaml @@ -1978,6 +1978,10 @@ vendors: website: https://open-boat-projects.org logo: obp_logo.png + - id: watteco + name: WATTECO + vendorID: 296 + - id: arwin-technology name: Arwin Technology Limited website: https://www.senso8.com/ diff --git a/vendor/watteco/index.yaml b/vendor/watteco/index.yaml new file mode 100644 index 0000000000..c23958987a --- /dev/null +++ b/vendor/watteco/index.yaml @@ -0,0 +1,5 @@ +# This example contains just one end device: windsensor. It is referenced here in the index. + +endDevices: + # Unique identifier of the end device (lowercase, alphanumeric with dashes, max 36 characters) + - th-sensor diff --git a/vendor/watteco/th-sensor-codec.yaml b/vendor/watteco/th-sensor-codec.yaml new file mode 100644 index 0000000000..5241d5ca43 --- /dev/null +++ b/vendor/watteco/th-sensor-codec.yaml @@ -0,0 +1,301 @@ +# Uplink decoder decodes binary data uplink into a JSON object (optional) +# For documentation on writing encoders and decoders, see: https://thethingsstack.io/integrations/payload-formatters/javascript/ +uplinkDecoder: + fileName: th-sensor.js + # Examples (optional) + # examples: +# [ +# { +# "type": "uplink", +# "description": "uplink standard report containing temperature value | payload:110A04020000290B89", +# "input": { +# "bytes": [ +# 17, +# 10, +# 4, +# 2, +# 0, +# 0, +# 41, +# 11, +# 137 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:31.598957793Z" +# }, +# "output": { +# "data": [{ +# "variable": "temperature", +# "value": 29.53, +# "date": "2023-07-19T07:51:31.598957793Z" +# }], +# "warnings": [""] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing 2 short threshold alarms on temperature value | payload:118A0402000029075590B0B1", +# "input": { +# "bytes": [ +# 17, 138, 4, 2, 0, +# 0, 41, 7, 85, 144, +# 176, 177 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": [ +# { +# "variable": "temperature", +# "value": 18.77, +# "date": "2023-07-19T07:51:25.508306410Z" +# } +# ], +# "warnings": +# [ +# "alarm, criterion_index: 0, mode: threshold, crossing: fall", +# "alarm, criterion_index: 1, mode: threshold, crossing: fall" +# ] +# +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing 3 long threshold alarms on temperature value | payload:118a0402000029010ea0b008fc000001b10834000001b207d0000001", +# "input": { +# "bytes": [ +# 17, 138, 4, 2, 0, 0, 41, 1, +# 14, 160, 176, 8, 252, 0, 0, 1, +# 177, 8, 52, 0, 0, 1, 178, 7, +# 208, 0, 0, 1 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output":{ +# "data": [ +# { +# "variable": "temperature", +# "value": 2.7, +# "date": "2023-07-19T07:51:25.508306410Z" +# } +# ], +# "warnings": [ +# "alarm, criterion_index: 0, mode: threshold, crossing: fall, value: 23, gap: 0, occurences: 1", +# "alarm, criterion_index: 1, mode: threshold, crossing: fall, value: 21, gap: 0, occurences: 1", +# "alarm, criterion_index: 2, mode: threshold, crossing: fall, value: 20, gap: 0, occurences: 1" +# ] +# +# } +# +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing a long delta alarm on temperature value | payload:118A04020000290B35A0C80014", +# "input": { +# "bytes": [ +# 17, 138, 4, 2, 0, 0, +# 41, 11, 53, 160, 200, 0, +# 20 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": [ +# { +# "variable": "temperature", +# "value": 28.69, +# "date": "2023-07-19T07:51:25.508306410Z" +# } +# ], +# "warnings": [ "alarm, criterion_index: 0, mode: delta, value: 0.2" ] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing humidity value | payload:110A04050000210E89", +# "input": { +# "bytes": [ +# 17, +# 10, +# 4, +# 5, +# 0, +# 0, +# 33, +# 14, +# 137 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": [{ +# "variable": "humidity", +# "value": 37.21, +# "date": "2023-07-19T07:51:25.508306410Z" +# }], +# "warnings": [ +# "" +# ] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing state of case | payload:110A000F00551001", +# "input": { +# "bytes": [ +# 17, +# 10, +# 0, +# 15, +# 0, +# 85, +# 16, +# 1 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": [{ +# "variable": "violation_detection", +# "value": true, +# "date": "2023-07-19T07:51:25.508306410Z" +# }], +# "warnings": [ +# "" +# ] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing number of pulse detection on input 1 | payload:110A000F04022300000000", +# "input": { +# "bytes": [ +# 17, +# 10, +# 0, +# 15, +# 4, +# 2, +# 35, +# 0, +# 0, +# 0, +# 0 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": [ +# { +# "variable": "index", +# "value": 0, +# "date": "2023-07-19T07:51:25.508306410Z" +# } +# ], +# "warnings": [""] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink standard report containing cmdID 0x07 response for temperature cluster | payload:1107040200800000", +# "input": { +# "bytes": [ +# 17, 7, 4, 2, +# 0, 128, 0, 0 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# }, +# "output": { +# "data": { +# "report": "standard", +# "endpoint": 0, +# "cmdID": "0x07", +# "clustID": "0x0402", +# "attID": "0x0000", +# "status": 0, +# "report_parameters": { +# "new_mode_configuration": "1", +# "cause_request": "none", +# "secured_if_alarm": "0", +# "secured": "0", +# "no_hearde_port": "0", +# "batch": "0" +# } +# }, +# "warnings": [ "" ] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink of read current value on cluster 0x0402 | payload:11010402000000290992", +# "input": { +# "bytes": [ +# 17, 1, 4, 2, 0, +# 0, 0, 41, 9, 146 +# ], +# "fPort": 125, +# "recvTime": "2023-07-19T07:51:25.508306410Z" +# } +# , +# "output": { +# "data": [{ +# "variable": "temperature", +# "value": 24.5, +# "date": "2023-07-19T07:51:25.508306410Z" +# }], +# "warnings": [ "" ] +# } +# }, +# { +# "type": "uplink", +# "description": "uplink containing a batch of values | payload:362100808098c31ecb824d7b07ba3d", +# "input": { +# "bytes": [ +# 54, +# 33, +# 0, +# 128, +# 128, +# 152, +# 195, +# 30, +# 203, +# 130, +# 77, +# 123, +# 7, +# 186, +# 61 +# ], +# "fPort": 125, +# "recvTime": "2023-07-18T12:19:53.243Z" +# }, +# "output": { +# "data": [ +# { +# "variable": "temperature", +# "value": 28.7, +# "date": "2023-07-18T12:19:53.243Z" +# }, +# { +# "variable": "humidity", +# "value": 37, +# "date": "2023-07-18T12:19:53.243Z" +# }, +# { +# "variable": "battery_voltage", +# "value": 3.707, +# "date": "2023-07-18T12:19:52.243Z" +# } +# ], +# "warnings": [""] +# } +# } +# ] diff --git a/vendor/watteco/th-sensor-profile.yaml b/vendor/watteco/th-sensor-profile.yaml new file mode 100644 index 0000000000..b091054ae5 --- /dev/null +++ b/vendor/watteco/th-sensor-profile.yaml @@ -0,0 +1,52 @@ +# Vendor profile ID, can be freely issued by the vendor +# This vendor profile ID is also used on the QR code for LoRaWAN devices, see +# https://lora-alliance.org/sites/default/files/2020-10/LoRa_Alliance_Vendor_ID_for_QR_Code.pdf +vendorProfileID: 296 + +# LoRaWAN MAC version: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4 or 1.1 +macVersion: 1.0.2 +# LoRaWAN Regional Parameters version. Values depend on the LoRaWAN version: +# 1.0: TS001-1.0 +# 1.0.1: TS001-1.0.1 +# 1.0.2: RP001-1.0.2 or RP001-1.0.2-RevB +# 1.0.3: RP001-1.0.3-RevA +# 1.0.4: RP002-1.0.0 or RP002-1.0.1 +# 1.1: RP001-1.1-RevA or RP001-1.1-RevB +regionalParametersVersion: RP001-1.0.2-RevB + +# Whether the end device supports join (OTAA) or not (ABP) +supportsJoin: true +# If your device is an ABP device (supportsJoin is false), uncomment the following fields: +# RX1 delay +#rx1Delay: 5 +# RX1 data rate offset +#rx1DataRateOffset: 0 +# RX2 data rate index +#rx2DataRateIndex: 0 +# RX2 frequency (MHz) +#rx2Frequency: 869.525 +# Factory preset frequencies (MHz) +#factoryPresetFrequencies: [868.1, 868.3, 868.5, 867.1, 867.3, 867.5, 867.7, 867.9] + +# Maximum EIRP +maxEIRP: 16 +# Whether the end device supports 32-bit frame counters +supports32bitFCnt: true + +# Whether the end device supports class B +supportsClassB: false +# If your device supports class B, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classBTimeout: 60 +# Ping slot period (seconds) +#pingSlotPeriod: 128 +# Ping slot data rate index +#pingSlotDataRateIndex: 0 +# Ping slot frequency (MHz). Set to 0 if the band supports ping slot frequency hopping. +#pingSlotFrequency: 869.525 + +# Whether the end device supports class C +supportsClassC: false +# If your device supports class C, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classCTimeout: 60 diff --git a/vendor/watteco/th-sensor.jpg b/vendor/watteco/th-sensor.jpg new file mode 100644 index 0000000000..8cb0b302ce Binary files /dev/null and b/vendor/watteco/th-sensor.jpg differ diff --git a/vendor/watteco/th-sensor.js b/vendor/watteco/th-sensor.js new file mode 100644 index 0000000000..894d0c2a27 --- /dev/null +++ b/vendor/watteco/th-sensor.js @@ -0,0 +1 @@ +var driver;(()=>{var t={813:e=>{let t=6,a=10,i=12,r={0:0,1:1,2:4,3:4,4:8,5:8};r[t]=16,r[7]=16,r[8]=24,r[9]=24,r[a]=32,r[11]=32,r[i]=32;let n=14,o=[[{sz:2,lbl:0},{sz:2,lbl:1},{sz:2,lbl:3},{sz:3,lbl:5},{sz:4,lbl:9},{sz:5,lbl:17},{sz:6,lbl:33},{sz:7,lbl:65},{sz:8,lbl:129},{sz:10,lbl:512},{sz:11,lbl:1026},{sz:11,lbl:1027},{sz:11,lbl:1028},{sz:11,lbl:1029},{sz:11,lbl:1030},{sz:11,lbl:1031}],[{sz:7,lbl:111},{sz:5,lbl:26},{sz:4,lbl:12},{sz:3,lbl:3},{sz:3,lbl:7},{sz:2,lbl:2},{sz:2,lbl:0},{sz:3,lbl:2},{sz:6,lbl:54},{sz:9,lbl:443},{sz:9,lbl:441},{sz:10,lbl:885},{sz:10,lbl:884},{sz:10,lbl:880},{sz:11,lbl:1763},{sz:11,lbl:1762}],[{sz:4,lbl:9},{sz:3,lbl:5},{sz:2,lbl:0},{sz:2,lbl:1},{sz:2,lbl:3},{sz:5,lbl:17},{sz:6,lbl:33},{sz:7,lbl:65},{sz:8,lbl:129},{sz:10,lbl:512},{sz:11,lbl:1026},{sz:11,lbl:1027},{sz:11,lbl:1028},{sz:11,lbl:1029},{sz:11,lbl:1030},{sz:11,lbl:1031}]];function l(e,t,a,i){return{uncompressSamples:[{data_relative_timestamp:i,data:{value:u(e,t),label:a}}],codingType:0,codingTable:0,resolution:null}}function d(e,t){for(let a=0;an?e.getNextSample(a):i>0?function(e,t,i){return e.getNextSample(a,i)+t+Math.pow(2,i)-1}(e,t,i):t}function u(e,t){let a=e.getNextSample(t);return t===i?function(e){let t=2147483648&e?-1:1,a=(e>>23&255)-127,i=8388607&e;if(128===a)return t*(i?Number.NaN:Number.POSITIVE_INFINITY);if(-127===a){if(0===i)return 0*t;a=-126,i/=1<<22}else i=(i|1<<23)/(1<<23);return t*i*Math.pow(2,a)}(a):a}function c(e,a,i,r,n){let o=e.getNextSample(t,n);return 0===i?function(e,t,a,i){return e>=Math.pow(2,i-1)?e*t+a:(e+1-Math.pow(2,i))*t+a}(o,r,a,n):1===i?(o+Math.pow(2,n)-1)*r+a:a-(o+(Math.pow(2,n)-1))*r}Math.trunc=Math.trunc||function(e){return isNaN(e)?NaN:e>0?Math.floor(e):Math.ceil(e)},e.exports={normalisation_batch:function(e){let t=e.date,u=function(e,t,u,p){let m=function(){let e=[],t=0;for(;t<16;)e.push({codingType:0,codingTable:0,resolution:null,uncompressSamples:[]}),t+=1;return{batch_counter:0,batch_relative_timestamp:0,series:e}}(),f=function(e){function t(e,t,a){let i=t,r=a-1;if(8*e.length0;)e[i>>3]&1<<(7&i)&&(o|=1<0&&(d=8);l>0;){let e=0;for(;d>0;){let t=n>>3;this.byteArray[t]&1<<(7&n)&&(o|=1<<8*(l-1)+e),d--,e++,n+=1}l--,d=8}if((3==e||5==e||7==e||9==e)&&o&1<=2;)t.push(parseInt(e.substring(0,2),16)),e=e.substring(2,e.length);return t}(u)),g=function(e){let t=e.toString(2);for(;t.length<8;)t="0"+t;return{isCommonTimestamp:parseInt(t[t.length-2],2),hasSample:!parseInt(t[t.length-3],2),batch_req:parseInt(t[t.length-4],2),nb_of_type_measure:parseInt(t.substring(0,4),2)}}(f.getNextSample(4));m.batch_counter=f.getNextSample(4,3),f.getNextSample(4,1);let E=function(e,t,a,i,r){let n=0,o=0;for(let _=0;_0){let e=o[s-1];o.push(t.getNextSample(a,i)+e+Math.pow(2,i)-1)}else o.push(precedingTimestamp);else o.push(t.getNextSample(a));l=o[s]}return{timestampCommon:o,lastTimestamp:l}}(e,t,s,i),p=u.timestampCommon,m=u.lastTimestamp;for(let a=0;a0)d.data.value=c(t,n,e.series[i].codingType,r[i].resol,l);else{if(a){a=0;continue}d.data.value=n}}else d.data.value=t.getNextSample(r[i].sampletype);d.data_relative_timestamp=p[o],e.series[i].uncompressSamples.push(d)}}return m}(e,t,i,r,l,s):function(e,t,a,i,r,o){let l={};for(let s=0;si&&(i=d.data_relative_timestamp),s=t.getNextBifromHi(e.series[r].codingTable),s<=n){let i=e.series[r].uncompressSamples[e.series[r].uncompressSamples.length-1].data.value;d.data.value=s>0?c(t,i,e.series[r].codingType,a[r].resol,s):i}else d.data.value=t.getNextSample(a[r].sampletype);e.series[r].uncompressSamples.push(d)}}}return i}(e,t,r,o,l,s)}(m,f,v,t,P,g,e)),m.batch_relative_timestamp=s(f,P),function(e,t,a){let i={batch_counter:e.batch_counter,batch_relative_timestamp:e.batch_relative_timestamp};return a&&(i.batch_absolute_timestamp=a),i.dataset=e.series.reduce((function(i,r,n){return i.concat(r.uncompressSamples.map((function(i){let r={data_relative_timestamp:i.data_relative_timestamp,data:{value:t[n].divide?i.data.value/t[n].divide:i.data.value,label:t[n].taglbl}};var o,l,d;return t[n].lblname&&(r.data.label_name=t[n].lblname),a&&(r.data_absolute_timestamp=(o=a,l=e.batch_relative_timestamp,d=i.data_relative_timestamp,new Date(new Date(o)-1e3*(l-d)).toISOString())),r})))}),[]),i}(m,t,p)}(e.batch1,e.batch2,e.payload,t);console.log(u);let p=[];for(let e=0;e{const i=a(544),r=a(813);e.exports={watteco_decodeUplink:function(e,t,a){e.bytes,e.fPort;let n=e.recvTime;try{let o=i.normalisation_standard(e,a),l=o.payload;if("batch"!==o.type)return{data:o.data,warnings:o.warning};{let e={batch1:t[0],batch2:t[1],payload:l,date:n};try{return{data:r.normalisation_batch(e),warnings:[""]}}catch(e){return{error:e.message,warnings:[""]}}}}catch(e){return{error:e.message,warnings:[""]}}}}},544:t=>{let a={16:{name:"boolean",size:1},8:{name:"general8",size:1},9:{name:"general16",size:2},10:{name:"general24",size:3},11:{name:"general32",size:4},24:{name:"bitmap8",size:1},25:{name:"bitmap16",size:2},32:{name:"uint8",size:1},33:{name:"uint16",size:2},34:{name:"uint24",size:3},35:{name:"uint32",size:4},40:{name:"int8",size:1},41:{name:"int16",size:2},43:{name:"int32",size:4},48:{name:"enum8",size:1},66:{name:"char string",size:1},65:{name:"bytes string",size:1},67:{name:"long bytes string",size:2},76:{name:"structured ordered sequence",size:2},57:{name:"single",size:4}},i={32778:{0:{0:{divider:1,function_type:"int",name:"positive_active_energy",size:4},1:{divider:1,function_type:"int",name:"negative_active_energy",size:4},2:{divider:1,function_type:"int",name:"positive_reactive_energy",size:4},3:{divider:1,function_type:"int",name:"negative_reactive_energy",size:4},4:{divider:1,function_type:"int",name:"positive_active_power",size:4},5:{divider:1,function_type:"int",name:"negative_active_power",size:4},6:{divider:1,function_type:"int",name:"positive_reactive_power",size:4},7:{divider:1,function_type:"int",name:"negative_reactive_power",size:4}}},32784:{0:{0:{divider:1,function_type:"int",name:"active_energy_a",size:4},1:{divider:1,function_type:"int",name:"reactive_energy_a",size:4},2:{divider:1,function_type:"int",name:"active_energy_b",size:4},3:{divider:1,function_type:"int",name:"reactive_energy_b",size:4},4:{divider:1,function_type:"int",name:"active_energy_c",size:4},5:{divider:1,function_type:"int",name:"reactive_energy_c",size:4},6:{divider:1,function_type:"int",name:"active_energy_abc",size:4},7:{divider:1,function_type:"int",name:"reactive_energy_abc",size:4}},1:{0:{divider:1,function_type:"int",name:"active_power_a",size:4},1:{divider:1,function_type:"int",name:"reactive_power_a",size:4},2:{divider:1,function_type:"int",name:"active_power_b",size:4},3:{divider:1,function_type:"int",name:"reactive_power_b",size:4},4:{divider:1,function_type:"int",name:"active_power_c",size:4},5:{divider:1,function_type:"int",name:"reactive_power_c",size:4},6:{divider:1,function_type:"int",name:"active_power_abc",size:4},7:{divider:1,function_type:"int",name:"reactive_power_abc",size:4}}},32779:{0:{0:{divider:10,function_type:"int",name:"Vrms",size:2},1:{divider:10,function_type:"int",name:"Irms",size:2},2:{divider:1,function_type:"int",name:"angle",size:2}}},32781:{0:{0:{divider:10,function_type:"int",name:"Vrms_a",size:2},1:{divider:10,function_type:"int",name:"Irms_a",size:2},2:{divider:1,function_type:"int",name:"angle_a",size:2},3:{divider:10,function_type:"int",name:"Vrms_b",size:2},4:{divider:10,function_type:"int",name:"Irms_b",size:2},5:{divider:1,function_type:"int",name:"angle_b",size:2},6:{divider:10,function_type:"int",name:"Vrms_c",size:2},7:{divider:10,function_type:"int",name:"Irms_c",size:2},8:{divider:1,function_type:"int",name:"angle_c",size:2}}},32850:{0:{0:{divider:1e3,function_type:"int",name:"frequency",size:2},1:{divider:1e3,function_type:"int",name:"frequency_min",size:2},2:{divider:1e3,function_type:"int",name:"frequency_max",size:2},3:{divider:10,function_type:"int",name:"Vrms",size:2},4:{divider:10,function_type:"int",name:"Vrms_min",size:2},5:{divider:10,function_type:"int",name:"Vrms_max",size:2},6:{divider:10,function_type:"int",name:"Vpeak",size:2},7:{divider:10,function_type:"int",name:"Vpeak_min",size:2},8:{divider:10,function_type:"int",name:"Vpeak_max",size:2},9:{divider:1,function_type:"int",name:"over_voltage",size:2},10:{divider:1,function_type:"int",name:"sag_voltage",size:2}}},32773:{0:{0:{divider:1,function_type:"none",name:"pin_state_1",size:1},1:{divider:1,function_type:"none",name:"pin_state_2",size:1},2:{divider:1,function_type:"none",name:"pin_state_3",size:1},3:{divider:1,function_type:"none",name:"pin_state_4",size:1},4:{divider:1,function_type:"none",name:"pin_state_5",size:1},5:{divider:1,function_type:"none",name:"pin_state_6",size:1},6:{divider:1,function_type:"none",name:"pin_state_7",size:1},7:{divider:1,function_type:"none",name:"pin_state_8",size:1},8:{divider:1,function_type:"none",name:"pin_state_9",size:1},9:{divider:1,function_type:"none",name:"pin_state_10",size:1}}},80:{6:{0:{divider:1e3,function_type:"none",name:"power_modes",size:2},1:{divider:1e3,function_type:"none",name:"current_power_source",size:2},2:{divider:1e3,function_type:"none",name:"constant_power",size:2},3:{divider:1e3,function_type:"none",name:"rechargeable_battery",size:2},4:{divider:1e3,function_type:"none",name:"disposable_battery",size:2},5:{divider:1e3,function_type:"none",name:"solar_harvesting",size:2},6:{divider:1e3,function_type:"none",name:"TIC_harvesting",size:2}}}};function r(e,t){return 2===t&&(32768&e)>0&&(e-=65536),3===t&&(8388608&e)>0&&(e-=16777216),4===t&&(2147483648&e)>0&&(e-=4294967296),e}function o(e){let t=2147483648&e?-1:1,a=(e>>23&255)-127,i=8388607&e;if(128===a)return t*(i?Number.NaN:Number.POSITIVE_INFINITY);if(-127===a){if(0===i)return 0;a=-126,i/=1<<23}else i=(i|1<<23)/(1<<23);return t*i*Math.pow(2,a)}function l(e,t,a,i){void 0===i&&(i=!1);let r,n,o="U"!=a.substr(0,1),l=parseInt(a.substr(1,2),10)/8,d=l;for(i?(r=-1,n=t+l-1):r=1,n=t,tmpInt64=0,j=n;d>0;j+=r,d--)tmpInt64=(tmpInt64<<8)+e[j];return o&&l<8&&128&e[n]&&(tmpInt64-=1<<8*l),tmpInt64}function _(e,t){let a=e.toString(16).toUpperCase();for(t=null==t?t=2:t;a.length=128?(v=c(256*n[d+6+e*E+S]+n[d+7+e*E+S]),v=parseInt(v,2),h=c(256*n[d+8+e*E+S]+n[d+9+e*E+S]),h=parseInt(h,2),S+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+v+", occurences_down: "+h):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+P;else{let t=n[d+e*E+1+S],_=i[f][g][t].name;"none"===u?(a=((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString(),p=((256*n[d+4+e*E+S]+n[d+5+e*E+S])/s).toString()):"int"===u?(a=r((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString(),p=r((256*n[d+4+e*E+S]+n[d+5+e*E+S])/s).toString()):"float"===u&&(a=o((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString(),p=o((256*n[d+4+e*E+S]+n[d+5+e*E+S])/s).toString()),P=c(n[d+6+e*E+S]),P=parseInt(P,2),P>=128?(v=c(256*n[d+7+e*E+S]+n[d+8+e*E+S]),v=parseInt(v,2),h=c(256*n[d+9+e*E+S]+n[d+10+e*E+S]),h=parseInt(h,2),S+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+v+", occurences_down: "+h+", field: "+_):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+P+", field: "+_}t.push(l)}if("0"===_[3]&&"1"===_[4]){e-=3;let a="",l="";if(0===b)"none"===u?a=((256*n[d+1+e*E+S]+n[d+2+e*E+S])/s).toString():"int"===u?a=r((256*n[d+1+e*E+S]+n[d+2+e*E+S])/s).toString():"float"===u&&(a=o((256*n[d+1+e*E+S]+n[d+2+e*E+S])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a;else{let t=n[d+e*E+1+S],_=i[f][g][t].name;"none"===u?a=((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString():"int"===u?a=r((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString():"float"===u&&(a=o((256*n[d+2+e*E+S]+n[d+3+e*E+S])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a+", field: "+_}t.push(l)}if(E+=1,P=0,h=0,v=0,z=n[d+e*E+S],void 0===z){l.zclheader.alarmmsg=t,a=1;break}}}(n,l,d,s,_,u,f,b,v,h,e,t):4===S?function(e,t,a,n,l,d,s,_,u,m,f,g){console.log("alarmLong4Bytes");let E=0,P=0,v=0,h=0,S=0,b=0;1===m&&(e+=1,console.log("length:"+e),b=1),void 0===u&&(u="single"===_?"float":"int8"===_||"int16"===_||"int32"===_?"int":"none");let z=n[d+e*E];for(void 0===z&&(l.zclheader.alarmmsg=t,a=1);0===a;){if(1===m){console.log("field_driven"),console.log(d+e*E+1);let t=n[d+e*E+1+P];console.log("fi:"+t),s=i[f][g][t].divider,u=i[f][g][t].function_type}let _=c(z),A=4*p(_[5])+2*p(_[6])+p(_[7]);if("1"===_[3]&&"0"===_[4]){let a="",l="",p="",m="";if(m="1"===_[1]?"exceed":"fall",0===b)"none"===u?(a=((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=((256*n[d+5+e*E+P]*256*256+256*n[d+6+e*E+P]*256+256*n[d+7+e*E+P]+n[d+8+e*E+P])/s).toString()):"int"===u?(a=r((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=r((256*n[d+5+e*E+P]*256*256+256*n[d+6+e*E+P]*256+256*n[d+7+e*E+P]+n[d+8+e*E+P])/s).toString()):"float"===u&&(a=o((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=o((256*n[d+5+e*E+P]*256*256+256*n[d+6+e*E+P]*256+256*n[d+7+e*E+P]+n[d+8+e*E+P])/s).toString()),v=c(n[d+9+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+10+e*E+P]+n[d+11+e*E+P]),h=parseInt(h,2),S=c(256*n[d+12+e*E+P]+n[d+13+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v;else{let t=n[d+e*E+1],_=i[f][g][t].name;"none"===u?(a=((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString(),p=((256*n[d+6+e*E+P]*256*256+256*n[d+7+e*E+P]*256+256*n[d+8+e*E+P]+n[d+9+e*E+P])/s).toString()):"int"===u?(a=r((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString(),p=r((256*n[d+6+e*E+P]*256*256+256*n[d+7+e*E+P]*256+256*n[d+8+e*E+P]+n[d+9+e*E+P])/s).toString()):"float"===u&&(a=o((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString(),p=o((256*n[d+6+e*E+P]*256*256+256*n[d+7+e*E+P]*256+256*n[d+8+e*E+P]+n[d+9+e*E+P])/s).toString()),v=c(n[d+10+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+11+e*E+P]+n[d+12+e*E+P]),h=parseInt(h,2),S=c(256*n[d+13+e*E+P]+n[d+14+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S+", field: "+_):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v+", field: "+_}console.log(l),t.push(l)}if("0"===_[3]&&"1"===_[4]){e-=3;let a="",l="";if(0===b)"none"===u?a=((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString():"int"===u?a=r((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString():"float"===u&&(a=o((256*n[d+1+e*E+P]*256*256+256*n[d+2+e*E+P]*256+256*n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a;else{let t=n[d+e*E+1],_=i[f][g][t].name;"none"===u?a=((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString():"int"===u?a=r((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString():"float"===u&&(a=o((256*n[d+2+e*E+P]*256*256+256*n[d+3+e*E+P]*256+256*n[d+4+e*E+P]+n[d+5+e*E+P])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a+", field: "+_}t.push(l)}if(E+=1,v=0,S=0,h=0,z=n[d+e*E+P],void 0===z){l.zclheader.alarmmsg=t,a=1;break}}}(n,l,d,s,_,u,f,b,v,h,e,t):1===S?function(e,t,a,n,l,d,s,_,u,m,f,g){let E=0,P=0,v=0,h=0,S=0,b=0;1===m&&(e+=1,b=1),void 0===u&&(u="single"===_?"float":"int8"===_||"int16"===_||"int32"===_?"int":"none");let z=n[d+e*E];for(void 0===z&&(l.zclheader.alarmmsg=t,a=1);0===a;){if(1===m){let t=n[d+e*E+1+P];s=i[f][g][t].divider,u=i[f][g][t].function_type}let _=c(z),A=4*p(_[5])+2*p(_[6])+p(_[7]);if("1"===_[3]&&"0"===_[4]){let a="",l="",p="",m="";if(m="1"===_[1]?"exceed":"fall",0===b)"none"===u?(a=(n[d+1+e*E+P]/s).toString(),p=(n[d+2+e*E+P]/s).toString()):"int"===u?(a=r(n[d+1+e*E+P]/s).toString(),p=r(n[d+2+e*E+P]/s).toString()):"float"===u&&(a=o(n[d+1+e*E+P]/s).toString(),p=o(n[d+2+e*E+P]/s).toString()),v=c(n[d+3+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+4+e*E+P]+n[d+5+e*E+P]),h=parseInt(h,2),S=c(256*n[d+6+e*E+P]+n[d+7+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v;else{let t=n[d+e*E+1+P],_=i[f][g][t].name;"none"===u?(a=(n[d+2+e*E+P]/s).toString(),p=(n[d+3+e*E+P]/s).toString()):"int"===u?(a=r(n[d+2+e*E+P]/s).toString(),p=r(n[d+3+e*E+P]/s).toString()):"float"===u&&(a=o(n[d+2+e*E+P]/s).toString(),p=o(n[d+3+e*E+P]/s).toString()),v=c(n[d+4+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+5+e*E+P]+n[d+6+e*E+P]),h=parseInt(h,2),S=c(256*n[d+7+e*E+P]+n[d+8+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S+", field: "+_):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v+", field: "+_}t.push(l)}if("0"===_[3]&&"1"===_[4]){e-=3;let a="",l="";if(0===b)"none"===u?a=(n[d+1+e*E+P]/s).toString():"int"===u?a=r(n[d+1+e*E+P]/s).toString():"float"===u&&(a=o(n[d+1+e*E+P]/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a;else{let t=n[d+e*E+1+P],_=i[f][g][t].name;"none"===u?a=(n[d+2+e*E+P]/s).toString():"int"===u?a=r(n[d+2+e*E+P]/s).toString():"float"===u&&(a=o(n[d+2+e*E+P]/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a+", field: "+_}t.push(l)}if(E+=1,v=0,S=0,h=0,z=n[d+e*E+P],void 0===z){l.zclheader.alarmmsg=t,a=1;break}}}(n,l,d,s,_,u,f,b,v,h,e,t):3===S&&function(e,t,a,n,l,d,s,_,u,m,f,g){let E=0,P=0,v=0,h=0,S=0,b=0;1===m&&(e+=1,b=1),void 0===u&&(u="single"===_?"float":"int8"===_||"int16"===_||"int32"===_?"int":"none");let z=n[d+e*E];for(void 0===z&&(l.zclheader.alarmmsg=t,a=1);0===a;){if(1===m){let t=n[d+e*E+1+P];s=i[f][g][t].divider,u=i[f][g][t].function_type}let _=c(z),A=4*p(_[5])+2*p(_[6])+p(_[7]);if("1"===_[3]&&"0"===_[4]){let a="",l="",p="",m="";if(m="1"===_[1]?"exceed":"fall",0===b)"none"===u?(a=((256*n[d+1+e*E+P]+n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString(),p=((256*n[d+4+e*E+P]+n[d+5+e*E+P]+n[d+6+e*E+P])/s).toString()):"int"===u?(a=r((256*n[d+1+e*E+P]+n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString(),p=r((256*n[d+4+e*E+P]+n[d+5+e*E+P]+n[d+6+e*E+P])/s).toString()):"float"===u&&(a=o((256*n[d+1+e*E+P]+n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString(),p=o((256*n[d+4+e*E+P]+n[d+5+e*E+P]+n[d+6+e*E+P])/s).toString()),v=c(n[d+7+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+8+e*E+P]+n[d+9+e*E+P]),h=parseInt(h,2),S=c(256*n[d+10+e*E+P]+n[d+11+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v;else{let t=n[d+e*E+1+P],_=i[f][g][t].name;"none"===u?(a=((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=((256*n[d+5+e*E+P]+n[d+6+e*E+P]+n[d+7+e*E+P])/s).toString()):"int"===u?(a=r((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=r((256*n[d+5+e*E+P]+n[d+6+e*E+P]+n[d+7+e*E+P])/s).toString()):"float"===u&&(a=o((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString(),p=o((256*n[d+5+e*E+P]+n[d+6+e*E+P]+n[d+7+e*E+P])/s).toString()),v=c(n[d+8+e*E+P]),v=parseInt(v,2),v>=128?(h=c(256*n[d+9+e*E+P]+n[d+10+e*E+P]),h=parseInt(h,2),S=c(256*n[d+11+e*E+P]+n[d+12+e*E+P]),S=parseInt(S,2),P+=4,l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences_up: "+h+", occurences_down: "+S+", field: "+_):l="alarm, criterion_index: "+A+", mode: threshold, crossing: "+m+", value: "+a+", gap: "+p+", occurences: "+v+", field: "+_}t.push(l)}if("0"===_[3]&&"1"===_[4]){e-=3;let a="",l="";if(0===b)"none"===u?a=((256*n[d+1+e*E+P]*256+256*n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString():"int"===u?a=r((256*n[d+1+e*E+P]+n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString():"float"===u&&(a=o((256*n[d+1+e*E+P]+n[d+2+e*E+P]+n[d+3+e*E+P])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a;else{let t=n[d+e*E+1],_=i[f][g][t].name;"none"===u?a=((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString():"int"===u?a=r((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString():"float"===u&&(a=o((256*n[d+2+e*E+P]+n[d+3+e*E+P]+n[d+4+e*E+P])/s).toString()),l="alarm, criterion_index: "+A+", mode: delta, value: "+a+", field: "+_}t.push(l)}if(E+=1,v=0,S=0,h=0,z=n[d+e*E+P],void 0===z){l.zclheader.alarmmsg=t,a=1;break}}}(n,l,d,s,_,u,f,b,v,h,e,t)}function E(e){let t="";for(let a=0;a>5|(6&t[0])<<2,p=t[1],i.zclheader.cmdID=_(p,2),v=256*t[2]+t[3],i.zclheader.clustID=_(v,4),10===p|138===p|1===p){i.data={},a=256*t[4]+t[5],i.zclheader.attID=_(a,4);let S=t[4],z=0;if(10!==p&&138!==p||(z=7),138===p&&(i.zclheader.alarm=1),1===p&&(z=8,i.zclheader.status=t[6]),83!==v&&84!==v&&85!==v&&86!==v&&87!==v||(i.data=function(t,a,i){const r=["!?!","*",""," ACTIF","ACTIF","CONSO","CONTROLE","DEP","INACTIF","PROD","TEST","kVA","kW"],o=["!?!","*",""," ? ","000","HC","HCD","HCE","HCH","HH","HH ","HP","HP ","HPD","HPE","HPH","JA","JA ","P","P ","PM","PM ","XXX"],_=["!?!","*","","BT 4 SUP36","BT 5 SUP36","HTA 5 ","HTA 8 ","TJ EJP ","TJ EJP-HH ","TJ EJP-PM ","TJ EJP-SD ","TJ LU ","TJ LU-CH ","TJ LU-P ","TJ LU-PH ","TJ LU-SD ","TJ MU ","TV A5 BASE","TV A8 BASE","BASE","H PLEINE-CREUSE","HPHC","HC","HC et Week-End","EJP","PRODUCTEUR"],c=["!?!","*",""," ? ","000","HC","HCD","HCE","HCH","HH","HH ","HP","HP ","HPD","HPE","HPH","JA","JA ","P","P ","PM","PM ","XXX","INDEX NON CONSO","BASE","HEURE CREUSE","HEURE PLEINE","HEURE NORMALE","HEURE POINTE","HC BLEU","BUHC","HP BLEU","BUHP","HC BLANC","BCHC","HP BLANC","BCHP","HC ROUGE","RHC","HP ROUGE","RHP","HEURE WEEK-END"],p=["!?!","*","","BT 4 SUP36","BT 5 SUP36","HTA 5 ","HTA 8 ","TJ EJP ","TJ EJP-HH ","TJ EJP-PM ","TJ EJP-SD ","TJ LU ","TJ LU-CH ","TJ LU-P ","TJ LU-PH ","TJ LU-SD ","TJ MU ","TV A5 BASE","TV A8 BASE","BASE","H PLEINE-CREUSE","HPHC","HC","HC et Week-End","EJP","PRODUCTEUR"];function f(e,t,a){var i={};return 0==(128&e[t])?(iEnum=127&e[t],iEnum++,i=a[iEnum],t+=1):(sz=127&e[t],t+=1,sz>0?(i=String.fromCharCode.apply(null,e.slice(t,t+sz)),t+=sz):i=""),{x:i,i:t}}function g(e,t){return{x:ze=u(l(e,t,"U8"),2)+"/"+u(l(e,t+1,"U8"),2)+"/"+u(l(e,t+2,"U8"),2)+" "+u(l(e,t+3,"U8"),2)+":"+u(l(e,t+4,"U8"),2)+":"+u(l(e,t+5,"U8"),2),i:t+=6}}function P(e,t,a){ts=l(e,t,"U32",a),t+=4,ts+=new Date("2000/01/01 00:00:00").getTime()/1e3,ts+=3600;var i=new Date(1e3*ts);return{x:u(i.getDate(),2)+"/"+u(i.getMonth(),2)+"/"+i.getFullYear()+" "+u(i.getHours(),2)+":"+u(i.getMinutes(),2)+":"+u(i.getSeconds(),2),i:t}}function v(e,t,a){return{x:ze=String.fromCharCode.apply(null,e.slice(t,t+a)),i:t+=a}}function S(e,t){return{b:e,i:t}}function z(e,t){return function(e,t){return eos=e.slice(t).indexOf(0),ze=String.fromCharCode.apply(null,e.slice(t,t+eos)),t+=eos+1,{x:ze,i:t}}(e,t)}function A(e,t){return{x:ze=l(e,t,"U8"),i:t+=1}}function H(e,t){return{x:ze=l(e,t,"U16"),i:t+=2}}function C(e,t){return{x:ze=l(e,t,"I16"),i:t+=2}}function I(e,t){return{x:ze=l(e,t,"U24"),i:t+=3}}function T(e,t){var a={};for(t=1;t<=4;t++)a["Value_"+t]=l(e,t,"U24"),t+=3;return{x:a,i:t}}function N(e,t){return{x:ze=l(e,t,"U32"),i:t+=4}}function R(e,t){return{x:ze=BytesToFloat32(e,t),i:t+=4}}function U(e,t){return g(e,t)}function x(e,t){return P(e,t)}function w(e,t){return f(e,t,o)}function F(e,t){return{x:{},i:t=f(e,P(e,t).i,o).i}}function O(e,t){return D=u(l(e,t,"U8"),2),t++,M=u(l(e,t,"U8"),2),t++,h=u(l(e,t,"U8"),2),t++,{x:D+"/"+M+" "+h,i:t}}function J(e,t){var a={};return s=v(e,t,1),d=g(e,s.i),n=l(e,t,"U8"),t=d.i+1,a.S=s.x,a.Date=d.x,a.Value=n,{x:a,i:t}}function B(e,t){var a={};return s=v(e,t,1),d=g(e,s.i),n=l(e,t,"U16"),t=d.i+1,a.S=s.x,a.Date=d.x,a.Value=n,{x:a,i:t}}function V(e,t){var a={};return s=v(e,t,1),d=g(e,s.i),n=l(e,t,"U24"),t=d.i+1,a.S=s.x,a.Date=d.x,a.Value=n,{x:a,i:t}}function X(e,t){return f(e,t,r)}function G(t,a){var i={};return dd=l(t,a,"U24"),a+=3,i.Value=dd,e=f(t,a,r),i.Label=e.x,{x:i,i:a=e.i}}function q(e,t){return f(e,t,_)}function k(e,t){for(var a=[],i=0;i<11;i++)y={},h=u(l(e,t,"U8"),2),t++,255==h?y.Status="NONUTILE":(m=u(l(e,t,"U8"),2),t++,s=E(e.slice(t,2)),t++,y.Time=h+":"+m,y.Status=s,t+=e[t]+1),a.push(y);return{x:a,i:t}}function L(e){return e}function Y(e){return e}function j(e){return e}function W(e){return e}function Z(e){return e}function Q(e){return e}function K(e){return e}function $(e){return e}function ee(e){return e}function te(e){return e}function ae(e){return e}function ie(e){return e}function re(e){return e}function ne(e){return e}function oe(e){return e}function le(e){return e}function de(e){return e}function se(e){return e}function _e(e){return e}function ue(e){return e}function ce(e){return e}const pe=[["CONTRAT",z,0,Y],["DATECOUR",U,0,L],["DATE",U,0,L],["EA",I,0,function(e){return e}],["ERP",I,0,function(e){return e}],["PTCOUR",z,0,Y],["PREAVIS",z,0,Y],["MODE",S,0,Y],["DATEPA1",U,0,L],["PA1",H,0,ie],["DATEPA2",U,0,L],["PA2",H,0,ie],["DATEPA3",U,0,L],["PA3",H,0,ie],["DATEPA4",U,0,L],["PA4",H,0,ie],["DATEPA5",U,0,L],["PA5",H,0,ie],["DATEPA6",U,0,L],["PA6",H,0,ie],["*p*",I,0,K],["KDC",A,0,ae],["KDCD",A,0,ae],["TGPHI",R,0,ce],["PSP",H,0,ie],["PSPM",H,0,ie],["PSHPH",H,0,ie],["PSHPD",H,0,ie],["PSHCH",H,0,ie],["PSHCD",H,0,ie],["PSHPE",H,0,ie],["PSHCE",H,0,ie],["PSJA",H,0,ie],["PSHH",H,0,ie],["PSHD",H,0,ie],["PSHM",H,0,ie],["PSDSM",H,0,ie],["PSSCM",H,0,ie],["MODE",S,0,Y],["PA1MN",H,0,ie],["PA10MN",H,0,ie],["PREA1MN",C,0,re],["PREA10MN",C,0,re],["TGPHI",R,0,ce],["U10MN",H,0,function(e){return e}]],me=[["DEBUTp",U,0,L,0],["FINp",U,0,L,6],["CAFp",H,0,Q,12],["DATEEAp",U,0,L,14],["EApP",I,0,se,20],["EApPM",I,0,se,23],["EApHCE",I,0,se,26],["EApHCH",I,0,se,29],["EApHH",I,0,se,32],["EApHCD",I,0,se,35],["EApHD",I,0,se,38],["EApJA",I,0,se,41],["EApHPE",I,0,se,44],["EApHPH",I,0,se,47],["EApHPD",I,0,se,50],["EApSCM",I,0,se,53],["EApHM",I,0,se,56],["EApDSM",I,0,se,59],["DATEERPp",U,0,L,62],["ERPpP",I,0,ue,68],["ERPpPM",I,0,ue,71],["ERPpHCE",I,0,ue,74],["ERPpHCH",I,0,ue,77],["ERPpHH",I,0,ue,80],["ERPpHCD",I,0,ue,83],["ERPpHD",I,0,ue,86],["ERPpJA",I,0,ue,89],["ERPpHPE",I,0,ue,92],["ERPpHPH",I,0,ue,95],["ERPpHPD",I,0,ue,98],["ERPpSCM",I,0,ue,101],["ERPpHM",I,0,ue,104],["ERPpDSM",I,0,ue,107],["DATEERNp",U,0,L,110],["ERNpP",I,0,ue,116],["ERNpPM",I,0,ue,119],["ERNpHCE",I,0,ue,122],["ERNpHCH",I,0,ue,125],["ERNpHH",I,0,ue,128],["ERNpHCD",I,0,ue,131],["ERNpHD",I,0,ue,134],["ERNpJA",I,0,ue,137],["ERNpHPE",I,0,ue,140],["ERNpHPH",I,0,ue,143],["ERNpHPD",I,0,ue,146],["ERNpSCM",I,0,ue,149],["ERNpHM",I,0,ue,152],["ERNpDSM",I,0,ue,155]],fe=[["DEBUTp1",U,0,L,0],["FINp1",U,0,L,6],["CAFp1",H,0,Q,12],["DATEEAp1",U,0,L,14],["EAp1P",I,0,se,20],["EAp1PM",I,0,se,23],["EAp1HCE",I,0,se,26],["EAp1HCH",I,0,se,29],["EAp1HH",I,0,se,32],["EAp1HCD",I,0,se,35],["EAp1HD",I,0,se,38],["EAp1JA",I,0,se,41],["EAp1HPE",I,0,se,44],["EAp1HPH",I,0,se,47],["EAp1HPD",I,0,se,50],["EAp1SCM",I,0,se,53],["EAp1HM",I,0,se,56],["EAp1DSM",I,0,se,59],["DATEERPp1",U,0,L,62],["ERPp1P",I,0,ue,68],["ERPp1PM",I,0,ue,71],["ERPp1HCE",I,0,ue,74],["ERPp1HCH",I,0,ue,77],["ERPp1HH",I,0,ue,80],["ERPp1HCD",I,0,ue,83],["ERPp1HD",I,0,ue,86],["ERPp1JA",I,0,ue,89],["ERPp1HPE",I,0,ue,92],["ERPp1HPH",I,0,ue,95],["ERPp1HPD",I,0,ue,98],["ERPp1SCM",I,0,ue,101],["ERPp1HM",I,0,ue,104],["ERPp1DSM",I,0,ue,107],["DATEERNp1",U,0,L,110],["ERNp1P",I,0,ue,116],["ERNp1PM",I,0,ue,119],["ERNp1HCE",I,0,ue,122],["ERNp1HCH",I,0,ue,125],["ERNp1HH",I,0,ue,128],["ERNp1HCD",I,0,ue,131],["ERNp1HD",I,0,ue,134],["ERNp1JA",I,0,ue,137],["ERNp1HPE",I,0,ue,140],["ERNp1HPH",I,0,ue,143],["ERNp1HPD",I,0,ue,146],["ERNp1SCM",I,0,ue,149],["ERNp1HM",I,0,ue,152],["ERNp1DSM",I,0,ue,155]],ge=[["ADIR1",H,0,Z],["ADIR2",H,0,Z],["ADIR3",H,0,Z],["ADCO",z,0,Y],["OPTARIF",z,0,Y],["ISOUSC",A,0,W],["BASE",N,0,te],["HCHC",N,0,te],["HCHP",N,0,te],["EJPHN",N,0,te],["EJPHPM",N,0,te],["BBRHCJB",N,0,te],["BBRHPJB",N,0,te],["BBRHCJW",N,0,te],["BBRHPJW",N,0,te],["BBRHCJR",N,0,te],["BBRHPJR",N,0,te],["PEJP",A,0,W],["GAZ",N,0,ee],["AUTRE",N,0,ee],["PTEC",z,0,Y],["DEMAIN",z,0,Y],["IINST",H,0,Z],["IINST1",H,0,Z],["IINST2",H,0,Z],["IINST3",H,0,Z],["ADPS",H,0,Z],["IMAX",H,0,Z],["IMAX1",H,0,Z],["IMAX2",H,0,Z],["IMAX3",H,0,Z],["PMAX",N,0,K],["PAPP",N,0,K],["HHPHC",function(e,t){return{x:ze=String.fromCharCode.apply(null,e.slice(0,1)),i:t+=1}},0,function(e){return e}],["MOTDETAT",z,0,Y],["PPOT",A,0,function(e){return e}]],Ee=[["JAUNE",function(e,t){return h=u(l(e,t,"U8"),2),t++,m=u(l(e,t,"U8"),2),t++,D=u(l(e,t,"U8"),2),t++,M=u(l(e,t,"U8"),2),t++,{x:D+"/"+M+" "+h+":"+m,i:t}},0,L],["JAUNE",z,0,Y],["JAUNE",z,0,Y],["JAUNE",I,0,K],["JAUNE",A,0,W],["ENERG",function(e,t){var a={};for(t=1;t<=4;t++)a["Value_"+t]=l(e,t,"U24"),t+=3;return{x:a,i:t}},0,$],["ENERG",I,0,$],["ENERG",I,0,$],["ENERG",I,0,$],["ENERG",I,0,$],["ENERG",I,0,$],["PERCC",O,0,L],["PERCC",A,0,W],["PMAXC",T,0,K],["PMAXC",I,0,K],["PMAXC",I,0,K],["PMAXC",I,0,K],["TDEPA",T,0,K],["TDEPA",I,0,K],["TDEPA",I,0,K],["TDEPA",I,0,K],["PERCP",O,0,L],["PERCP",A,0,W],["PMAXP",T,0,K],["PMAXP",I,0,K],["PMAXP",I,0,K],["PMAXP",I,0,K],["PSOUSC",T,0,K],["PSOUSC",I,0,K],["PSOUSC",I,0,K],["PSOUSC",I,0,K],["PSOUSP",T,0,K],["PSOUSP",I,0,K],["PSOUSP",I,0,K],["PSOUSP",I,0,K],["FCOU",function(e,t){return h=u(l(e,t,"U8"),2),t++,m=u(l(e,t,"U8"),2),t++,{x:h+":"+m,i:t}},0,L],["FCOU",A,0,W]],Pe=[["ADSC",z,0,Y],["VTIC",A,0,W],["DATE",function(e,t){var a={};return s=v(e,t,1),d=g(e,s.i),a.S=s.x,a.Date=d.x,{x:a,i:t=d.i}},0,L],["NGTF",function(e,t){return f(e,t,p)},0,Y],["LTARF",function(e,t){return f(e,t,c)},0,Y],["EAST",N,0,te],["EASF01",N,0,te],["EASF02",N,0,te],["EASF03",N,0,te],["EASF04",N,0,te],["EASF05",N,0,te],["EASF06",N,0,te],["EASF07",N,0,te],["EASF08",N,0,te],["EASF09",N,0,te],["EASF10",N,0,te],["EASD01",N,0,te],["EASD02",N,0,te],["EASD03",N,0,te],["EASD04",N,0,te],["EAIT",N,0,te],["ERQ1",N,0,te],["ERQ2",N,0,te],["ERQ3",N,0,te],["ERQ4",N,0,te],["IRMS1",H,0,Z],["IRMS2",H,0,Z],["IRMS3",H,0,Z],["URMS1",H,0,Z],["URMS2",H,0,Z],["URMS3",H,0,Z],["PREF",A,0,W],["PCOUP",A,0,W],["SINSTS",I,0,K],["SINSTS1",I,0,K],["SINSTS2",I,0,K],["SINSTS3",I,0,K],["SMAXSN",V,0,K],["SMAXSN1",V,0,K],["SMAXSN2",V,0,K],["SMAXSN3",V,0,K],["SMAXSN?1",V,0,K],["SMAXSN1?1",V,0,K],["SMAXSN2?1",V,0,K],["SMAXSN3?1",V,0,K],["SINSTI",I,0,K],["SMAXIN",V,0,K],["SMAXIN-1",V,0,K],["CCASN",V,0,K],["CCASN?1",V,0,K],["CCAIN",V,0,K],["CCAIN?1",V,0,K],["UMOY1",B,0,Z],["UMOY2",B,0,Z],["UMOY3",B,0,Z],["STGE",function(e,t){var a=E(e.slice(t,2));return t+=4,{x:a,i:t+=4}},0,L],["DPM1",J,0,W],["FPM1",J,0,W],["DPM2",J,0,W],["FPM2",J,0,W],["DPM3",J,0,W],["FPM3",J,0,W],["MSG1",z,0,Y],["MSG2",z,0,Y],["PRM",z,0,Y],["RELAIS",function(e,t){return ze=l(e,t,"U8"),t++,{x:ze,i:t}},0,Z],["NTARF",A,0,W],["NJOURF",A,0,W],["NJOURF+1",A,0,W],["PJOURF+1",k,0,L],["PPOINTE",k,0,L]],ve=[["TRAME",X,0,Y],["ADS",function(e,t){var a=E(e.slice(t+1,t+1+e[t]));return t+=e[t]+1,d={x:a,i:t},{x:a,i:t}},0,L],["MESURES1",q,0,Y],["DATE",U,0,L],["EA_s",I,0,ne],["ER+_s",I,0,oe],["ER-_s",I,0,oe],["EAPP_s",I,0,le],["EA_i",I,0,ne],["ER+_i",I,0,oe],["ER-_i",I,0,oe],["EAPP_i",I,0,le],["PTCOUR1",w,0,Y],["TARIFDYN",X,0,Y],["ETATDYN1",w,0,Y],["PREAVIS1",w,0,j],["TDYN1CD",F,0,L],["TDYN1CF",F,0,L],["TDYN1FD",F,0,L],["TDYN1FF",F,0,L],["MODE",X,0,Y],["CONFIG",X,0,Y],["DATEPA1",U,0,L],["PA1_s",H,0,ie],["PA1_i",H,0,ie],["DATEPA2",x,0,L],["PA2_s",H,0,ie],["PA2_i",H,0,ie],["DATEPA3",x,0,L],["PA3_s",H,0,ie],["PA3_i",H,0,ie],["DATEPA4",x,0,L],["PA4_s",H,0,ie],["PA4_i",H,0,ie],["DATEPA5",x,0,L],["PA5_s",H,0,ie],["PA5_i",H,0,ie],["DATEPA6",x,0,L],["PA6_s",H,0,ie],["PA6_i",H,0,ie],["DebP",x,0,L],["EAP_s",I,0,de],["EAP_i",I,0,de],["ER+P_s",I,0,_e],["ER-P_s",I,0,_e],["ER+P_i",I,0,_e],["ER-P_i",I,0,_e],["DebP-1",x,0,L],["FinP-1",x,0,L],["EaP-1_s",I,0,de],["EaP-1_i",I,0,de],["ER+P-1_s",I,0,_e],["ER-P-1_s",I,0,_e],["ER+P-1_i",I,0,_e],["ER-P-1_i",I,0,_e],["PS",G,0,L],["PREAVIS",X,0,Y],["PA1MN",H,0,ie],["PMAX_s",G,0,L],["PMAX_i",G,0,L],["TGPHI_s",R,0,ce],["TGPHI_i",R,0,ce],["MESURES2",q,0,Y],["PTCOUR2",w,0,Y],["ETATDYN2",w,0,Y],["PREAVIS2",w,0,j],["TDYN2CD",F,0,L],["TDYN2CF",F,0,L],["TDYN2FD",F,0,L],["TDYN2FF",F,0,L],["DebP_2",x,0,L],["EaP_s2",I,0,de],["DebP-1_2",x,0,L],["FinP-1_2",x,0,L],["EaP-1_s2",I,0,de],["_DDMES1_",I,0,function(e){return e}]];if(data=[],83==t)if(!1&attributeID)profil=pe,data._TICFrameType="ICE Generale";else if(!1&attributeID)profil=me,data._TICFrameType="ICE Periode P";else{if(!(!1&attributeID))return data;profil=fe,data._TICFrameType="ICE Periode P moins 1"}else if(84==t)profil=ge,data._TICFrameType="CBE/Historique";else if(85==t)profil=Ee,data._TICFrameType="CJE";else if(86==t)profil=Pe,data._TICFrameType="Standard";else{if(87!=t)return data;profil=ve,data._TICFrameType="PMEPMI"}let{DescSize:he,Indexes:Se}=function(e){var t=[],a=e[0],i=31&a;if(0==i&&(i=8),IsVarIndexes=0!=(32&a),IsVarIndexes)for(r=1;r1;r--)for(b=0;b<8;b++)e[r-1]>>b&1&&t.push(iField),iField++}return{DescSize:i,Indexes:t}}(i);var be=i.slice(0,he),ze={};128==(128&be[0])&&(ze.Obsolete=!0),ze.Bytes=E(be),ze.Indexes=Se,data._Descriptor=ze;for(var Ae=he,ye=0;ye>5,i.data.modbus_last_frame_of_serie=(28&e)>>2,i.data.modbus_EP9=1==(1&e),i.data.modbus_EP8=2==(2&e),i.data.modbus_EP7=128==(128&a),i.data.modbus_EP6=64==(64&a),i.data.modbus_EP5=32==(32&a),i.data.modbus_EP4=16==(16&a),i.data.modbus_EP3=8==(8&a),i.data.modbus_EP2=4==(4&a),i.data.modbus_EP1=2==(2&a),i.data.modbus_EP0=1==(1&a);let r=z+4;if(without_header=0,!0===i.data.modbus_EP0){if(0===without_header&&(i.data.modbus_slaveID_EP0=t[r],i.data.modbus_fnctID_EP0=t[r+1],i.data.modbus_datasize_EP0=t[r+2],r+=3),i.data.modbus_payload_EP0="",void 0===t[r])return i;for(let e=0;e0;)i.zclheader.modepower=t[14+5*a],console.log(t[14+5*a]),i.zclheader.powersource=t[15+5*a],i.zclheader.delta=256*t[16+5*a]+t[17+5*a],i.zclheader.changedpowersource=t[18+5*a],a++,e--}}}else i.batch={},i.batch.report="batch";return i}t.exports={normalisation_standard:function(e,t){let a=[""],i=e.bytes,r=!0,n=0;console.log(e);let o=P(i,e.fPort);if(console.log(o),void 0!==o.zclheader){if(void 0!==o.zclheader.alarmmsg&&(a=o.zclheader.alarmmsg,console.log(a)),7===i[1]&&i[0]%2!=0)return{data:o.zclheader,warning:a};if(9===i[1])return{data:o.zclheader,warning:a};if(1===i[1]){if(void 0===o.zclheader.data){let t=[];for(;r;){let a=Object.keys(o.data)[n];if(void 0===a){r=!1;break}t.push({variable:a,value:o.data[a],date:e.recvTime}),n++}return{data:t,type:"standard",warning:a}}return{data:{variable:"read reporting configuration response status",value:o.zclheader.data,date:e.recvTime},warning:a}}}if(void 0!==o.zclheader){if(console.log("je rentre dans le zclheader"),void 0!==t){let i=o.zclheader.endpoint,r=!0,n=0,l=[],d="";for(;r;){console.log("bekbncnien");let a=Object.keys(o.data)[n];if(console.log(a),void 0===a){r=!1;break}console.log("poucevert"),console.log(t[a]),void 0===t[a]?(console.log("pas de type"),l.push({variable:a,value:o.data[a],date:e.recvTime})):(d=t[a][i],"NA"===d?l.push({variable:d,value:"NA",date:e.recvTime}):l.push({variable:d,value:o.data[a],date:e.recvTime})),n++}return{data:l,type:"standard",warning:a}}{let t=!0,i=0,r=[];for(;t;){let a=Object.keys(o.data)[i];if(void 0===a){t=!1;break}r.push({variable:a,value:o.data[a],date:e.recvTime}),i++}return{data:r,type:"standard",warning:a}}}return console.log("je sort en batch"),{type:o.batch.report,payload:o.lora.payload}}}}},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var n=a[e]={exports:{}};return t[e](n,n.exports,i),n.exports}var r={};(()=>{var e=r;let t=i(733),a=[2,[{taglbl:0,resol:10,sampletype:7,lblname:"temperature",divide:100},{taglbl:1,resol:100,sampletype:6,lblname:"humidity",divide:100},{taglbl:2,resol:1,sampletype:6,lblname:"battery_voltage",divide:1e3},{taglbl:3,resol:1,sampletype:1,lblname:"violation_detection",divide:1}]],n={pin_state:["violation_detection"]};e.decodeUplink=function(e){return result=t.watteco_decodeUplink(e,a,n)}})(),driver=r})(); \ No newline at end of file diff --git a/vendor/watteco/th-sensor.yaml b/vendor/watteco/th-sensor.yaml new file mode 100644 index 0000000000..d04ecb1566 --- /dev/null +++ b/vendor/watteco/th-sensor.yaml @@ -0,0 +1,145 @@ +name: TH +description: The WATTECO TH sensor measures indoor ambient temperature and humidity in buildings, apartments, and houses. It transmits data over a public or private LoRaWAN® network. + +# Hardware versions (optional, use when you have revisions) +hardwareVersions: + - version: '50-70-053' + numeric: 53 + - version: '50-70-162' + numeric: 162 + +# Firmware versions (at least one is mandatory) +firmwareVersions: + - # Firmware version + version: '3.5.2' + numeric: 352 + # Corresponding hardware versions (optional) + hardwareVersions: + - '50-70-053' + - '50-70-162' + + # # Firmware features (optional) + # # Valid values are: remote rejoin (trigger a join from the application layer), transmission interval (configure how + # # often he device sends a message). + # features: + # - remote rejoin + # - transmission interval + + # LoRaWAN Device Profiles per region + # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, + # RU864-870 + profiles: + EU863-870: + # Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from + # the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors. + # If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID, + # which is verbose. + vendorID: watteco + # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) + id: th-sensor-profile + lorawanCertified: true + codec: th-sensor-codec + +# Sensors that this device features (optional) +# Valid values are: +# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity, +# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light, +# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer, +# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, smart valve, snr, so2, +# solar radiation, sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, +# vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. +sensors: + - temperature + - humidity + +# Additional radios that this device has (optional) +# Valid values are: ble, nfc, wifi, cellular. +# additionalRadios: +# - + +# Bridge interfaces (optional) +# Valid values are: modbus, m-bus, can bus, rs-485, sdi-12, analog. +# bridgeInterfaces: none + +# Dimensions in mm (optional) +# Use width, height, length and/or diameter +dimensions: + width: 80 + length: 80 + height: 25 + +# Weight in grams (optional) +weight: 95 + +# Battery information (optional) +battery: + replaceable: true + type: AA + +# Operating conditions (optional) +operatingConditions: + # Temperature (Celsius) + temperature: + min: 0 + max: 55 + +# IP rating (optional) +ipCode: IP30 + +# Key provisioning (optional) +# Valid values are: custom (user can configure keys), join server and manifest. +keyProvisioning: + - custom + +# Key programming (optional) +# Valid values are: bluetooth, nfc, wifi, serial (when the user has a serial interface to set the keys) +# and firmware (when the user should change the firmware to set the keys). +keyProgramming: + - firmware + +# Key security (optional) +# Valid values are: none, read protected and secure element. +keySecurity: none + +# Firmware programming (optional) +# Valid values are: serial (when the user has a serial interface to update the firmware), fuota lorawan (when the device +# supports LoRaWAN FUOTA via standard interfaces) and fuota other (other wireless update mechanism). +# firmwareProgramming: none + +# Product and data sheet URLs (optional) + +productURL: https://www.watteco.com/product/indoor-temperature-humidity-sensor/ +dataSheetURL: https://www.watteco.com/download/temperature-humidity-sensor-data-sheet-lorawan/?wpdmdl=6525&refresh=60be3894e0a1f1623079060 + +# Commercial information +resellerURLs: + - name: 'Watteco' + region: + - European Union + url: https://www.watteco.fr +# msrp: +# EUR: + +# Photos +photos: + main: th-sensor.jpg + +# Youtube or Vimeo Video (optional) +# videos: +# main: + +# Regulatory compliances (optional) +compliances: + safety: + - body: IEC + norm: EN + standard: 61000-4-2 + radioEquipment: + - body: ETSI + norm: EN + standard: 300 220-1 + version: 2.4.1 + - body: ETSI + norm: EN + standard: 301 489 + version: 1.6.1