homebridge-flume 0.2.0 → 0.3.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,6 +2,10 @@
2
2
 
3
3
  All notable changes to homebridge-flume will be documented in this file.
4
4
 
5
+ ## 0.3.0 (2021-11-22)
6
+
7
+ Changed some configuration options
8
+
5
9
  ## 0.2.0 (2021-11-22)
6
10
 
7
11
  Converted from accessory plugin to platform plugin
package/README.md CHANGED
@@ -11,8 +11,8 @@ Configuration sample:
11
11
  "password": "password",
12
12
  "client_id": "12345678901234567890",
13
13
  "client_secret": "1234567890",
14
- "polling_minutes": 1,
15
- "handicap": 0.1,
14
+ "refreshInterval": 1,
15
+ "threshold": 0.1,
16
16
  "platform": "Flume"
17
17
  }
18
18
  ```
@@ -23,8 +23,8 @@ Fields:
23
23
  - "password": Your password for accessing the Flume site (required)
24
24
  - "client_id": Your Client ID for API access, found in Settings on the Flume site (required)
25
25
  - "client_secret": Your Client Secret for API access, found in Settings on the Flume site (required)
26
- - "polling_minutes": Number of minutes between updates. Defaults to 1 minute. API has a cap of 120 calls per hour. (optional)
27
- - "handicap": Set to ignore a steady water draw below this value. Defaults to zero (0.0) gallons. (optional)
26
+ - "refreshInterval": Number of minutes between updates. Defaults to 1 minute. API has a cap of 120 calls per hour. (optional)
27
+ - "threshold": Set to ignore a steady water draw below this value. Defaults to zero (0.0) gallons. (optional)
28
28
 
29
29
  # Retrieving API Login Credentials
30
30
 
@@ -39,18 +39,53 @@
39
39
  "required": true,
40
40
  "description": "Your Client Secret for API access, found in Settings on the Flume site"
41
41
  },
42
- "polling_minutes": {
43
- "title": "Update Interval",
42
+ "refreshInterval": {
43
+ "title": "Refresh interval",
44
44
  "type": "integer",
45
45
  "placeholder": 1,
46
46
  "description": "Number of minutes between updates. API has a cap of 120 calls per hour."
47
47
  },
48
- "handicap": {
48
+ "threshold": {
49
49
  "title": "Adjustment for False Positives",
50
50
  "type": "number",
51
51
  "placeholder": 0,
52
52
  "description": "Set to ignore a steady water draw below this value (gallons)."
53
- }
53
+ },
54
+ "disableDeviceLogging": {
55
+ "type": "boolean",
56
+ "title": "Disable Device Logging",
57
+ "description": "Global logging setting for accessory status changes. If true then accessory status changes will not be logged."
58
+ },
59
+ "debug": {
60
+ "title": "Debug Logging",
61
+ "type": "boolean",
62
+ "description": "Global logging setting for the plugin. If true then debug information will be added to the log."
63
+ },
64
+ "disablePlugin": {
65
+ "title": "Disable Plugin",
66
+ "type": "boolean",
67
+ "description": "If true, the plugin will remove all accessories and not load the plugin on restart."
68
+ }
69
+ }
70
+ },
71
+ "layout": [
72
+ {
73
+ "type": "fieldset",
74
+ "title": "Required Settings",
75
+ "items": ["username", "password", "client_id", "client_secret"]
76
+ },
77
+ {
78
+ "type": "fieldset",
79
+ "title": "Optional Settings",
80
+ "description": "Optional settings for the plugin, including global logging settings.",
81
+ "expandable": true,
82
+ "items": [
83
+ "refreshInterval",
84
+ "threshold",
85
+ "disableDeviceLogging",
86
+ "debug",
87
+ "disablePlugin"
88
+ ]
54
89
  }
55
- }
90
+ ]
56
91
  }
@@ -8,7 +8,7 @@ module.exports = class deviceValve {
8
8
  this.accessory = accessory
9
9
  this.disableDeviceLogging = platform.config.disableDeviceLogging
10
10
  this.funcs = platform.funcs
11
- this.handicap = platform.config.handicap
11
+ this.threshold = platform.config.threshold
12
12
  this.hapChar = platform.api.hap.Characteristic
13
13
  this.hapErr = platform.api.hap.HapStatusError
14
14
  this.hapServ = platform.api.hap.Service
@@ -16,7 +16,7 @@ module.exports = class deviceValve {
16
16
  this.log = platform.log
17
17
  this.name = accessory.displayName
18
18
  this.platform = platform
19
- this.polling_minutes = platform.config.polling_minutes
19
+ this.refreshInterval = platform.config.refreshInterval
20
20
  }
21
21
 
22
22
  externalUpdate (params) {
@@ -25,13 +25,13 @@ module.exports = class deviceValve {
25
25
  params.currentusage && params.currentusage[0] && params.currentusage[0].value
26
26
  ? params.currentusage[0].value
27
27
  : 0
28
- if (usage > this.handicap) {
28
+ if (usage > this.threshold) {
29
29
  this.log(
30
30
  '[%s] %s - [%s] gallons within the last [%s] minutes.',
31
31
  this.name,
32
32
  'usage detected',
33
33
  usage,
34
- this.polling_minutes
34
+ this.refreshInterval
35
35
  )
36
36
  }
37
37
  }
package/lib/index.js CHANGED
@@ -106,7 +106,7 @@ class FlumePlatform {
106
106
  }
107
107
  this.config[key] = val === 'false' ? false : !!val
108
108
  break
109
- case 'handicap': {
109
+ case 'threshold': {
110
110
  if (typeof v === 'string') {
111
111
  logQuotes(key)
112
112
  }
@@ -122,7 +122,7 @@ class FlumePlatform {
122
122
  case 'platform':
123
123
  case 'plugin_map':
124
124
  break
125
- case 'polling_minutes': {
125
+ case 'refreshInterval': {
126
126
  if (typeof val === 'string') {
127
127
  logQuotes(key)
128
128
  }
@@ -185,13 +185,13 @@ class FlumePlatform {
185
185
  })
186
186
 
187
187
  // Set up an initial last sync time
188
- this.lastSync = new Date(Date.now() - this.config.polling_minutes * 60000)
188
+ this.lastSync = new Date(Date.now() - this.config.refreshInterval * 60000)
189
189
 
190
190
  // Perform a first sync and setup the refresh interval
191
191
  this.flumeSync()
192
192
  this.refreshInterval = setInterval(
193
193
  () => this.flumeSync(),
194
- this.config.polling_minutes * 60000
194
+ this.config.refreshInterval * 60000
195
195
  )
196
196
 
197
197
  // Log that the plugin setup has been successful with a welcome message
@@ -9,8 +9,8 @@ module.exports = {
9
9
  password: '',
10
10
  client_id: '',
11
11
  client_secret: '',
12
- polling_minutes: 1,
13
- handicap: 0,
12
+ refreshInterval: 1,
13
+ threshold: 0,
14
14
  disableDeviceLogging: false,
15
15
  debug: false,
16
16
  disablePlugin: false,
@@ -18,13 +18,13 @@ module.exports = {
18
18
  },
19
19
 
20
20
  defaultValues: {
21
- polling_minutes: 1,
22
- handicap: 0
21
+ refreshInterval: 1,
22
+ threshold: 0
23
23
  },
24
24
 
25
25
  minValues: {
26
- polling_minutes: 1,
27
- handicap: 0
26
+ refreshInterval: 1,
27
+ threshold: 0
28
28
  },
29
29
 
30
30
  httpRetryCodes: ['ENOTFOUND', 'ETIMEDOUT', 'EAI_AGAIN', 'ECONNABORTED']
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-flume",
3
3
  "alias": "Flume",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "author": {
6
6
  "name": "Ben Potter",
7
7
  "email": "bwp91@icloud.com"