Added MeshCtrl device group hex encoding to JSON of listdevicegroups.

Ylian Saint-Hilaire committed Jul 24, 2020 at 10:56 UTC 6a21eedb08f59fc2a8496dfb15fd6b1e488fb11b
1 file changed +2
meshctrl.js
+2
@@ -1119,6 +1119,8 @@ function serverConnect() {
1119 for (var i in data.meshes) { settings.xmeshes[data.meshes[i]._id] = data.meshes[i]; }
1120 } else if (settings.cmd == 'listdevicegroups') {
1121 if (args.json) {
1122 + // If asked, add the MeshID hex encoding to the JSON.
1123 + if (args.hex) { for (var i in data.meshes) { data.meshes[i]._idhex = '0x' + Buffer.from(data.meshes[i]._id.split('/')[2].replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase(); } }
1124 console.log(JSON.stringify(data.meshes, ' ', 2));
1125 } else {
1126 if (args.idexists) { for (var i in data.meshes) { const u = data.meshes[i]; if ((u._id == args.idexists) || (u._id.split('/')[2] == args.idexists)) { console.log('1'); process.exit(); return; } } console.log('0'); process.exit(); return; }