@switchbot/homebridge-switchbot 3.5.0-beta.62 → 3.5.0-beta.64
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 +9 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +33 -22
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +4 -3
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +3 -2
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +14 -10
- package/dist/device/contact.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/device.js +11 -10
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +7 -5
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +9 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +6 -4
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +10 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +3 -2
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +12 -8
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +8 -5
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +9 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +10 -6
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +3 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +6 -4
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +6 -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 +37 -19
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +13 -11
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +25 -15
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +50 -24
- 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 +180 -138
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +50 -59
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +13 -10
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +14 -13
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +9 -6
- package/src/device/bot.ts +33 -22
- package/src/device/ceilinglight.ts +4 -3
- package/src/device/colorbulb.ts +3 -3
- package/src/device/contact.ts +14 -10
- package/src/device/curtain.ts +11 -8
- package/src/device/device.ts +11 -11
- package/src/device/fan.ts +7 -5
- package/src/device/hub.ts +9 -6
- package/src/device/humidifier.ts +6 -4
- package/src/device/iosensor.ts +10 -6
- package/src/device/lightstrip.ts +3 -2
- package/src/device/lock.ts +12 -8
- package/src/device/meter.ts +8 -5
- package/src/device/meterplus.ts +9 -6
- package/src/device/motion.ts +10 -6
- package/src/device/plug.ts +3 -2
- package/src/device/robotvacuumcleaner.ts +6 -4
- package/src/device/waterdetector.ts +6 -4
- package/src/irdevice/airconditioner.ts +73 -86
- package/src/irdevice/airpurifier.ts +43 -23
- package/src/irdevice/camera.ts +14 -13
- package/src/irdevice/fan.ts +26 -18
- package/src/irdevice/light.ts +65 -45
- package/src/irdevice/other.ts +210 -154
- package/src/irdevice/tv.ts +57 -70
- package/src/irdevice/vacuumcleaner.ts +14 -12
- package/src/irdevice/waterheater.ts +15 -16
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,85 @@ export class TV extends irdeviceBase {
|
|
|
41
44
|
) {
|
|
42
45
|
super(platform, accessory, device);
|
|
43
46
|
|
|
44
|
-
// Initialize Television
|
|
47
|
+
// Initialize Television Service
|
|
48
|
+
accessory.context.Television = accessory.context.Television ?? {};
|
|
45
49
|
this.Television = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
Name: accessory.context.Television.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
51
|
+
ConfiguredName: accessory.context.Television.ConfiguredName ?? `${accessory.displayName} ${device.remoteType}`,
|
|
52
|
+
Service: accessory.getService(this.hap.Service.Television) ?? accessory.addService(this.hap.Service.Television) as Service,
|
|
53
|
+
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
54
|
+
ActiveIdentifier: accessory.context.ActiveIdentifier ?? 1,
|
|
55
|
+
SleepDiscoveryMode: accessory.context.SleepDiscoveryMode ?? this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE,
|
|
56
|
+
RemoteKey: accessory.context.RemoteKey ?? this.hap.Characteristic.RemoteKey.EXIT,
|
|
51
57
|
};
|
|
58
|
+
accessory.context.Television = this.Television as object;
|
|
52
59
|
|
|
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,
|
|
59
|
-
};
|
|
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
60
|
switch (device.remoteType) {
|
|
76
61
|
case 'Speaker':
|
|
77
62
|
case 'DIY Speaker':
|
|
78
63
|
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
64
|
break;
|
|
82
65
|
case 'IPTV':
|
|
83
66
|
case 'DIY IPTV':
|
|
84
67
|
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
68
|
break;
|
|
88
69
|
case 'DVD':
|
|
89
70
|
case 'DIY DVD':
|
|
90
71
|
case 'Set Top Box':
|
|
91
72
|
case 'DIY Set Top Box':
|
|
92
73
|
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
74
|
break;
|
|
96
75
|
default:
|
|
97
76
|
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
77
|
}
|
|
104
78
|
|
|
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
|
-
|
|
79
|
+
this.Television.Service
|
|
80
|
+
.setCharacteristic(this.hap.Characteristic.SleepDiscoveryMode, this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE)
|
|
81
|
+
.setCharacteristic(this.hap.Characteristic.ConfiguredName, this.Television.ConfiguredName)
|
|
82
|
+
.getCharacteristic(this.hap.Characteristic.ConfiguredName);
|
|
83
|
+
|
|
84
|
+
this.Television.Service
|
|
85
|
+
.setCharacteristic(this.hap.Characteristic.ActiveIdentifier, 1)
|
|
86
|
+
.getCharacteristic(this.hap.Characteristic.Active)
|
|
87
|
+
.onGet(() => {
|
|
88
|
+
return this.Television.Active;
|
|
89
|
+
})
|
|
90
|
+
.onSet(this.ActiveSet.bind(this));
|
|
91
|
+
|
|
92
|
+
this.Television.Service
|
|
93
|
+
.getCharacteristic(this.hap.Characteristic.ActiveIdentifier)
|
|
94
|
+
.onGet(() => {
|
|
95
|
+
return this.Television.ActiveIdentifier;
|
|
96
|
+
})
|
|
97
|
+
.onSet(this.ActiveIdentifierSet.bind(this));
|
|
98
|
+
|
|
99
|
+
this.Television.Service
|
|
100
|
+
.getCharacteristic(this.hap.Characteristic.RemoteKey)
|
|
101
|
+
.onGet(() => {
|
|
102
|
+
return this.Television.RemoteKey;
|
|
103
|
+
})
|
|
104
|
+
.onSet(this.RemoteKeySet.bind(this));
|
|
105
|
+
|
|
106
|
+
// Initialize TelevisionSpeaker Service
|
|
107
|
+
accessory.context.TelevisionSpeaker = accessory.context.TelevisionSpeaker ?? {};
|
|
108
|
+
this.TelevisionSpeaker = {
|
|
109
|
+
Name: accessory.context.TelevisionSpeaker.Name ?? `${accessory.displayName} ${device.remoteType} Speaker`,
|
|
110
|
+
Service: accessory.getService(this.hap.Service.TelevisionSpeaker) ?? accessory.addService(this.hap.Service.TelevisionSpeaker) as Service,
|
|
111
|
+
Active: accessory.context.Active ?? false,
|
|
112
|
+
VolumeControlType: accessory.context.VolumeControlType ?? this.hap.Characteristic.VolumeControlType.ABSOLUTE,
|
|
113
|
+
VolumeSelector: accessory.context.VolumeSelector ?? this.hap.Characteristic.VolumeSelector.INCREMENT,
|
|
114
|
+
};
|
|
115
|
+
accessory.context.TelevisionSpeaker = this.TelevisionSpeaker as object;
|
|
131
116
|
|
|
132
|
-
this.TelevisionSpeaker.Service.setCharacteristic(this.hap.Characteristic.Name, TelevisionSpeakerService);
|
|
133
117
|
this.TelevisionSpeaker.Service
|
|
118
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.TelevisionSpeaker.Name)
|
|
134
119
|
.setCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE)
|
|
135
|
-
.setCharacteristic(this.hap.Characteristic.VolumeControlType, this.hap.Characteristic.VolumeControlType.ABSOLUTE)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
.setCharacteristic(this.hap.Characteristic.VolumeControlType, this.hap.Characteristic.VolumeControlType.ABSOLUTE)
|
|
121
|
+
.getCharacteristic(this.hap.Characteristic.VolumeSelector)
|
|
122
|
+
.onGet(() => {
|
|
123
|
+
return this.TelevisionSpeaker.VolumeSelector;
|
|
124
|
+
})
|
|
125
|
+
.onSet(this.VolumeSelectorSet.bind(this));
|
|
139
126
|
}
|
|
140
127
|
|
|
141
128
|
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,22 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
29
30
|
) {
|
|
30
31
|
super(platform, accessory, device);
|
|
31
32
|
|
|
32
|
-
// Initialize Switch
|
|
33
|
+
// Initialize Switch Service
|
|
34
|
+
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
33
35
|
this.Switch = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
Name: accessory.context.Switch.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
37
|
+
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
38
|
+
On: accessory.context.On ?? false,
|
|
36
39
|
};
|
|
40
|
+
accessory.context.Switch = this.Switch as object;
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// handle on / off events using the On characteristic
|
|
46
|
-
this.Switch.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
42
|
+
this.Switch.Service
|
|
43
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Switch.Name)
|
|
44
|
+
.getCharacteristic(this.hap.Characteristic.On)
|
|
45
|
+
.onGet(() => {
|
|
46
|
+
return this.Switch.On;
|
|
47
|
+
})
|
|
48
|
+
.onSet(this.OnSet.bind(this));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
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,23 @@ export class WaterHeater extends irdeviceBase {
|
|
|
29
30
|
) {
|
|
30
31
|
super(platform, accessory, device);
|
|
31
32
|
|
|
32
|
-
// Initialize
|
|
33
|
+
// Initialize Switch Service
|
|
34
|
+
accessory.context.Valve = accessory.context.Valve ?? {};
|
|
33
35
|
this.Valve = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
Name: accessory.context.Valve.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
37
|
+
Service: accessory.getService(this.hap.Service.Valve) ?? accessory.addService(this.hap.Service.Valve) as Service,
|
|
38
|
+
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
36
39
|
};
|
|
40
|
+
accessory.context.Valve = this.Valve as object;
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// set sleep discovery characteristic
|
|
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));
|
|
42
|
+
this.Valve.Service
|
|
43
|
+
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
44
|
+
.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE)
|
|
45
|
+
.getCharacteristic(this.hap.Characteristic.Active)
|
|
46
|
+
.onGet(() => {
|
|
47
|
+
return this.Valve.Active;
|
|
48
|
+
})
|
|
49
|
+
.onSet(this.ActiveSet.bind(this));
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|