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