@switchbot/homebridge-switchbot 1.7.1-beta.12 → 1.7.1-beta.13

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.
Files changed (86) hide show
  1. package/dist/devices/bots.d.ts +1 -1
  2. package/dist/devices/bots.d.ts.map +1 -1
  3. package/dist/devices/bots.js +27 -24
  4. package/dist/devices/bots.js.map +1 -1
  5. package/dist/devices/colorbulb.d.ts.map +1 -1
  6. package/dist/devices/colorbulb.js +13 -10
  7. package/dist/devices/colorbulb.js.map +1 -1
  8. package/dist/devices/contact.d.ts +3 -3
  9. package/dist/devices/contact.d.ts.map +1 -1
  10. package/dist/devices/contact.js +38 -32
  11. package/dist/devices/contact.js.map +1 -1
  12. package/dist/devices/curtains.d.ts.map +1 -1
  13. package/dist/devices/curtains.js +13 -10
  14. package/dist/devices/curtains.js.map +1 -1
  15. package/dist/devices/humidifiers.d.ts.map +1 -1
  16. package/dist/devices/humidifiers.js +13 -10
  17. package/dist/devices/humidifiers.js.map +1 -1
  18. package/dist/devices/meters.d.ts +3 -3
  19. package/dist/devices/meters.d.ts.map +1 -1
  20. package/dist/devices/meters.js +42 -36
  21. package/dist/devices/meters.js.map +1 -1
  22. package/dist/devices/motion.d.ts +3 -3
  23. package/dist/devices/motion.d.ts.map +1 -1
  24. package/dist/devices/motion.js +38 -32
  25. package/dist/devices/motion.js.map +1 -1
  26. package/dist/devices/plugs.d.ts +3 -3
  27. package/dist/devices/plugs.d.ts.map +1 -1
  28. package/dist/devices/plugs.js +38 -32
  29. package/dist/devices/plugs.js.map +1 -1
  30. package/dist/irdevices/airconditioners.d.ts +1 -1
  31. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  32. package/dist/irdevices/airconditioners.js +15 -14
  33. package/dist/irdevices/airconditioners.js.map +1 -1
  34. package/dist/irdevices/airpurifiers.d.ts +3 -3
  35. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  36. package/dist/irdevices/airpurifiers.js +19 -18
  37. package/dist/irdevices/airpurifiers.js.map +1 -1
  38. package/dist/irdevices/cameras.d.ts +1 -1
  39. package/dist/irdevices/cameras.d.ts.map +1 -1
  40. package/dist/irdevices/cameras.js +15 -14
  41. package/dist/irdevices/cameras.js.map +1 -1
  42. package/dist/irdevices/fans.d.ts +1 -1
  43. package/dist/irdevices/fans.d.ts.map +1 -1
  44. package/dist/irdevices/fans.js +15 -14
  45. package/dist/irdevices/fans.js.map +1 -1
  46. package/dist/irdevices/lights.d.ts +1 -1
  47. package/dist/irdevices/lights.d.ts.map +1 -1
  48. package/dist/irdevices/lights.js +15 -14
  49. package/dist/irdevices/lights.js.map +1 -1
  50. package/dist/irdevices/others.d.ts +2 -2
  51. package/dist/irdevices/others.d.ts.map +1 -1
  52. package/dist/irdevices/others.js +19 -18
  53. package/dist/irdevices/others.js.map +1 -1
  54. package/dist/irdevices/tvs.d.ts +1 -1
  55. package/dist/irdevices/tvs.d.ts.map +1 -1
  56. package/dist/irdevices/tvs.js +15 -14
  57. package/dist/irdevices/tvs.js.map +1 -1
  58. package/dist/irdevices/vacuumcleaners.d.ts +1 -1
  59. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  60. package/dist/irdevices/vacuumcleaners.js +15 -14
  61. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  62. package/dist/irdevices/waterheaters.d.ts +1 -1
  63. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  64. package/dist/irdevices/waterheaters.js +15 -14
  65. package/dist/irdevices/waterheaters.js.map +1 -1
  66. package/dist/settings.d.ts +6 -6
  67. package/dist/settings.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/src/devices/bots.ts +27 -24
  70. package/src/devices/colorbulb.ts +13 -10
  71. package/src/devices/contact.ts +38 -32
  72. package/src/devices/curtains.ts +13 -10
  73. package/src/devices/humidifiers.ts +13 -10
  74. package/src/devices/meters.ts +42 -36
  75. package/src/devices/motion.ts +38 -32
  76. package/src/devices/plugs.ts +38 -32
  77. package/src/irdevices/airconditioners.ts +15 -14
  78. package/src/irdevices/airpurifiers.ts +19 -18
  79. package/src/irdevices/cameras.ts +15 -14
  80. package/src/irdevices/fans.ts +15 -14
  81. package/src/irdevices/lights.ts +15 -14
  82. package/src/irdevices/others.ts +19 -18
  83. package/src/irdevices/tvs.ts +15 -14
  84. package/src/irdevices/vacuumcleaners.ts +15 -14
  85. package/src/irdevices/waterheaters.ts +15 -14
  86. package/src/settings.ts +6 -6
@@ -33,9 +33,9 @@ export class Plug {
33
33
  public device: device & devicesConfig,
34
34
  ) {
35
35
  // default placeholders
36
- this.logs();
37
- this.scan();
38
- this.refreshRate();
36
+ this.logs(device);
37
+ this.scan(device);
38
+ this.refreshRate(device);
39
39
  this.config(device);
40
40
  if (this.On === undefined) {
41
41
  this.On = false;
@@ -119,55 +119,61 @@ export class Plug {
119
119
  }
120
120
 
121
121
  config(device: device & devicesConfig) {
122
- if (device.plug !== undefined) {
123
- this.warnLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(device.plug)}`);
122
+ const config: any = device.plug;
123
+ if (device.ble !== undefined) {
124
+ config['ble'] = device.ble;
125
+ }
126
+ if (device.logging !== undefined) {
127
+ config['logging'] = device.logging;
128
+ }
129
+ if (device.refreshRate !== undefined) {
130
+ config['refreshRate'] = device.refreshRate;
131
+ }
132
+ if (device.scanDuration !== undefined) {
133
+ config['scanDuration'] = device.scanDuration;
134
+ }
135
+ if (config !== undefined) {
136
+ this.warnLog(`Plug: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
124
137
  }
125
138
  }
126
139
 
127
- refreshRate() {
128
- if (this.device.refreshRate) {
129
- this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
130
- if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
131
- this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
132
- }
140
+ refreshRate(device: device & devicesConfig) {
141
+ if (device.refreshRate) {
142
+ this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
143
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
133
144
  } else if (this.platform.config.options!.refreshRate) {
134
145
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
135
- if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
136
- this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
137
- }
146
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
138
147
  }
139
148
  }
140
149
 
141
- scan() {
142
- if (this.device.scanDuration) {
143
- this.scanDuration = this.accessory.context.scanDuration = this.device.scanDuration;
144
- if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
145
- this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
150
+ scan(device: device & devicesConfig) {
151
+ if (device.scanDuration) {
152
+ this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
153
+ if (device.ble) {
154
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
146
155
  }
147
156
  } else {
148
157
  this.scanDuration = this.accessory.context.scanDuration = 1;
149
- if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
150
- this.warnLog(`Plug: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
158
+ if (this.device.ble) {
159
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
151
160
  }
152
161
  }
153
162
  }
154
163
 
155
- logs() {
164
+ logs(device: device & devicesConfig) {
156
165
  if (this.platform.debugMode) {
157
- this.deviceLogging = this.accessory.context.logging = 'debug';
158
- this.warnLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
159
- } else if (this.device.logging) {
160
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
161
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
162
- this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
163
- }
166
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
167
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
168
+ } else if (device.logging) {
169
+ this.deviceLogging = this.accessory.context.logging = device.logging;
170
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
164
171
  } else if (this.platform.config.options?.logging) {
165
172
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
166
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
167
- this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
168
- }
173
+ this.debugLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
169
174
  } else {
170
175
  this.deviceLogging = this.accessory.context.logging = 'standard';
176
+ this.debugLog(`Plug: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
171
177
  }
172
178
  }
173
179
 
@@ -49,7 +49,7 @@ export class AirConditioner {
49
49
  public device: irdevice & irDevicesConfig,
50
50
  ) {
51
51
  // default placeholders
52
- this.logs();
52
+ this.logs(device);
53
53
  this.config(device);
54
54
  if (this.Active === undefined) {
55
55
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -168,27 +168,28 @@ export class AirConditioner {
168
168
  }
169
169
 
170
170
  config(device: irdevice & irDevicesConfig) {
171
- if (device.irair !== undefined) {
172
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(device.irair)}`);
171
+ const config: any = device.irair;
172
+ if (device.logging !== undefined) {
173
+ config['logging'] = device.logging;
174
+ }
175
+ if (config !== undefined) {
176
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
173
177
  }
174
178
  }
175
179
 
176
- logs() {
180
+ logs(device: irdevice & irDevicesConfig) {
177
181
  if (this.platform.debugMode) {
178
- this.deviceLogging = this.accessory.context.logging = 'debug';
179
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
180
- } else if (this.device.logging) {
181
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
182
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
183
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
184
- }
182
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
183
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
184
+ } else if (device.logging) {
185
+ this.deviceLogging = this.accessory.context.logging = device.logging;
186
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
185
187
  } else if (this.platform.config.options?.logging) {
186
188
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
187
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
188
- this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
189
- }
189
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
190
190
  } else {
191
191
  this.deviceLogging = this.accessory.context.logging = 'standard';
192
+ this.debugLog(`Air Conditioner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
192
193
  }
193
194
  }
194
195
 
@@ -44,7 +44,7 @@ export class AirPurifier {
44
44
  public device: irdevice & irDevicesConfig,
45
45
  ) {
46
46
  // default placeholders
47
- this.logs();
47
+ this.logs(device);
48
48
  this.config(device);
49
49
  if (this.Active === undefined) {
50
50
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -89,36 +89,37 @@ export class AirPurifier {
89
89
  }
90
90
 
91
91
  config(device: irdevice & irDevicesConfig) {
92
- if (device.irpur !== undefined) {
93
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(device.irpur)}`);
92
+ const config: any = device.irpur;
93
+ if (device.logging !== undefined) {
94
+ config['logging'] = device.logging;
95
+ }
96
+ if (config !== undefined) {
97
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
94
98
  }
95
99
  }
96
100
 
97
- logs() {
101
+ logs(device: irdevice & irDevicesConfig) {
98
102
  if (this.platform.debugMode) {
99
- this.deviceLogging = this.accessory.context.logging = 'debug';
100
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
101
- } else if (this.device.logging) {
102
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
103
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
104
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
105
- }
103
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
104
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
105
+ } else if (device.logging) {
106
+ this.deviceLogging = this.accessory.context.logging = device.logging;
107
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
106
108
  } else if (this.platform.config.options?.logging) {
107
109
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
108
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
109
- this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
110
- }
110
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
111
111
  } else {
112
112
  this.deviceLogging = this.accessory.context.logging = 'standard';
113
+ this.debugLog(`Air Purifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
113
114
  }
114
115
  }
115
116
 
116
117
  private ActiveSet(value: CharacteristicValue) {
117
118
  this.debugLog(`Air Purifier: ${this.accessory.displayName} Set Active: ${value}`);
118
119
  if (value === this.platform.Characteristic.Active.INACTIVE) {
119
- this.pushAirConditionerOffChanges();
120
+ this.pushAirPurifierOffChanges();
120
121
  } else {
121
- this.pushAirConditionerOnChanges();
122
+ this.pushAirPurifierOnChanges();
122
123
  }
123
124
  this.Active = value;
124
125
  this.ActiveCached = this.Active;
@@ -184,7 +185,7 @@ export class AirPurifier {
184
185
  * AirPurifier: "command" "middleSpeed" "default" = fan speed to medium
185
186
  * AirPurifier: "command" "highSpeed" "default" = fan speed to high
186
187
  */
187
- async pushAirConditionerOnChanges() {
188
+ async pushAirPurifierOnChanges() {
188
189
  if (this.Active !== 1) {
189
190
  const payload = {
190
191
  commandType: 'command',
@@ -195,7 +196,7 @@ export class AirPurifier {
195
196
  }
196
197
  }
197
198
 
198
- async pushAirConditionerOffChanges() {
199
+ async pushAirPurifierOffChanges() {
199
200
  if (this.Active !== 0) {
200
201
  const payload = {
201
202
  commandType: 'command',
@@ -25,7 +25,7 @@ export class Camera {
25
25
  public device: irdevice & irDevicesConfig,
26
26
  ) {
27
27
  // default placeholders
28
- this.logs();
28
+ this.logs(device);
29
29
  this.config(device);
30
30
  if (this.On === undefined) {
31
31
  this.On = false;
@@ -59,27 +59,28 @@ export class Camera {
59
59
  }
60
60
 
61
61
  config(device: irdevice & irDevicesConfig) {
62
- if (device.ircam !== undefined && (this.deviceLogging === 'debug' || this.deviceLogging === 'standard')) {
63
- this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(device.ircam)}`);
62
+ const config: any = device.ircam;
63
+ if (device.logging !== undefined) {
64
+ config['logging'] = device.logging;
65
+ }
66
+ if (config !== undefined) {
67
+ this.warnLog(`Camera: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
64
68
  }
65
69
  }
66
70
 
67
- logs() {
71
+ logs(device: irdevice & irDevicesConfig) {
68
72
  if (this.platform.debugMode) {
69
- this.deviceLogging = this.accessory.context.logging = 'debug';
70
- this.warnLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
71
- } else if (this.device.logging) {
72
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
73
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
74
- this.warnLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
75
- }
73
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
74
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
75
+ } else if (device.logging) {
76
+ this.deviceLogging = this.accessory.context.logging = device.logging;
77
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
76
78
  } else if (this.platform.config.options?.logging) {
77
79
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
78
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
79
- this.warnLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
80
- }
80
+ this.debugLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
81
81
  } else {
82
82
  this.deviceLogging = this.accessory.context.logging = 'standard';
83
+ this.debugLog(`Camera: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
83
84
  }
84
85
  }
85
86
 
@@ -35,7 +35,7 @@ export class Fan {
35
35
  public device: irdevice & irDevicesConfig,
36
36
  ) {
37
37
  // default placeholders
38
- this.logs();
38
+ this.logs(device);
39
39
  this.config(device);
40
40
  if (this.Active === undefined) {
41
41
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -118,27 +118,28 @@ export class Fan {
118
118
  }
119
119
 
120
120
  config(device: irdevice & irDevicesConfig) {
121
- if (device.irfan !== undefined && (this.deviceLogging === 'debug' || this.deviceLogging === 'standard')) {
122
- this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(device.irfan)}`);
121
+ const config: any = device.irfan;
122
+ if (device.logging !== undefined) {
123
+ config['logging'] = device.logging;
124
+ }
125
+ if (config !== undefined) {
126
+ this.warnLog(`Fan: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
123
127
  }
124
128
  }
125
129
 
126
- logs() {
130
+ logs(device: irdevice & irDevicesConfig) {
127
131
  if (this.platform.debugMode) {
128
- this.deviceLogging = this.accessory.context.logging = 'debug';
129
- this.warnLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
130
- } else if (this.device.logging) {
131
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
132
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
133
- this.warnLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
134
- }
132
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
133
+ this.debugLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
134
+ } else if (device.logging) {
135
+ this.deviceLogging = this.accessory.context.logging = device.logging;
136
+ this.debugLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
135
137
  } else if (this.platform.config.options?.logging) {
136
138
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
137
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
138
- this.warnLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
139
- }
139
+ this.debugLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
140
140
  } else {
141
141
  this.deviceLogging = this.accessory.context.logging = 'standard';
142
+ this.debugLog(`Fan: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
142
143
  }
143
144
  }
144
145
 
@@ -25,7 +25,7 @@ export class Light {
25
25
  public device: irdevice & irDevicesConfig,
26
26
  ) {
27
27
  // default placeholders
28
- this.logs();
28
+ this.logs(device);
29
29
  this.config(device);
30
30
  if (this.On === undefined) {
31
31
  this.On = false;
@@ -74,27 +74,28 @@ export class Light {
74
74
  }
75
75
 
76
76
  config(device: irdevice & irDevicesConfig) {
77
- if (device.irlight !== undefined) {
78
- this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(device.irlight)}`);
77
+ const config: any = device.irlight;
78
+ if (device.logging !== undefined) {
79
+ config['logging'] = device.logging;
80
+ }
81
+ if (config !== undefined) {
82
+ this.warnLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
79
83
  }
80
84
  }
81
85
 
82
- logs() {
86
+ logs(device: irdevice & irDevicesConfig) {
83
87
  if (this.platform.debugMode) {
84
- this.deviceLogging = this.accessory.context.logging = 'debug';
85
- this.warnLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
86
- } else if (this.device.logging) {
87
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
88
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
89
- this.warnLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
90
- }
88
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
89
+ this.debugLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
90
+ } else if (device.logging) {
91
+ this.deviceLogging = this.accessory.context.logging = device.logging;
92
+ this.debugLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
91
93
  } else if (this.platform.config.options?.logging) {
92
94
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
93
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
94
- this.warnLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
95
- }
95
+ this.debugLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
96
96
  } else {
97
97
  this.deviceLogging = this.accessory.context.logging = 'standard';
98
+ this.debugLog(`Light: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
98
99
  }
99
100
  }
100
101
 
@@ -26,8 +26,8 @@ export class Others {
26
26
  public device: irdevice & irDevicesConfig,
27
27
  ) {
28
28
  // default placeholders
29
- this.logs();
30
- this.deviceType();
29
+ this.logs(device);
30
+ this.deviceType(device);
31
31
  this.config(device);
32
32
  if (this.Active === undefined) {
33
33
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -66,9 +66,9 @@ export class Others {
66
66
  }
67
67
  }
68
68
 
69
- deviceType() {
70
- if (this.device?.other?.deviceType) {
71
- this.otherDeviceType = this.accessory.context.deviceType = this.device?.other?.deviceType;
69
+ deviceType(device: irdevice & irDevicesConfig) {
70
+ if (device.other?.deviceType) {
71
+ this.otherDeviceType = this.accessory.context.deviceType = device.other.deviceType;
72
72
  if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
73
73
  this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
74
74
  }
@@ -78,27 +78,28 @@ export class Others {
78
78
  }
79
79
 
80
80
  config(device: irdevice & irDevicesConfig) {
81
- if (device.other !== undefined) {
82
- this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(device.other)}`);
81
+ const config: any = device.other;
82
+ if (device.logging !== undefined) {
83
+ config['logging'] = device.logging;
84
+ }
85
+ if (config !== undefined) {
86
+ this.warnLog(`Other: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
83
87
  }
84
88
  }
85
89
 
86
- logs() {
90
+ logs(device: irdevice & irDevicesConfig) {
87
91
  if (this.platform.debugMode) {
88
- this.deviceLogging = this.accessory.context.logging = 'debug';
89
- this.warnLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
90
- } else if (this.device.logging) {
91
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
92
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
93
- this.warnLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
94
- }
92
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
93
+ this.debugLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
94
+ } else if (device.logging) {
95
+ this.deviceLogging = this.accessory.context.logging = device.logging;
96
+ this.debugLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
95
97
  } else if (this.platform.config.options?.logging) {
96
98
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
97
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
98
- this.warnLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
99
- }
99
+ this.debugLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
100
100
  } else {
101
101
  this.deviceLogging = this.accessory.context.logging = 'standard';
102
+ this.debugLog(`Other: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
102
103
  }
103
104
  }
104
105
 
@@ -30,7 +30,7 @@ export class TV {
30
30
  public device: irdevice & irDevicesConfig,
31
31
  ) {
32
32
  // default placeholders
33
- this.logs();
33
+ this.logs(device);
34
34
  this.config(device);
35
35
  if (this.Active === undefined) {
36
36
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -130,27 +130,28 @@ export class TV {
130
130
  }
131
131
 
132
132
  config(device: irdevice & irDevicesConfig) {
133
- if (device.irtv !== undefined) {
134
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(device.irtv)}`);
133
+ const config: any = device.irtv;
134
+ if (device.logging !== undefined) {
135
+ config['logging'] = device.logging;
136
+ }
137
+ if (config !== undefined) {
138
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
135
139
  }
136
140
  }
137
141
 
138
- logs() {
142
+ logs(device: irdevice & irDevicesConfig) {
139
143
  if (this.platform.debugMode) {
140
- this.deviceLogging = this.accessory.context.logging = 'debug';
141
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
142
- } else if (this.device.logging) {
143
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
144
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
145
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
146
- }
144
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
145
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
146
+ } else if (device.logging) {
147
+ this.deviceLogging = this.accessory.context.logging = device.logging;
148
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
147
149
  } else if (this.platform.config.options?.logging) {
148
150
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
149
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
150
- this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
151
- }
151
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
152
152
  } else {
153
153
  this.deviceLogging = this.accessory.context.logging = 'standard';
154
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
154
155
  }
155
156
  }
156
157
 
@@ -25,7 +25,7 @@ export class VacuumCleaner {
25
25
  public device: irdevice & irDevicesConfig,
26
26
  ) {
27
27
  // default placeholders
28
- this.logs();
28
+ this.logs(device);
29
29
  this.config(device);
30
30
  if (this.On === undefined) {
31
31
  this.On = false;
@@ -59,27 +59,28 @@ export class VacuumCleaner {
59
59
  }
60
60
 
61
61
  config(device: irdevice & irDevicesConfig) {
62
- if (device.irvc !== undefined) {
63
- this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Config: ${JSON.stringify(device.irvc)}`);
62
+ const config: any = device.irvc;
63
+ if (device.logging !== undefined) {
64
+ config['logging'] = device.logging;
65
+ }
66
+ if (config !== undefined) {
67
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
64
68
  }
65
69
  }
66
70
 
67
- logs() {
71
+ logs(device: irdevice & irDevicesConfig) {
68
72
  if (this.platform.debugMode) {
69
- this.deviceLogging = this.accessory.context.logging = 'debug';
70
- this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
71
- } else if (this.device.logging) {
72
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
73
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
74
- this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
75
- }
73
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
74
+ this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
75
+ } else if (device.logging) {
76
+ this.deviceLogging = this.accessory.context.logging = device.logging;
77
+ this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
76
78
  } else if (this.platform.config.options?.logging) {
77
79
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
78
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
79
- this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
80
- }
80
+ this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
81
81
  } else {
82
82
  this.deviceLogging = this.accessory.context.logging = 'standard';
83
+ this.debugLog(`Vacuum Cleaner: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
83
84
  }
84
85
  }
85
86
 
@@ -25,7 +25,7 @@ export class WaterHeater {
25
25
  public device: irdevice & irDevicesConfig,
26
26
  ) {
27
27
  // default placeholders
28
- this.logs();
28
+ this.logs(device);
29
29
  this.config(device);
30
30
  if (this.Active === undefined) {
31
31
  this.Active = this.platform.Characteristic.Active.INACTIVE;
@@ -68,27 +68,28 @@ export class WaterHeater {
68
68
  }
69
69
 
70
70
  config(device: irdevice & irDevicesConfig) {
71
- if (device.irwh !== undefined) {
72
- this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(device.irwh)}`);
71
+ const config: any = device.irwh;
72
+ if (device.logging !== undefined) {
73
+ config['logging'] = device.logging;
74
+ }
75
+ if (config !== undefined) {
76
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
73
77
  }
74
78
  }
75
79
 
76
- logs() {
80
+ logs(device: irdevice & irDevicesConfig) {
77
81
  if (this.platform.debugMode) {
78
- this.deviceLogging = this.accessory.context.logging = 'debug';
79
- this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
80
- } else if (this.device.logging) {
81
- this.deviceLogging = this.accessory.context.logging = this.device.logging;
82
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
83
- this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
84
- }
82
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
83
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
84
+ } else if (device.logging) {
85
+ this.deviceLogging = this.accessory.context.logging = device.logging;
86
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
85
87
  } else if (this.platform.config.options?.logging) {
86
88
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
87
- if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
88
- this.warnLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
89
- }
89
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
90
90
  } else {
91
91
  this.deviceLogging = this.accessory.context.logging = 'standard';
92
+ this.debugLog(`Water Heater: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
92
93
  }
93
94
  }
94
95
 
package/src/settings.ts CHANGED
@@ -50,7 +50,7 @@ export interface devicesConfig extends device {
50
50
  contact?: contact;
51
51
  motion?: motion;
52
52
  colorbulb?: colorbulb;
53
- plug?: undefined;
53
+ plug?: Record<any, any>;
54
54
  ble?: string;
55
55
  scanDuration?: number;
56
56
  hide_device?: boolean;
@@ -108,11 +108,11 @@ export interface irDevicesConfig extends irdevice {
108
108
  logging?: string;
109
109
  irfan?: irfan;
110
110
  irair?: irair;
111
- irpur?: undefined;
112
- ircam?: undefined;
113
- irlight?: undefined;
114
- irvc?: undefined;
115
- irwh?: undefined;
111
+ irpur?: Record<any, any>;
112
+ ircam?: Record<any, any>;
113
+ irlight?: Record<any, any>;
114
+ irvc?: Record<any, any>;
115
+ irwh?: Record<any, any>;
116
116
  irtv?: irtv;
117
117
  other?: other;
118
118
  hide_device?: boolean;