diff --git a/companion/HELP.md b/companion/HELP.md index ba2c317..0da8b67 100644 --- a/companion/HELP.md +++ b/companion/HELP.md @@ -30,6 +30,9 @@ The alarms should match the number of configured alarm indexes in your system. R ## Version History +### Version 1.0.4 +- Hide redundant config fields when not required + ### Version 1.0.3 - Better status updates - Update dependencies diff --git a/package.json b/package.json index 704ba96..a7a056c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ntp-technology-dot", - "version": "1.0.3", + "version": "1.0.4", "main": "src/main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/src/config.js b/src/config.js index 792a99d..3331818 100644 --- a/src/config.js +++ b/src/config.js @@ -49,6 +49,19 @@ module.exports = { default: '', width: 8, regex: Regex.HOSTNAME, + isVisible: (options) => { + return options.redundant + }, + }, + { + type: 'static-text', + id: 'place-holder-1', + label: '', + value: '', + width: 8, + isVisible: (options) => { + return !options.redundant + }, }, { type: 'number', @@ -59,12 +72,25 @@ module.exports = { min: 1, max: 65535, tooltip: 'Default: 10005', + isVisible: (options) => { + return options.redundant + }, + }, + { + type: 'static-text', + id: 'place-holder-2', + label: '', + value: '', + width: 4, + isVisible: (options) => { + return !options.redundant + }, }, { type: 'checkbox', id: 'redundant', label: 'Redundant Controllers', - default: true, + default: false, width: 4, }, { diff --git a/src/main.js b/src/main.js index 84577ac..0fd999d 100644 --- a/src/main.js +++ b/src/main.js @@ -18,8 +18,8 @@ class NTP_DOT_PROTOCOL extends InstanceBase { this.updateStatus(InstanceStatus.Connecting) this.config = config if (this.config.redundant) { - if (this.config.hostSec == '' || this.config.portSec == '') { - this.log('error', 'Secondary host / port not defined') + if (this.config.hostSec == '') { + this.log('error', 'Secondary host not defined') this.updateStatus(InstanceStatus.BadConfig, 'Secondary not defined') return undefined }