@switchbot/homebridge-switchbot 3.5.0-beta.61 → 3.5.0-beta.63
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/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +4 -2
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +2 -1
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +3 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +11 -8
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/motion.js +1 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/waterdetector.js +4 -4
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +65 -83
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +39 -17
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +14 -10
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +27 -14
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +55 -23
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +198 -135
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +54 -59
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +15 -10
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +16 -13
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +5 -8
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +4 -2
- package/src/device/bot.ts +2 -1
- package/src/device/colorbulb.ts +3 -2
- package/src/device/curtain.ts +11 -8
- package/src/device/motion.ts +1 -1
- package/src/device/waterdetector.ts +4 -4
- package/src/irdevice/airconditioner.ts +73 -85
- package/src/irdevice/airpurifier.ts +46 -21
- package/src/irdevice/camera.ts +15 -12
- package/src/irdevice/fan.ts +29 -17
- package/src/irdevice/light.ts +70 -42
- package/src/irdevice/other.ts +230 -153
- package/src/irdevice/tv.ts +61 -70
- package/src/irdevice/vacuumcleaner.ts +16 -12
- package/src/irdevice/waterheater.ts +17 -16
- package/src/platform.ts +5 -8
package/src/irdevice/tv.ts
CHANGED
|
@@ -18,6 +18,8 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
|
|
|
18
18
|
export class TV extends irdeviceBase {
|
|
19
19
|
// Services
|
|
20
20
|
private Television: {
|
|
21
|
+
Name: CharacteristicValue;
|
|
22
|
+
ConfiguredName: CharacteristicValue;
|
|
21
23
|
Service: Service;
|
|
22
24
|
Active: CharacteristicValue;
|
|
23
25
|
ActiveIdentifier: CharacteristicValue;
|
|
@@ -26,6 +28,7 @@ export class TV extends irdeviceBase {
|
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
private TelevisionSpeaker: {
|
|
31
|
+
Name: CharacteristicValue;
|
|
29
32
|
Service: Service;
|
|
30
33
|
Active: CharacteristicValue;
|
|
31
34
|
VolumeControlType: CharacteristicValue;
|
|
@@ -41,101 +44,89 @@ export class TV extends irdeviceBase {
|
|
|
41
44
|
) {
|
|
42
45
|
super(platform, accessory, device);
|
|
43
46
|
|
|
44
|
-
// Initialize Television
|
|
47
|
+
// Initialize Television Service
|
|
48
|
+
if (!accessory.context.Television) {
|
|
49
|
+
accessory.context.Television = {};
|
|
50
|
+
}
|
|
45
51
|
this.Television = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Initialize TelevisionSpeaker property
|
|
54
|
-
this.TelevisionSpeaker = {
|
|
55
|
-
Service: accessory.getService(this.hap.Service.TelevisionSpeaker) as Service,
|
|
56
|
-
Active: accessory.context.Active || false,
|
|
57
|
-
VolumeControlType: accessory.context.VolumeControlType || this.hap.Characteristic.VolumeControlType.ABSOLUTE,
|
|
58
|
-
VolumeSelector: accessory.context.VolumeSelector || this.hap.Characteristic.VolumeSelector.INCREMENT,
|
|
52
|
+
Name: accessory.context.Television.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
53
|
+
ConfiguredName: accessory.context.Television.ConfiguredName ?? `${accessory.displayName} ${device.remoteType}`,
|
|
54
|
+
Service: accessory.getService(this.hap.Service.Television) ?? accessory.addService(this.hap.Service.Television) as Service,
|
|
55
|
+
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
56
|
+
ActiveIdentifier: accessory.context.ActiveIdentifier ?? 1,
|
|
57
|
+
SleepDiscoveryMode: accessory.context.SleepDiscoveryMode ?? this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE,
|
|
58
|
+
RemoteKey: accessory.context.RemoteKey ?? this.hap.Characteristic.RemoteKey.EXIT,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
// default placeholders
|
|
62
|
-
if (this.Television.Active === undefined) {
|
|
63
|
-
this.Television.Active = this.hap.Characteristic.Active.INACTIVE;
|
|
64
|
-
} else {
|
|
65
|
-
this.Television.Active = this.accessory.context.Active;
|
|
66
|
-
}
|
|
67
|
-
if (this.Television.ActiveIdentifier === undefined) {
|
|
68
|
-
this.Television.ActiveIdentifier = 1;
|
|
69
|
-
} else {
|
|
70
|
-
this.Television.ActiveIdentifier = this.accessory.context.ActiveIdentifier;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// set the accessory category
|
|
74
|
-
const TelevisionServiceCategory = `${accessory.displayName} ${device.remoteType}`;
|
|
75
61
|
switch (device.remoteType) {
|
|
76
62
|
case 'Speaker':
|
|
77
63
|
case 'DIY Speaker':
|
|
78
64
|
accessory.category = this.platform.api.hap.Categories.SPEAKER;
|
|
79
|
-
(this.Television.Service = accessory.getService(this.hap.Service.Television)
|
|
80
|
-
|| accessory.addService(this.hap.Service.Television)), TelevisionServiceCategory;
|
|
81
65
|
break;
|
|
82
66
|
case 'IPTV':
|
|
83
67
|
case 'DIY IPTV':
|
|
84
68
|
accessory.category = this.platform.api.hap.Categories.TV_STREAMING_STICK;
|
|
85
|
-
(this.Television.Service = accessory.getService(this.hap.Service.Television)
|
|
86
|
-
|| accessory.addService(this.hap.Service.Television)), TelevisionServiceCategory;
|
|
87
69
|
break;
|
|
88
70
|
case 'DVD':
|
|
89
71
|
case 'DIY DVD':
|
|
90
72
|
case 'Set Top Box':
|
|
91
73
|
case 'DIY Set Top Box':
|
|
92
74
|
accessory.category = this.platform.api.hap.Categories.TV_SET_TOP_BOX;
|
|
93
|
-
(this.Television.Service = accessory.getService(this.hap.Service.Television)
|
|
94
|
-
|| accessory.addService(this.hap.Service.Television)), TelevisionServiceCategory;
|
|
95
75
|
break;
|
|
96
76
|
default:
|
|
97
77
|
accessory.category = this.platform.api.hap.Categories.TELEVISION;
|
|
98
|
-
|
|
99
|
-
// get the Television service if it exists, otherwise create a new Television service
|
|
100
|
-
// you can create multiple services for each accessory
|
|
101
|
-
(this.Television.Service = accessory.getService(this.hap.Service.Television)
|
|
102
|
-
|| accessory.addService(this.hap.Service.Television)), TelevisionServiceCategory;
|
|
103
78
|
}
|
|
104
79
|
|
|
105
|
-
this.Television.Service
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
80
|
+
this.Television.Service
|
|
81
|
+
.setCharacteristic(this.hap.Characteristic.SleepDiscoveryMode, this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE)
|
|
82
|
+
.setCharacteristic(this.hap.Characteristic.ConfiguredName, this.Television.ConfiguredName)
|
|
83
|
+
.getCharacteristic(this.hap.Characteristic.ConfiguredName);
|
|
84
|
+
|
|
85
|
+
this.Television.Service
|
|
86
|
+
.setCharacteristic(this.hap.Characteristic.ActiveIdentifier, 1)
|
|
87
|
+
.getCharacteristic(this.hap.Characteristic.Active)
|
|
88
|
+
.onGet(() => {
|
|
89
|
+
return this.Television.Active;
|
|
90
|
+
})
|
|
91
|
+
.onSet(this.ActiveSet.bind(this));
|
|
92
|
+
|
|
93
|
+
this.Television.Service
|
|
94
|
+
.getCharacteristic(this.hap.Characteristic.ActiveIdentifier)
|
|
95
|
+
.onGet(() => {
|
|
96
|
+
return this.Television.ActiveIdentifier;
|
|
97
|
+
})
|
|
98
|
+
.onSet(this.ActiveIdentifierSet.bind(this));
|
|
99
|
+
|
|
100
|
+
this.Television.Service
|
|
101
|
+
.getCharacteristic(this.hap.Characteristic.RemoteKey)
|
|
102
|
+
.onGet(() => {
|
|
103
|
+
return this.Television.RemoteKey;
|
|
104
|
+
})
|
|
105
|
+
.onSet(this.RemoteKeySet.bind(this));
|
|
106
|
+
accessory.context.Television.Name = this.Television.Name;
|
|
107
|
+
|
|
108
|
+
// Initialize TelevisionSpeaker Service
|
|
109
|
+
if (!accessory.context.TelevisionSpeaker) {
|
|
110
|
+
accessory.context.TelevisionSpeaker = {};
|
|
111
|
+
}
|
|
112
|
+
this.TelevisionSpeaker = {
|
|
113
|
+
Name: accessory.context.TelevisionSpeaker.Name ?? `${accessory.displayName} ${device.remoteType} Speaker`,
|
|
114
|
+
Service: accessory.getService(this.hap.Service.TelevisionSpeaker) ?? accessory.addService(this.hap.Service.TelevisionSpeaker) as Service,
|
|
115
|
+
Active: accessory.context.Active ?? false,
|
|
116
|
+
VolumeControlType: accessory.context.VolumeControlType ?? this.hap.Characteristic.VolumeControlType.ABSOLUTE,
|
|
117
|
+
VolumeSelector: accessory.context.VolumeSelector ?? this.hap.Characteristic.VolumeSelector.INCREMENT,
|
|
118
|
+
};
|
|
131
119
|
|
|
132
|
-
this.TelevisionSpeaker.Service.setCharacteristic(this.hap.Characteristic.Name, TelevisionSpeakerService);
|
|
133
120
|
this.TelevisionSpeaker.Service
|
|
121
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.TelevisionSpeaker.Name)
|
|
134
122
|
.setCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
|
|
135
|
-
.setCharacteristic(this.hap.Characteristic.VolumeControlType, this.hap.Characteristic.VolumeControlType.ABSOLUTE)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
123
|
+
.setCharacteristic(this.hap.Characteristic.VolumeControlType, this.hap.Characteristic.VolumeControlType.ABSOLUTE)
|
|
124
|
+
.getCharacteristic(this.hap.Characteristic.VolumeSelector)
|
|
125
|
+
.onGet(() => {
|
|
126
|
+
return this.TelevisionSpeaker.VolumeSelector;
|
|
127
|
+
})
|
|
128
|
+
.onSet(this.VolumeSelectorSet.bind(this));
|
|
129
|
+
accessory.context.TelevisionSpeaker.Name = this.TelevisionSpeaker.Name;
|
|
139
130
|
}
|
|
140
131
|
|
|
141
132
|
async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
|
|
@@ -18,6 +18,7 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
|
|
|
18
18
|
export class VacuumCleaner extends irdeviceBase {
|
|
19
19
|
// Services
|
|
20
20
|
private Switch: {
|
|
21
|
+
Name: CharacteristicValue;
|
|
21
22
|
Service: Service;
|
|
22
23
|
On: CharacteristicValue;
|
|
23
24
|
};
|
|
@@ -29,21 +30,24 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
29
30
|
) {
|
|
30
31
|
super(platform, accessory, device);
|
|
31
32
|
|
|
32
|
-
// Initialize Switch
|
|
33
|
+
// Initialize Switch Service
|
|
34
|
+
if (!accessory.context.Switch) {
|
|
35
|
+
accessory.context.Switch = {};
|
|
36
|
+
}
|
|
33
37
|
this.Switch = {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
Name: accessory.context.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
39
|
+
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
40
|
+
On: accessory.context.On ?? false,
|
|
36
41
|
};
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.Switch.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
43
|
+
this.Switch.Service
|
|
44
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Switch.Name)
|
|
45
|
+
.getCharacteristic(this.hap.Characteristic.On)
|
|
46
|
+
.onGet(() => {
|
|
47
|
+
return this.Switch.On;
|
|
48
|
+
})
|
|
49
|
+
.onSet(this.OnSet.bind(this));
|
|
50
|
+
accessory.context.Switch.Name = this.Switch.Name;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
@@ -18,6 +18,7 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
|
|
|
18
18
|
export class WaterHeater extends irdeviceBase {
|
|
19
19
|
// Services
|
|
20
20
|
private Valve: {
|
|
21
|
+
Name: CharacteristicValue;
|
|
21
22
|
Service: Service;
|
|
22
23
|
Active: CharacteristicValue;
|
|
23
24
|
};
|
|
@@ -29,25 +30,25 @@ export class WaterHeater extends irdeviceBase {
|
|
|
29
30
|
) {
|
|
30
31
|
super(platform, accessory, device);
|
|
31
32
|
|
|
32
|
-
// Initialize
|
|
33
|
+
// Initialize Switch Service
|
|
34
|
+
if (!accessory.context.Valve) {
|
|
35
|
+
accessory.context.Valve = {};
|
|
36
|
+
}
|
|
33
37
|
this.Valve = {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
Name: accessory.context.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
39
|
+
Service: accessory.getService(this.hap.Service.Valve) ?? accessory.addService(this.hap.Service.Valve) as Service,
|
|
40
|
+
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
36
41
|
};
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.Valve.Service.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE);
|
|
48
|
-
|
|
49
|
-
// handle on / off events using the Active characteristic
|
|
50
|
-
this.Valve.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
43
|
+
this.Valve.Service
|
|
44
|
+
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
45
|
+
.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE)
|
|
46
|
+
.getCharacteristic(this.hap.Characteristic.Active)
|
|
47
|
+
.onGet(() => {
|
|
48
|
+
return this.Valve.Active;
|
|
49
|
+
})
|
|
50
|
+
.onSet(this.ActiveSet.bind(this));
|
|
51
|
+
accessory.context.Valve.Name = this.Valve.Name;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
package/src/platform.ts
CHANGED
|
@@ -735,21 +735,18 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
735
735
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
736
736
|
this.createStripLight(device);
|
|
737
737
|
break;
|
|
738
|
-
case '
|
|
738
|
+
case 'Battery Circulator Fan':
|
|
739
739
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
740
|
-
this.
|
|
740
|
+
this.createFan(device);
|
|
741
741
|
break;
|
|
742
742
|
case 'Remote':
|
|
743
|
+
case 'Indoor Cam':
|
|
743
744
|
case 'remote with screen+':
|
|
744
|
-
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId} is
|
|
745
|
-
break;
|
|
746
|
-
case 'Battery Circulator Fan':
|
|
747
|
-
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
|
748
|
-
this.createFan(device);
|
|
745
|
+
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}, is currently not supported, device: ${JSON.stringify(device)}`);
|
|
749
746
|
break;
|
|
750
747
|
default:
|
|
751
748
|
this.warnLog(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported.`,
|
|
752
|
-
+
|
|
749
|
+
+ `Submit Feature Requests Here: https://tinyurl.com/SwitchBotFeatureRequest, device: ${JSON.stringify(device)}` );
|
|
753
750
|
}
|
|
754
751
|
}
|
|
755
752
|
|