@switchbot/homebridge-switchbot 1.4.1-beta.7 → 1.5.1-beta.2

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 (78) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/CHANGELOG.md +8 -1
  3. package/config.schema.json +11 -2
  4. package/dist/devices/bots.d.ts +1 -0
  5. package/dist/devices/bots.d.ts.map +1 -1
  6. package/dist/devices/bots.js +35 -17
  7. package/dist/devices/bots.js.map +1 -1
  8. package/dist/devices/colorbulb.d.ts.map +1 -1
  9. package/dist/devices/colorbulb.js +17 -11
  10. package/dist/devices/colorbulb.js.map +1 -1
  11. package/dist/devices/contact.d.ts.map +1 -1
  12. package/dist/devices/contact.js +17 -11
  13. package/dist/devices/contact.js.map +1 -1
  14. package/dist/devices/curtains.d.ts.map +1 -1
  15. package/dist/devices/curtains.js +17 -11
  16. package/dist/devices/curtains.js.map +1 -1
  17. package/dist/devices/humidifiers.d.ts.map +1 -1
  18. package/dist/devices/humidifiers.js +17 -11
  19. package/dist/devices/humidifiers.js.map +1 -1
  20. package/dist/devices/meters.d.ts.map +1 -1
  21. package/dist/devices/meters.js +17 -11
  22. package/dist/devices/meters.js.map +1 -1
  23. package/dist/devices/motion.d.ts.map +1 -1
  24. package/dist/devices/motion.js +17 -11
  25. package/dist/devices/motion.js.map +1 -1
  26. package/dist/devices/plugs.d.ts.map +1 -1
  27. package/dist/devices/plugs.js +17 -11
  28. package/dist/devices/plugs.js.map +1 -1
  29. package/dist/irdevices/airconditioners.d.ts +0 -1
  30. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  31. package/dist/irdevices/airconditioners.js +26 -11
  32. package/dist/irdevices/airconditioners.js.map +1 -1
  33. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  34. package/dist/irdevices/airpurifiers.js +16 -1
  35. package/dist/irdevices/airpurifiers.js.map +1 -1
  36. package/dist/irdevices/cameras.d.ts.map +1 -1
  37. package/dist/irdevices/cameras.js +16 -1
  38. package/dist/irdevices/cameras.js.map +1 -1
  39. package/dist/irdevices/fans.d.ts.map +1 -1
  40. package/dist/irdevices/fans.js +16 -1
  41. package/dist/irdevices/fans.js.map +1 -1
  42. package/dist/irdevices/lights.d.ts.map +1 -1
  43. package/dist/irdevices/lights.js +16 -1
  44. package/dist/irdevices/lights.js.map +1 -1
  45. package/dist/irdevices/others.d.ts.map +1 -1
  46. package/dist/irdevices/others.js +16 -1
  47. package/dist/irdevices/others.js.map +1 -1
  48. package/dist/irdevices/tvs.d.ts.map +1 -1
  49. package/dist/irdevices/tvs.js +16 -1
  50. package/dist/irdevices/tvs.js.map +1 -1
  51. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  52. package/dist/irdevices/vacuumcleaners.js +16 -1
  53. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  54. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  55. package/dist/irdevices/waterheaters.js +16 -1
  56. package/dist/irdevices/waterheaters.js.map +1 -1
  57. package/dist/settings.d.ts +1 -0
  58. package/dist/settings.d.ts.map +1 -1
  59. package/dist/settings.js.map +1 -1
  60. package/package.json +7 -7
  61. package/src/devices/bots.ts +36 -17
  62. package/src/devices/colorbulb.ts +16 -11
  63. package/src/devices/contact.ts +16 -11
  64. package/src/devices/curtains.ts +17 -12
  65. package/src/devices/humidifiers.ts +16 -11
  66. package/src/devices/meters.ts +16 -11
  67. package/src/devices/motion.ts +16 -11
  68. package/src/devices/plugs.ts +16 -11
  69. package/src/irdevices/airconditioners.ts +17 -3
  70. package/src/irdevices/airpurifiers.ts +15 -1
  71. package/src/irdevices/cameras.ts +15 -1
  72. package/src/irdevices/fans.ts +15 -1
  73. package/src/irdevices/lights.ts +15 -1
  74. package/src/irdevices/others.ts +16 -2
  75. package/src/irdevices/tvs.ts +15 -1
  76. package/src/irdevices/vacuumcleaners.ts +15 -1
  77. package/src/irdevices/waterheaters.ts +15 -1
  78. package/src/settings.ts +1 -0
@@ -117,32 +117,37 @@ export class Plug {
117
117
  refreshRate() {
118
118
  if (this.device.refreshRate) {
119
119
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
120
- if (this.platform.debugMode) {
121
- this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
120
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
121
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
122
122
  }
123
123
  } else if (this.platform.config.options!.refreshRate) {
124
124
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
125
- if (this.platform.debugMode) {
126
- this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
125
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
126
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
127
127
  }
128
128
  }
129
129
  }
130
130
 
131
131
  logs() {
132
- if (this.device.logging) {
132
+ if (this.platform.debugMode) {
133
+ this.deviceLogging = this.accessory.context.logging = 'debug';
134
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
135
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
136
+ }
137
+ } else if (this.device.logging) {
133
138
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
134
- if (this.platform.debugMode) {
135
- this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
139
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
140
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
136
141
  }
137
142
  } else if (this.platform.config.options?.logging) {
138
143
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
139
- if (this.platform.debugMode) {
140
- this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
144
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
145
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
141
146
  }
142
147
  } else {
143
148
  this.deviceLogging = this.accessory.context.logging = 'standard';
144
- if (this.platform.debugMode) {
145
- this.warnLog('Using Device Standard Logging');
149
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
150
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Device Standard Logging`);
146
151
  }
147
152
  }
148
153
  }
@@ -167,12 +167,26 @@ export class AirConditioner {
167
167
  }
168
168
 
169
169
  logs() {
170
- if (this.device.logging) {
170
+ if (this.platform.debugMode) {
171
+ this.deviceLogging = this.accessory.context.logging = 'debug';
172
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
173
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
174
+ }
175
+ } else if (this.device.logging) {
171
176
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
177
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
178
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
179
+ }
172
180
  } else if (this.platform.config.options?.logging) {
173
181
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
182
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
183
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
184
+ }
174
185
  } else {
175
186
  this.deviceLogging = this.accessory.context.logging = 'standard';
187
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
188
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Standard Logging`);
189
+ }
176
190
  }
177
191
  }
178
192
 
@@ -185,7 +199,7 @@ export class AirConditioner {
185
199
  * AirConditioner: "command" "middleSpeed" "default" = fan speed to medium
186
200
  * AirConditioner: "command" "highSpeed" "default" = fan speed to high
187
201
  */
188
- async pushAirConditionerOnChanges() {
202
+ /*async pushAirConditionerOnChanges() {
189
203
  if (this.Active !== this.platform.Characteristic.Active.ACTIVE) {
190
204
  const payload = {
191
205
  commandType: 'command',
@@ -194,7 +208,7 @@ export class AirConditioner {
194
208
  } as any;
195
209
  await this.pushChanges(payload);
196
210
  }
197
- }
211
+ }*/
198
212
 
199
213
  async pushAirConditionerOffChanges() {
200
214
  const payload = {
@@ -88,12 +88,26 @@ export class AirPurifier {
88
88
  }
89
89
 
90
90
  logs() {
91
- if (this.device.logging) {
91
+ if (this.platform.debugMode) {
92
+ this.deviceLogging = this.accessory.context.logging = 'debug';
93
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
94
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
95
+ }
96
+ } else if (this.device.logging) {
92
97
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
98
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
99
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
100
+ }
93
101
  } else if (this.platform.config.options?.logging) {
94
102
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
103
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
104
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
105
+ }
95
106
  } else {
96
107
  this.deviceLogging = this.accessory.context.logging = 'standard';
108
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
109
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Standard Logging`);
110
+ }
97
111
  }
98
112
  }
99
113
 
@@ -58,12 +58,26 @@ export class Camera {
58
58
  }
59
59
 
60
60
  logs() {
61
- if (this.device.logging) {
61
+ if (this.platform.debugMode) {
62
+ this.deviceLogging = this.accessory.context.logging = 'debug';
63
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
64
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
65
+ }
66
+ } else if (this.device.logging) {
62
67
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
68
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
69
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
70
+ }
63
71
  } else if (this.platform.config.options?.logging) {
64
72
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
73
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
74
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
75
+ }
65
76
  } else {
66
77
  this.deviceLogging = this.accessory.context.logging = 'standard';
78
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
79
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Device Standard Logging`);
80
+ }
67
81
  }
68
82
  }
69
83
 
@@ -117,12 +117,26 @@ export class Fan {
117
117
  }
118
118
 
119
119
  logs() {
120
- if (this.device.logging) {
120
+ if (this.platform.debugMode) {
121
+ this.deviceLogging = this.accessory.context.logging = 'debug';
122
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
123
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
124
+ }
125
+ } else if (this.device.logging) {
121
126
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
127
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
128
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
129
+ }
122
130
  } else if (this.platform.config.options?.logging) {
123
131
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
132
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
133
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
134
+ }
124
135
  } else {
125
136
  this.deviceLogging = this.accessory.context.logging = 'standard';
137
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
138
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Device Standard Logging`);
139
+ }
126
140
  }
127
141
  }
128
142
 
@@ -73,12 +73,26 @@ export class Light {
73
73
  }
74
74
 
75
75
  logs() {
76
- if (this.device.logging) {
76
+ if (this.platform.debugMode) {
77
+ this.deviceLogging = this.accessory.context.logging = 'debug';
78
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
79
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
80
+ }
81
+ } else if (this.device.logging) {
77
82
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
83
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
84
+ this.warnLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
85
+ }
78
86
  } else if (this.platform.config.options?.logging) {
79
87
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
88
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
89
+ this.warnLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
90
+ }
80
91
  } else {
81
92
  this.deviceLogging = this.accessory.context.logging = 'standard';
93
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
94
+ this.warnLog(`Light: ${this.accessory.displayName} Using Device Standard Logging`);
95
+ }
82
96
  }
83
97
  }
84
98
 
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -55,12 +55,26 @@ export class Others {
55
55
  }
56
56
 
57
57
  logs() {
58
- if (this.device.logging) {
58
+ if (this.platform.debugMode) {
59
+ this.deviceLogging = this.accessory.context.logging = 'debug';
60
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
61
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
62
+ }
63
+ } else if (this.device.logging) {
59
64
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
65
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
66
+ this.warnLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
67
+ }
60
68
  } else if (this.platform.config.options?.logging) {
61
69
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
70
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
71
+ this.warnLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
72
+ }
62
73
  } else {
63
74
  this.deviceLogging = this.accessory.context.logging = 'standard';
75
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
76
+ this.warnLog(`Other: ${this.accessory.displayName} Using Device Standard Logging`);
77
+ }
64
78
  }
65
79
  }
66
80
 
@@ -129,12 +129,26 @@ export class TV {
129
129
  }
130
130
 
131
131
  logs() {
132
- if (this.device.logging) {
132
+ if (this.platform.debugMode) {
133
+ this.deviceLogging = this.accessory.context.logging = 'debug';
134
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
135
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
136
+ }
137
+ } else if (this.device.logging) {
133
138
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
139
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
140
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
141
+ }
134
142
  } else if (this.platform.config.options?.logging) {
135
143
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
144
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
145
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
146
+ }
136
147
  } else {
137
148
  this.deviceLogging = this.accessory.context.logging = 'standard';
149
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
150
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Standard Logging`);
151
+ }
138
152
  }
139
153
  }
140
154
 
@@ -58,12 +58,26 @@ export class VacuumCleaner {
58
58
  }
59
59
 
60
60
  logs() {
61
- if (this.device.logging) {
61
+ if (this.platform.debugMode) {
62
+ this.deviceLogging = this.accessory.context.logging = 'debug';
63
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
64
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
65
+ }
66
+ } else if (this.device.logging) {
62
67
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
68
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
69
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
70
+ }
63
71
  } else if (this.platform.config.options?.logging) {
64
72
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
73
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
74
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
75
+ }
65
76
  } else {
66
77
  this.deviceLogging = this.accessory.context.logging = 'standard';
78
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
79
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Standard Logging`);
80
+ }
67
81
  }
68
82
  }
69
83
 
@@ -67,12 +67,26 @@ export class WaterHeater {
67
67
  }
68
68
 
69
69
  logs() {
70
- if (this.device.logging) {
70
+ if (this.platform.debugMode) {
71
+ this.deviceLogging = this.accessory.context.logging = 'debug';
72
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
73
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
74
+ }
75
+ } else if (this.device.logging) {
71
76
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
77
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
78
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
79
+ }
72
80
  } else if (this.platform.config.options?.logging) {
73
81
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
82
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
83
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
84
+ }
74
85
  } else {
75
86
  this.deviceLogging = this.accessory.context.logging = 'standard';
87
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
88
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Standard Logging`);
89
+ }
76
90
  }
77
91
  }
78
92
 
package/src/settings.ts CHANGED
@@ -62,6 +62,7 @@ export type meter = {
62
62
  export type bot = {
63
63
  mode?: string;
64
64
  deviceType?: string;
65
+ doublePress?: number;
65
66
  };
66
67
 
67
68
  export type humidifier = {