@switchbot/homebridge-switchbot 2.3.0-beta.3 → 2.3.0-beta.4
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/bot.d.ts.map +1 -1
- package/dist/device/bot.js +33 -11
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +3 -1
- package/dist/device/ceilinglight.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/contact.d.ts.map +1 -1
- package/dist/device/contact.js +3 -1
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +9 -3
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +6 -2
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +7 -2
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +9 -3
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +9 -3
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +3 -1
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +3 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +3 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +3 -1
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +3 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +3 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +3 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +3 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +4 -2
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +3 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +9 -3
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +3 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +4 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +1 -1
- package/src/device/bot.ts +33 -11
- package/src/device/ceilinglight.ts +3 -2
- package/src/device/colorbulb.ts +3 -1
- package/src/device/contact.ts +3 -2
- package/src/device/curtain.ts +9 -3
- package/src/device/humidifier.ts +6 -2
- package/src/device/lock.ts +7 -2
- package/src/device/meter.ts +9 -3
- package/src/device/meterplus.ts +9 -3
- package/src/device/motion.ts +3 -2
- package/src/device/plug.ts +3 -2
- package/src/device/robotvacuumcleaner.ts +3 -2
- package/src/device/striplight.ts +3 -2
- package/src/irdevice/airconditioner.ts +3 -1
- package/src/irdevice/airpurifier.ts +3 -2
- package/src/irdevice/camera.ts +3 -1
- package/src/irdevice/fan.ts +3 -1
- package/src/irdevice/light.ts +4 -2
- package/src/irdevice/other.ts +3 -1
- package/src/irdevice/tv.ts +10 -3
- package/src/irdevice/vacuumcleaner.ts +3 -1
- package/src/irdevice/waterheater.ts +4 -2
package/src/device/meterplus.ts
CHANGED
|
@@ -104,7 +104,9 @@ export class MeterPlus {
|
|
|
104
104
|
`${accessory.displayName} Temperature Sensor`;
|
|
105
105
|
|
|
106
106
|
this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
107
|
-
this.temperatureservice.
|
|
107
|
+
if (!this.temperatureservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
108
|
+
this.temperatureservice.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Temperature Sensor`);
|
|
109
|
+
}
|
|
108
110
|
this.temperatureservice
|
|
109
111
|
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
110
112
|
.setProps({
|
|
@@ -133,7 +135,9 @@ export class MeterPlus {
|
|
|
133
135
|
`${accessory.displayName} Humidity Sensor`;
|
|
134
136
|
|
|
135
137
|
this.humidityservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
|
|
136
|
-
this.humidityservice.
|
|
138
|
+
if (!this.humidityservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
139
|
+
this.humidityservice.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Humidity Sensor`);
|
|
140
|
+
}
|
|
137
141
|
this.humidityservice
|
|
138
142
|
.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
|
|
139
143
|
.setProps({
|
|
@@ -157,7 +161,9 @@ export class MeterPlus {
|
|
|
157
161
|
`${accessory.displayName} Battery`;
|
|
158
162
|
|
|
159
163
|
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
160
|
-
this.batteryService.
|
|
164
|
+
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
165
|
+
this.batteryService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
|
|
166
|
+
}
|
|
161
167
|
this.batteryService.setCharacteristic(this.platform.Characteristic.ChargingState, this.platform.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
162
168
|
} else {
|
|
163
169
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Battery Service Not Added`);
|
package/src/device/motion.ts
CHANGED
|
@@ -98,8 +98,9 @@ export class Motion {
|
|
|
98
98
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
99
99
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
100
100
|
this.motionSensorService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
101
|
-
this.motionSensorService.
|
|
102
|
-
|
|
101
|
+
if (!this.motionSensorService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
102
|
+
this.motionSensorService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
103
|
+
}
|
|
103
104
|
// each service must implement at-minimum the "required characteristics" for the given service type
|
|
104
105
|
// see https://developers.homebridge.io/#/service/MotionSensor
|
|
105
106
|
|
package/src/device/plug.ts
CHANGED
|
@@ -83,8 +83,9 @@ export class Plug {
|
|
|
83
83
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
84
84
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
85
85
|
this.outletService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
86
|
-
this.outletService.
|
|
87
|
-
|
|
86
|
+
if (!this.outletService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
87
|
+
this.outletService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
88
|
+
}
|
|
88
89
|
// each service must implement at-minimum the "required characteristics" for the given service type
|
|
89
90
|
// see https://developers.homebridge.io/#/service/Outlet
|
|
90
91
|
|
|
@@ -81,8 +81,9 @@ export class RobotVacuumCleaner {
|
|
|
81
81
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
82
82
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
83
83
|
this.robotVacuumCleanerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
84
|
-
this.robotVacuumCleanerService.
|
|
85
|
-
|
|
84
|
+
if (!this.robotVacuumCleanerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
85
|
+
this.robotVacuumCleanerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
86
|
+
}
|
|
86
87
|
// each service must implement at-minimum the "required characteristics" for the given service type
|
|
87
88
|
// see https://developers.homebridge.io/#/service/Lightbulb
|
|
88
89
|
|
package/src/device/striplight.ts
CHANGED
|
@@ -108,8 +108,9 @@ export class StripLight {
|
|
|
108
108
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
109
109
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
110
110
|
this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
111
|
-
this.lightBulbService.
|
|
112
|
-
|
|
111
|
+
if (!this.lightBulbService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
112
|
+
this.lightBulbService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
113
|
+
}
|
|
113
114
|
// handle on / off events using the On characteristic
|
|
114
115
|
this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
115
116
|
|
|
@@ -76,7 +76,9 @@ export class AirConditioner {
|
|
|
76
76
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
77
77
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
78
78
|
this.coolerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
79
|
-
this.coolerService.
|
|
79
|
+
if (!this.coolerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
80
|
+
this.coolerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
81
|
+
}
|
|
80
82
|
|
|
81
83
|
// handle on / off events using the Active characteristic
|
|
82
84
|
this.coolerService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
@@ -71,8 +71,9 @@ export class AirPurifier {
|
|
|
71
71
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
72
72
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
73
73
|
this.airPurifierService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
74
|
-
this.airPurifierService.
|
|
75
|
-
|
|
74
|
+
if (!this.airPurifierService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
75
|
+
this.airPurifierService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
76
|
+
}
|
|
76
77
|
// handle on / off events using the Active characteristic
|
|
77
78
|
this.airPurifierService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
78
79
|
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -53,7 +53,9 @@ export class Camera {
|
|
|
53
53
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
54
54
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
55
55
|
this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
56
|
-
this.switchService.
|
|
56
|
+
if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
57
|
+
this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
58
|
+
}
|
|
57
59
|
|
|
58
60
|
// handle on / off events using the On characteristic
|
|
59
61
|
this.switchService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -63,7 +63,9 @@ export class Fan {
|
|
|
63
63
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
64
64
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
65
65
|
this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
66
|
-
this.fanService.
|
|
66
|
+
if (!this.fanService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
67
|
+
this.fanService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
68
|
+
}
|
|
67
69
|
|
|
68
70
|
// handle on / off events using the Active characteristic
|
|
69
71
|
this.fanService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
package/src/irdevice/light.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class Light {
|
|
|
41
41
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
42
42
|
.updateValue(this.FirmwareRevision(accessory, device));
|
|
43
43
|
|
|
44
|
-
// get the
|
|
44
|
+
// get the Light service if it exists, otherwise create a new Light service
|
|
45
45
|
// you can create multiple services for each accessory
|
|
46
46
|
(this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
|
|
47
47
|
`${accessory.displayName} ${device.remoteType}`;
|
|
@@ -53,7 +53,9 @@ export class Light {
|
|
|
53
53
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
54
54
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
55
55
|
this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
56
|
-
this.lightBulbService.
|
|
56
|
+
if (!this.lightBulbService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
57
|
+
this.lightBulbService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
58
|
+
}
|
|
57
59
|
|
|
58
60
|
// handle on / off events using the On characteristic
|
|
59
61
|
this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
|
package/src/irdevice/other.ts
CHANGED
|
@@ -59,7 +59,9 @@ export class Others {
|
|
|
59
59
|
`${accessory.displayName} Fan`;
|
|
60
60
|
|
|
61
61
|
this.fanService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Fan`);
|
|
62
|
-
this.fanService.
|
|
62
|
+
if (!this.fanService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
63
|
+
this.fanService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Fan`);
|
|
64
|
+
}
|
|
63
65
|
this.fanService.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
64
66
|
} else {
|
|
65
67
|
this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Fanv2 Service Not Added, deviceType: ${device.other?.deviceType}`);
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -41,8 +41,6 @@ export class TV {
|
|
|
41
41
|
// set accessory information
|
|
42
42
|
accessory
|
|
43
43
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
44
|
-
.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`)
|
|
45
|
-
.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${device.deviceName} ${device.remoteType}`)
|
|
46
44
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
47
45
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
48
46
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
@@ -50,6 +48,13 @@ export class TV {
|
|
|
50
48
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
49
|
.updateValue(this.FirmwareRevision(accessory, device));
|
|
52
50
|
|
|
51
|
+
// get the Television service if it exists, otherwise create a new Television service
|
|
52
|
+
// you can create multiple services for each accessory
|
|
53
|
+
this.tvService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
54
|
+
if (!this.tvService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
55
|
+
this.tvService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
// set the accessory category
|
|
54
59
|
switch (device.remoteType) {
|
|
55
60
|
case 'Speaker':
|
|
@@ -115,7 +120,9 @@ export class TV {
|
|
|
115
120
|
`${accessory.displayName} Speaker`;
|
|
116
121
|
|
|
117
122
|
this.speakerService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Speaker`);
|
|
118
|
-
this.speakerService.
|
|
123
|
+
if (!this.speakerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
124
|
+
this.speakerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Speaker`);
|
|
125
|
+
}
|
|
119
126
|
this.speakerService
|
|
120
127
|
.setCharacteristic(this.platform.Characteristic.Active, this.platform.Characteristic.Active.ACTIVE)
|
|
121
128
|
.setCharacteristic(this.platform.Characteristic.VolumeControlType, this.platform.Characteristic.VolumeControlType.ABSOLUTE);
|
|
@@ -53,7 +53,9 @@ export class VacuumCleaner {
|
|
|
53
53
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
54
54
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
55
55
|
this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
56
|
-
this.switchService.
|
|
56
|
+
if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
57
|
+
this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
58
|
+
}
|
|
57
59
|
|
|
58
60
|
// handle on / off events using the On characteristic
|
|
59
61
|
this.switchService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
@@ -52,8 +52,10 @@ export class WaterHeater {
|
|
|
52
52
|
|
|
53
53
|
// set the service name, this is what is displayed as the default name on the Home app
|
|
54
54
|
// in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
|
|
55
|
-
this.valveService.setCharacteristic(this.platform.Characteristic.Name,
|
|
56
|
-
this.valveService.
|
|
55
|
+
this.valveService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
56
|
+
if (!this.valveService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
57
|
+
this.valveService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
58
|
+
}
|
|
57
59
|
|
|
58
60
|
// set sleep discovery characteristic
|
|
59
61
|
this.valveService.setCharacteristic(this.platform.Characteristic.ValveType, this.platform.Characteristic.ValveType.GENERIC_VALVE);
|