From e2ac66b564dc604358e66d2c7a1c8b7aa062383c Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Mon, 28 Nov 2022 19:42:00 -0600 Subject: [PATCH 1/2] cleanup watchout variable names --- plugins/watchout/main.js | 48 +++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/plugins/watchout/main.js b/plugins/watchout/main.js index 0f4c7dd..f80ad4a 100644 --- a/plugins/watchout/main.js +++ b/plugins/watchout/main.js @@ -15,44 +15,42 @@ exports.ready = function ready(device) { device.send('authenticate 1\n'); }; -exports.data = function data(device, message) { - const msg = message.toString(); - const d = device; +exports.data = function data(_device, _message) { + const message = message.toString(); + const device = _device; - if (msg.substring(0, 5) === 'Ready') { - d.send('getStatus\n'); + if (message.substring(0, 5) === 'Ready') { + device.send('getStatus\n'); - }else if (msg.substring(0, 5) === 'Reply') { - const arr = msg.split(' '); + }else if (message.substring(0, 5) === 'Reply') { + const arr = message.split(' '); - d.data.showName = ''; + device.data.showName = ''; + let i = 0; while (arr[i][arr[i].length - 1] !== '"') { i++; - d.data.showName += `${arr[i]} `; + device.data.showName += `${arr[i]} `; } - d.data.showName = d.data.showName.substring( + + device.data.showName = device.data.showName.substring( 1, - d.data.showName.length - 2 + device.data.showName.length - 2 ); i--; - d.data.busy = arr[i + 2]; - d.data.health = arr[i + 3]; - d.data.displayOpen = arr[i + 4]; - d.data.showActive = arr[i + 5]; - d.data.programmerOnline = arr[i + 6]; - d.data.position = Number(arr[i + 7]).toFixed(2); - d.data.rate = arr[i + 8]; - d.data.standby = arr[i + 9]; + device.data.busy = arr[i + 2]; + device.data.health = arr[i + 3]; + device.data.displayOpen = arr[i + 4]; + device.data.showActive = arr[i + 5]; + device.data.programmerOnline = arr[i + 6]; + device.data.position = Number(arr[i + 7]).toFixed(2); + device.data.rate = arr[i + 8]; + device.data.standby = arr[i + 9]; - this.deviceInfoUpdate(d, 'defaultName', d.data.showName); - d.draw(); + this.deviceInfoUpdate(device, 'defaultName', device.data.showName); + device.draw(); } - // if(msg.substring(0, 5)=="Error"){ - // device.data.error = msg.substring(6, 7); - // } - // console.log(msg) }; exports.heartbeat = function heartbeat(device) { From e9adf29897ccc17eef2f6390971d9c1b6c44ec5a Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Mon, 28 Nov 2022 20:00:44 -0600 Subject: [PATCH 2/2] cleanup watchout template --- plugins/watchout/template.ejs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/watchout/template.ejs b/plugins/watchout/template.ejs index f43207a..6cc1056 100644 --- a/plugins/watchout/template.ejs +++ b/plugins/watchout/template.ejs @@ -2,7 +2,6 @@

<%= listName %>

- - - - - +
@@ -20,13 +19,10 @@

<%= minutes %>:<%= ((seconds%60)+"").padStart(2, "0") %>.<%= millis%1000 %>

Busy
<%= data.busy %>
Display Open
<%= data.displayOpen %>