homebridge-flume 2.1.0-beta.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  All notable changes to homebridge-flume will be documented in this file.
4
4
 
5
- ⚠️ Note that Node 14 will no longer be supported after April 2023
5
+ ## 3.0.0 (2023-03-11)
6
6
 
7
- ## BETA
7
+ ### Breaking
8
+
9
+ - Remove official support for Node 14
10
+ - Remove option to disable plugin - this is now available in the Homebridge UI
11
+ - Remove option for debug logging - this will be enabled when using a beta version of the plugin
8
12
 
9
13
  ### Added
10
14
 
@@ -13,6 +17,7 @@ All notable changes to homebridge-flume will be documented in this file.
13
17
  ### Changed
14
18
 
15
19
  - Fix a potential login issue that might be terminating the process incorrectly
20
+ - Bump `node` recommended versions to v16.19.1 or v18.15.0
16
21
 
17
22
  ## 2.0.9 (2023-01-07)
18
23
 
@@ -39,16 +39,6 @@
39
39
  "required": true,
40
40
  "description": "Your Flume Client Secret, found at https://portal.flumetech.com."
41
41
  },
42
- "debug": {
43
- "title": "Debug Logging",
44
- "type": "boolean",
45
- "description": "Global logging setting for the plugin. If true then debug information will be added to the log."
46
- },
47
- "disablePlugin": {
48
- "title": "Disable Plugin",
49
- "type": "boolean",
50
- "description": "If true, the plugin will remove all accessories and not load the plugin on restart."
51
- },
52
42
  "disableDeviceLogging": {
53
43
  "type": "boolean",
54
44
  "title": "Disable Device Logging",
@@ -66,7 +56,7 @@
66
56
  {
67
57
  "type": "fieldset",
68
58
  "title": "Required Settings",
69
- "items": ["username", "password", "clientId", "clientSecret", "debug", "disablePlugin"]
59
+ "items": ["username", "password", "clientId", "clientSecret"]
70
60
  },
71
61
  {
72
62
  "type": "fieldset",
@@ -7,7 +7,6 @@ import platformLang from '../utils/lang-en.js';
7
7
  export default class {
8
8
  constructor(platform) {
9
9
  // Create variables usable by the class
10
- this.debug = platform.config.debug;
11
10
  this.log = platform.log;
12
11
  this.username = platform.config.username;
13
12
  this.password = platform.config.password;
@@ -59,9 +58,7 @@ export default class {
59
58
  */
60
59
 
61
60
  // Log the response if in debug mode
62
- if (this.debug) {
63
- this.log('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
64
- }
61
+ this.log.debug('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
65
62
 
66
63
  // Check to see we got a proper response
67
64
  if (!res.data.data || !res.data.data[0]) {
@@ -127,9 +124,7 @@ export default class {
127
124
  }
128
125
 
129
126
  // Log the response if in debug mode
130
- if (this.debug) {
131
- this.log('[HTTP renewToken()] %s.', JSON.stringify(res.data));
132
- }
127
+ this.log.debug('[HTTP renewToken()] %s.', JSON.stringify(res.data));
133
128
 
134
129
  /*
135
130
  {
@@ -187,9 +182,7 @@ export default class {
187
182
  }
188
183
 
189
184
  // Log the response if in debug mode
190
- if (this.debug) {
191
- this.log('[HTTP getDevices()] %s.', JSON.stringify(res.data));
192
- }
185
+ this.log.debug('[HTTP getDevices()] %s.', JSON.stringify(res.data));
193
186
 
194
187
  return res.data.data;
195
188
  } catch (err) {
@@ -225,9 +218,7 @@ export default class {
225
218
  }
226
219
 
227
220
  // Log the response if in debug mode
228
- if (this.debug) {
229
- this.log('[HTTP getDeviceInfo()] %s.', JSON.stringify(res.data));
230
- }
221
+ this.log.debug('[HTTP getDeviceInfo()] %s.', JSON.stringify(res.data));
231
222
 
232
223
  // Parse the response
233
224
  return res.data.data[0];
@@ -296,9 +287,7 @@ export default class {
296
287
  }
297
288
 
298
289
  // Log the response if in debug mode
299
- if (this.debug) {
300
- this.log('[HTTP getWaterInfo()] %s.', JSON.stringify(res.data));
301
- }
290
+ this.log.debug('[HTTP getWaterInfo()] %s.', JSON.stringify(res.data));
302
291
 
303
292
  // Parse the response
304
293
  return res.data.data[0];
@@ -326,9 +315,7 @@ export default class {
326
315
  }
327
316
 
328
317
  // Log the response if in debug mode
329
- if (this.debug) {
330
- this.log('[HTTP getLeakInfo()] %s.', JSON.stringify(res.data));
331
- }
318
+ this.log('[HTTP getLeakInfo()] %s.', JSON.stringify(res.data));
332
319
 
333
320
  // Parse the response
334
321
  return res.data.data[0];
@@ -22,15 +22,6 @@
22
22
  <button type="button" class="btn btn-primary ml-0" id="menuSettings">Settings</button>
23
23
  <button type="button" class="btn btn-primary mr-0" id="menuHome">Support</button>
24
24
  </div>
25
- <div
26
- id="disabledBanner"
27
- class="alert alert-secondary mb-0 mt-3"
28
- role="alert"
29
- style="display: none;"
30
- >
31
- Plugin is currently disabled
32
- <button id="disabledEnable" type="button" class="btn btn-link p-0 m-0 float-right">Enable</button>
33
- </div>
34
25
  <div id="pageSupport" class="mt-4" style="display: none;">
35
26
  <p class="text-center lead">Thank you for using <strong>homebridge-flume</strong></p>
36
27
  <p class="text-center">The links below will take you to our GitHub wiki</p>
@@ -143,26 +134,11 @@
143
134
  homebridge.showSchemaForm()
144
135
  homebridge.hideSpinner()
145
136
  }
146
- showDisabledBanner = () => {
147
- document.getElementById('disabledBanner').style.display = 'block'
148
- }
149
- enablePlugin = async () => {
150
- homebridge.showSpinner()
151
- document.getElementById('disabledBanner').style.display = 'none'
152
- currentConfig[0].disablePlugin = false
153
- await homebridge.updatePluginConfig(currentConfig)
154
- await homebridge.savePluginConfig()
155
- homebridge.hideSpinner()
156
- }
157
137
  menuHome.addEventListener('click', () => showSupport())
158
138
  menuSettings.addEventListener('click', () => showSettings())
159
- disabledEnable.addEventListener('click', () => enablePlugin())
160
139
  if (currentConfig.length) {
161
140
  document.getElementById('menuWrapper').style.display = 'inline-flex'
162
141
  showSettings()
163
- if (currentConfig[0].disablePlugin) {
164
- showDisabledBanner()
165
- }
166
142
  } else {
167
143
  currentConfig.push({ name: 'Flume' })
168
144
  await homebridge.updatePluginConfig(currentConfig)
package/lib/platform.js CHANGED
@@ -19,12 +19,13 @@ export default class {
19
19
  try {
20
20
  this.api = api;
21
21
  this.log = log;
22
+ this.isBeta = plugin.version.includes('beta');
22
23
 
23
24
  // Configuration objects for accessories
24
25
  this.devicesInHB = new Map();
25
26
 
26
- // Make sure user is running Homebridge v1.4 or above
27
- if (!api.versionGreaterOrEqual?.('1.4.0')) {
27
+ // Make sure user is running Homebridge v1.5 or above
28
+ if (!api.versionGreaterOrEqual?.('1.5.0')) {
28
29
  throw new Error(platformLang.hbVersionFail);
29
30
  }
30
31
 
@@ -93,9 +94,7 @@ export default class {
93
94
  this.config[key] = val;
94
95
  }
95
96
  break;
96
- case 'debug':
97
97
  case 'disableDeviceLogging':
98
- case 'disablePlugin':
99
98
  if (typeof val === 'string') {
100
99
  logQuotes(key);
101
100
  }
@@ -133,10 +132,21 @@ export default class {
133
132
  // Log that the plugin initialisation has been successful
134
133
  this.log('%s.', platformLang.initialised);
135
134
 
136
- // If the user has disabled the plugin then remove all accessories
137
- if (this.config.disablePlugin) {
138
- this.devicesInHB.forEach((accessory) => this.removeAccessory(accessory));
139
- throw new Error(platformLang.disabled);
135
+ // Sort out some logging functions
136
+ if (this.isBeta) {
137
+ this.log.debug = this.log;
138
+ this.log.debugWarn = this.log.warn;
139
+
140
+ // Log that using a beta will generate a lot of debug logs
141
+ if (this.isBeta) {
142
+ const divide = '*'.repeat(platformLang.beta.length + 1); // don't forget the full stop (+1!)
143
+ this.log.warn(divide);
144
+ this.log.warn(`${platformLang.beta}.`);
145
+ this.log.warn(divide);
146
+ }
147
+ } else {
148
+ this.log.debug = () => {};
149
+ this.log.debugWarn = () => {};
140
150
  }
141
151
 
142
152
  // Ensure username and password have been provided
@@ -152,7 +162,7 @@ export default class {
152
162
  // Require any libraries that the accessory instances use
153
163
  this.cusChar = new platformChars(this.api);
154
164
 
155
- // Set up the HTTP client if Thermobit username and password have been provided
165
+ // Set up the HTTP client if Flume username and password have been provided
156
166
  this.httpClient = new httpClient(this);
157
167
  await this.httpClient.obtainToken();
158
168
  const deviceList = await this.httpClient.getDevices();
@@ -197,7 +207,6 @@ export default class {
197
207
  this.log.warn('***** %s. *****', parseError(err, [
198
208
  platformLang.noCreds,
199
209
  platformLang.noDevices,
200
- platformLang.disabled,
201
210
  ]));
202
211
  this.pluginShutdown();
203
212
  }
@@ -5,8 +5,6 @@ export default {
5
5
  password: '',
6
6
  clientId: '',
7
7
  clientSecret: '',
8
- debug: false,
9
- disablePlugin: false,
10
8
  disableDeviceLogging: false,
11
9
  refreshInterval: 1,
12
10
  platform: 'Flume',
@@ -1,5 +1,6 @@
1
1
  export default {
2
2
  accNotFound: 'accessory not found',
3
+ beta: 'You are using a beta version of the plugin - you will experience more logging than normal',
3
4
  brand: 'Flume',
4
5
  cfgDef: 'is not a valid number so using default of',
5
6
  cfgDup: 'will be ignored since another entry with this ID already exists',
@@ -19,9 +20,8 @@ export default {
19
20
  devNotRemove: 'could not be removed from Homebridge as',
20
21
  devNotUpdated: 'could not be updated as',
21
22
  devRemove: 'has been removed from Homebridge',
22
- disabled: 'To change this, set disablePlugin to false',
23
23
  disabling: 'Disabling plugin',
24
- hbVersionFail: 'Your version of Homebridge is too low - please update to v1.5',
24
+ hbVersionFail: 'Your version of Homebridge is too low - please update to v1.6',
25
25
  httpRetry: 'Unable to reach Flume, retrying in 30 seconds',
26
26
  initialised: 'Plugin initialised. Setting up accessories...',
27
27
  initialising: 'Initialising plugin',
@@ -44,5 +44,6 @@ export default {
44
44
  'Have time to give this plugin a review? https://bit.ly/hb-flume-review',
45
45
  'This plugin currently has a 4☆ rating on HOOBS! https://bit.ly/hb-flume-review',
46
46
  'Want to see this plugin in your own language? Let me know!',
47
+ 'Want to beta test Homebridge 2.0? https://github.com/homebridge/homebridge/wiki/Homebridge-Beta-Testing',
47
48
  ],
48
49
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-flume",
3
3
  "alias": "Flume",
4
- "version": "2.1.0-beta.0",
4
+ "version": "3.0.0",
5
5
  "author": {
6
6
  "name": "Ben Potter",
7
7
  "email": "bwp91@icloud.com"
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "engines": {
31
31
  "homebridge": "^1.6.0 || 2.0.0-beta.0",
32
- "node": "^14.21.2 || ^16.19.0 || ^18.13.0"
32
+ "node": "^16.19.1 || ^18.15.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -58,14 +58,14 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@homebridge/plugin-ui-utils": "^0.0.19",
61
- "axios": "^1.2.2",
61
+ "axios": "^1.3.4",
62
62
  "jwt-decode": "^3.1.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "eslint-config-airbnb-base": "^15.0.0",
66
- "eslint-plugin-import": "^2.27.4",
67
- "eslint-plugin-import-newlines": "^1.3.0",
66
+ "eslint-plugin-import": "^2.27.5",
67
+ "eslint-plugin-import-newlines": "^1.3.1",
68
68
  "eslint-plugin-sort-exports": "^0.8.0",
69
- "eslint": "^8.32.0"
69
+ "eslint": "^8.36.0"
70
70
  }
71
71
  }