Delete src directory

This commit is contained in:
Jean-Christian Paul Denis 2024-04-27 13:24:08 +02:00 committed by GitHub
parent ddf93d0387
commit 1ca6a199d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 0 additions and 235 deletions

View file

@ -1,7 +0,0 @@
var d = Number(msg.payload);
var h = Math.floor(d / 60);
var m = Math.floor(d % 60);
if (h < 10) { h = h < 5 ? '00' : '0' + h; }
if (m < 10) { m = m < 5 ? '00' : '0' + m; }
msg.payload = h + ':' + m;
return msg;

View file

@ -1,42 +0,0 @@
// Check and recreate clean message of device description
// output 1 : error message
// output 2 : device registration
// script var
var msg = msg;
var newmsg = {};
// no message
if (typeof msg === 'undefined'){
return [null,null];
}
// check possible var existence
if (typeof msg.bucket === 'undefined' ||
typeof msg.measurement === 'undefined' ||
typeof msg.field === 'undefined' ||
typeof msg.format === 'undefined' ||
typeof msg.default === 'undefined'
) {
node.status({
fill: "red", shape: "ring", text: 'undefined device'});
return [msg,null];
}
// recreate msg
newmsg = {
'bucket': msg.bucket,
'measurement': msg.measurement,
'field': msg.field,
'format': msg.format,
'path': msg.bucket + '/' + msg.measurement + '/' + msg.field,
'payload': msg.default,
'protocol': typeof msg.protocol === 'undefined' ? '' : msg.protocol,
'model': typeof msg.model === 'undefined' ? '' : msg.model,
'id': typeof msg.id === 'undefined' ? '' : msg.id,
'option': typeof msg.option === 'undefined' ? 0 : msg.option
};
node.status({ fill: 'green', shape: "ring", text: newmsg.path + ' = ' + newmsg.payload });
return [null,newmsg];

View file

@ -1,34 +0,0 @@
// output 1 : error message
// output 2 : device registration
// script var
var msg = msg;
var newmsg = {};
if (typeof msg === 'undefined'){
return [null,null];
}
// check var existence
if (typeof msg.bucket === 'undefined' ||
typeof msg.model === 'undefined' ||
typeof msg.id === 'undefined'
) {
node.status({
fill: "red", shape: "ring", text: 'undefined device'});
return [msg,null];
}
// recreate msg
newmsg = {
'bucket': msg.bucket,
'measurement': typeof msg.measurement === 'undefined' ? '' : msg.measurement,
'field': typeof msg.field === 'undefined' ? '' : msg.field,
'model': msg.model,
'option': typeof msg.option === 'undefined' ? 0 : msg.option,
'id': msg.id,
'payload':''
};
node.status({ fill: 'green', shape: "ring", text: newmsg.model + ' / ' + newmsg.id });
return [null,newmsg];

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1,50 +0,0 @@
// output 1 : error message
// output 2 : device registration
// script var
var msg = msg;
var newmsg = {};
// try if msg.topic is a path
if (typeof msg.topic === 'string' &&
typeof msg.bucket === 'undefined' &&
typeof msg.measurement === 'undefined' &&
typeof msg.field === 'undefined'
) {
const device = msg.topic.split('/');
if (typeof device[1] === 'string' &&
typeof device[2] === 'string' &&
typeof device[3] === 'string'
) {
msg.source = device[0];
msg.bucket = device[1];
msg.measurement = device[2];
msg.field = device[3];
}
}
// check var existence
if (typeof msg.bucket === 'undefined' ||
typeof msg.measurement === 'undefined' ||
typeof msg.field === 'undefined'
) {
node.status({
fill: "red", shape: "ring", text: 'undefined device'});
return [msg,null];
}
// recreate msg
newmsg = {
'topic': 'metric',
'source': typeof msg.source === 'string' ? msg.source : 'unknow',
'bucket': msg.bucket,
'measurement': msg.measurement,
'field': msg.field,
'path': msg.bucket + '/' + msg.measurement + '/' + msg.field,
'payload': msg.payload,
'repeat': typeof msg.repeat === 'boolean' ? msg.repeat : false
};
node.status({ fill: 'green', shape: "ring", text: newmsg.source + ' : ' + newmsg.path + ' = ' + newmsg.payload });
return [null,newmsg];

View file

@ -1,11 +0,0 @@
// script var
var msg = msg;
var newmsg = {};
// recreate msg
newmsg = {
'topic':'gate',
'payload':'open'
};
return newmsg;

View file

@ -1,11 +0,0 @@
// script var
var msg = msg;
var newmsg = {};
// recreate msg
newmsg = {
'topic':'gate',
'payload': msg.payload
};
return newmsg;

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1,72 +0,0 @@
[
{
"id": "fabb645e0d88c91c",
"property": "func",
"file": "Kernel/check_device.js"
},
{
"id": "fabb645e0d88c91c",
"property": "initialize",
"file": "Kernel/check_device_initializejs"
},
{
"id": "fabb645e0d88c91c",
"property": "finalize",
"file": "Kernel/check_device_finalizejs"
},
{
"id": "2ba23548e87b0292",
"property": "func",
"file": "Kernel/set_gate_message.js"
},
{
"id": "2ba23548e87b0292",
"property": "initialize",
"file": "Kernel/set_gate_message_initializejs"
},
{
"id": "2ba23548e87b0292",
"property": "finalize",
"file": "Kernel/set_gate_message_finalizejs"
},
{
"id": "82229e46e51f94f5",
"property": "func",
"file": "Kernel/check_metric.js"
},
{
"id": "e6a4e861a99b196c",
"property": "func",
"file": "Kernel/set_gate_message2.js"
},
{
"id": "e6a4e861a99b196c",
"property": "initialize",
"file": "Kernel/set_gate_message2_initializejs"
},
{
"id": "e6a4e861a99b196c",
"property": "finalize",
"file": "Kernel/set_gate_message2_finalizejs"
},
{
"id": "c3d88e1872a9789b",
"property": "func",
"file": "Kernel/check_device2.js"
},
{
"id": "c3d88e1872a9789b",
"property": "initialize",
"file": "Kernel/check_device2_initializejs"
},
{
"id": "c3d88e1872a9789b",
"property": "finalize",
"file": "Kernel/check_device2_finalizejs"
},
{
"id": "0385dd3208b83d41",
"property": "func",
"file": "K_Routine/minute_to_HH_mm.js"
}
]