@switchbot/homebridge-switchbot 2.0.0-beta.3 → 2.0.0-beta.30
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 +10 -1
- package/README.md +1 -2
- package/config.schema.json +102 -20
- package/dist/device/bot.d.ts +34 -28
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +655 -649
- package/dist/device/bot.js.map +1 -1
- package/dist/device/colorbulb.d.ts +36 -19
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +483 -309
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +18 -8
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +303 -237
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +23 -16
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +541 -498
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +24 -18
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +450 -369
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +27 -8
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +302 -148
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +22 -16
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +340 -262
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +24 -12
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +359 -213
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +18 -8
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +276 -216
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +27 -17
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +292 -251
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +43 -19
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +503 -262
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +9 -12
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +275 -230
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +5 -3
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +151 -104
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +11 -8
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +130 -86
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +10 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +157 -109
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +11 -8
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +134 -103
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +11 -8
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +142 -98
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +12 -9
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +140 -93
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +9 -10
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +129 -89
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +8 -9
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +129 -89
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +14 -12
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +479 -434
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +18 -11
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +12 -10
- package/src/device/bot.ts +654 -660
- package/src/device/colorbulb.ts +487 -344
- package/src/device/contact.ts +306 -241
- package/src/device/curtain.ts +546 -512
- package/src/device/humidifier.ts +453 -403
- package/src/device/lock.ts +311 -149
- package/src/device/meter.ts +351 -275
- package/src/device/meterplus.ts +369 -219
- package/src/device/motion.ts +282 -222
- package/src/device/plug.ts +296 -260
- package/src/device/striplight.ts +519 -289
- package/src/irdevice/airconditioner.ts +279 -241
- package/src/irdevice/airpurifier.ts +148 -103
- package/src/irdevice/camera.ts +128 -85
- package/src/irdevice/fan.ts +154 -106
- package/src/irdevice/light.ts +132 -103
- package/src/irdevice/other.ts +140 -97
- package/src/irdevice/tv.ts +139 -93
- package/src/irdevice/vacuumcleaner.ts +128 -89
- package/src/irdevice/waterheater.ts +127 -89
- package/src/platform.ts +469 -456
- package/src/settings.ts +18 -11
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
7
7
|
## What's Changed
|
|
8
8
|
|
|
9
9
|
- Moved from v1.0 to v1.1 of [OpenAPI](https://github.com/OpenWonderLabs/SwitchBotAPI)
|
|
10
|
+
- Publish device(s) as an external accessory.
|
|
11
|
+
- Added `connectionType` config, this replaces the `BLE` config.
|
|
12
|
+
- You can now select Both Connections, Only OpenAPI, Only BLE, or Disable.
|
|
13
|
+
- `Both` will use BLE as the default connection and will use OpenAPI as a backup connection.
|
|
14
|
+
- `OpenAPI` will only allow connections through the OpenAPI.
|
|
15
|
+
- `BLE` will only allow connections through Bluetooth (BLE), .
|
|
16
|
+
- `Disable` will disable all connections. This will also allow you to disable commands and refreshes for a specific device but leave it in HomeKit.
|
|
17
|
+
- Added `reDiscoverDevices` config which allows you to enable device rediscover periodically.
|
|
18
|
+
- Added `reDiscoverDevicesInterval` config which allows you to set the Interval for the `reDiscoverDevices` config.
|
|
10
19
|
- Housekeeping and updated dependencies.
|
|
11
20
|
|
|
12
21
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.15.0...v2.0.0
|
|
@@ -84,7 +93,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
84
93
|
|
|
85
94
|
## What's Changed
|
|
86
95
|
|
|
87
|
-
- Fix for Curtain v3.3 and above, from v1.2.0 node-
|
|
96
|
+
- Fix for Curtain v3.3 and above, from v1.2.0 node-switchbot update.
|
|
88
97
|
- Housekeeping and updated dependencies.
|
|
89
98
|
|
|
90
99
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.5...v1.12.6
|
package/README.md
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/@switchbot/homebridge-switchbot)
|
|
9
9
|
[](https://discord.gg/5wYTbwP4ha)
|
|
10
10
|
|
|
11
|
-
<p>The Homebridge <a href="https://www.switch-bot.com">SwitchBot</a>
|
|
12
|
-
plugin allows you to access your SwitchBot Device(s) from HomeKit with
|
|
11
|
+
<p>The Homebridge <a href="https://www.switch-bot.com">SwitchBot</a> plugin allows you to access your SwitchBot Device(s) from HomeKit with
|
|
13
12
|
<a href="https://homebridge.io">Homebridge</a>.
|
|
14
13
|
</p>
|
|
15
14
|
|
package/config.schema.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"pluginType": "platform",
|
|
4
4
|
"singular": true,
|
|
5
5
|
"customUi": true,
|
|
6
|
-
"headerDisplay": "<p align='center'><img width='100px' src='https://user-images.githubusercontent.com/9875439/102681754-ac2eb800-4189-11eb-8e17-7c47c804484b.png'></p>\n\nThe **SwitchBot** plugin allows you to control SwitchBot Devices. \n\nTo get started link your
|
|
6
|
+
"headerDisplay": "<p align='center'><img width='100px' src='https://user-images.githubusercontent.com/9875439/102681754-ac2eb800-4189-11eb-8e17-7c47c804484b.png'></p>\n\nThe **SwitchBot** plugin allows you to control SwitchBot Devices. \n\nTo get started link your SwitchBot account.\n\n1. Download SwitchBot App on App Store or Google Play Store.\n\n2. Register a SwitchBot account and log in into your account.\n\n3. Generate an Open Token within the App.\n\n4. Input your `Open Token` into the paramter below.",
|
|
7
7
|
"footerDisplay": "Please raise any issues on our [project page](https://github.com/OpenWonderLabs/homebridge-switchbot/issues).\n\nIf you would like to have other SwitchBot Devices added to this plugin fill out [Feature Request Form](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/new?assignees=&labels=&template=feature_request.md).\n\n[SwitchBot Website](https://www.switch-bot.com)",
|
|
8
8
|
"schema": {
|
|
9
9
|
"type": "object",
|
|
@@ -63,18 +63,11 @@
|
|
|
63
63
|
"hide_device": {
|
|
64
64
|
"title": "Hide Device",
|
|
65
65
|
"type": "boolean",
|
|
66
|
-
"description": "If true
|
|
66
|
+
"description": "If true, device will be removed or hidden from HomeKit.",
|
|
67
67
|
"condition": {
|
|
68
68
|
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId);"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
"offline": {
|
|
72
|
-
"title": "Offline as Off",
|
|
73
|
-
"type": "boolean",
|
|
74
|
-
"condition": {
|
|
75
|
-
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device);"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
71
|
"configDeviceType": {
|
|
79
72
|
"title": "Device Type",
|
|
80
73
|
"type": "string",
|
|
@@ -144,11 +137,30 @@
|
|
|
144
137
|
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device);"
|
|
145
138
|
}
|
|
146
139
|
},
|
|
147
|
-
"
|
|
148
|
-
"title": "
|
|
149
|
-
"type": "
|
|
140
|
+
"connectionType": {
|
|
141
|
+
"title": "Connection Type",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"oneOf": [
|
|
144
|
+
{
|
|
145
|
+
"title": "BLE/OpenAPI",
|
|
146
|
+
"enum": ["BLE/OpenAPI"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"title": "OpenAPI",
|
|
150
|
+
"enum": ["OpenAPI"]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"title": "BLE",
|
|
154
|
+
"enum": ["BLE"]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"title": "Disable",
|
|
158
|
+
"enum": ["Disabled"]
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"description": "Bluetooth (BLE) API is only available for the following Device Types: Humidifier, Meter, MeterPlus, Curtain, Bot, Motion Sensor, Contact Sensor, Plug Mini (US), Plug Mini (JP), & Color Bulb",
|
|
150
162
|
"condition": {
|
|
151
|
-
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device
|
|
163
|
+
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device);"
|
|
152
164
|
}
|
|
153
165
|
},
|
|
154
166
|
"customBLEaddress": {
|
|
@@ -156,7 +168,7 @@
|
|
|
156
168
|
"type": "string",
|
|
157
169
|
"placeholder": "81F3UT59513F",
|
|
158
170
|
"condition": {
|
|
159
|
-
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].
|
|
171
|
+
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].connectionType === 'BLE' || model.options.devices[arrayIndices].connectionType === 'BLE/OpenAPI'));"
|
|
160
172
|
}
|
|
161
173
|
},
|
|
162
174
|
"scanDuration": {
|
|
@@ -164,7 +176,7 @@
|
|
|
164
176
|
"type": "number",
|
|
165
177
|
"placeholder": 1,
|
|
166
178
|
"condition": {
|
|
167
|
-
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].
|
|
179
|
+
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].connectionType === 'BLE' || model.options.devices[arrayIndices].connectionType === 'BLE/OpenAPI'));"
|
|
168
180
|
}
|
|
169
181
|
},
|
|
170
182
|
"bot": {
|
|
@@ -523,6 +535,13 @@
|
|
|
523
535
|
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType);"
|
|
524
536
|
}
|
|
525
537
|
},
|
|
538
|
+
"external": {
|
|
539
|
+
"title": "External Accessory",
|
|
540
|
+
"type": "boolean",
|
|
541
|
+
"condition": {
|
|
542
|
+
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType);"
|
|
543
|
+
}
|
|
544
|
+
},
|
|
526
545
|
"logging": {
|
|
527
546
|
"title": "Device Logging Override Setting",
|
|
528
547
|
"type": "string",
|
|
@@ -545,7 +564,7 @@
|
|
|
545
564
|
}
|
|
546
565
|
}
|
|
547
566
|
},
|
|
548
|
-
"required": ["deviceId", "configDeviceType", "configDeviceName", "logging"]
|
|
567
|
+
"required": ["deviceId", "configDeviceType", "configDeviceName", "connectionType", "logging"]
|
|
549
568
|
},
|
|
550
569
|
"uniqueItems": true
|
|
551
570
|
},
|
|
@@ -571,6 +590,7 @@
|
|
|
571
590
|
"hide_device": {
|
|
572
591
|
"title": "Hide Device",
|
|
573
592
|
"type": "boolean",
|
|
593
|
+
"description": "If true, device will be removed or hidden from HomeKit.",
|
|
574
594
|
"condition": {
|
|
575
595
|
"functionBody": "return (model.options && model.options.irdevices && model.options.irdevices[arrayIndices].deviceId);"
|
|
576
596
|
}
|
|
@@ -692,6 +712,24 @@
|
|
|
692
712
|
"functionBody": "return (model.options && model.options.irdevices && model.options.irdevices[arrayIndices].deviceId && !model.options.irdevices[arrayIndices].hide_device);"
|
|
693
713
|
}
|
|
694
714
|
},
|
|
715
|
+
"connectionType": {
|
|
716
|
+
"title": "Connection Type",
|
|
717
|
+
"type": "string",
|
|
718
|
+
"oneOf": [
|
|
719
|
+
{
|
|
720
|
+
"title": "OpenAPI",
|
|
721
|
+
"enum": ["OpenAPI"]
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"title": "Disable",
|
|
725
|
+
"enum": ["Disabled"]
|
|
726
|
+
}
|
|
727
|
+
],
|
|
728
|
+
"description": "Enables OpenAPI, if disabled will leave device in HomeKit and commands will not be sent to OpenAPI.",
|
|
729
|
+
"condition": {
|
|
730
|
+
"functionBody": "return (model.options && model.options.devices && model.options.devices[arrayIndices].deviceId && !model.options.devices[arrayIndices].hide_device);"
|
|
731
|
+
}
|
|
732
|
+
},
|
|
695
733
|
"irair": {
|
|
696
734
|
"type": "object",
|
|
697
735
|
"properties": {
|
|
@@ -800,6 +838,21 @@
|
|
|
800
838
|
}
|
|
801
839
|
}
|
|
802
840
|
},
|
|
841
|
+
"firmware": {
|
|
842
|
+
"title": "Firmware Override",
|
|
843
|
+
"type": "string",
|
|
844
|
+
"placeholder": "1.2.8",
|
|
845
|
+
"condition": {
|
|
846
|
+
"functionBody": "return (model.options && model.options.irdevices && model.options.irdevices[arrayIndices].deviceId && !model.options.irdevices[arrayIndices].hide_device && model.options.irdevices[arrayIndices].configRemoteType);"
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
"external": {
|
|
850
|
+
"title": "External Accessory",
|
|
851
|
+
"type": "boolean",
|
|
852
|
+
"condition": {
|
|
853
|
+
"functionBody": "return (model.options && model.options.irdevices && model.options.irdevices[arrayIndices].deviceId && !model.options.irdevices[arrayIndices].hide_device && model.options.irdevices[arrayIndices].configRemoteType);"
|
|
854
|
+
}
|
|
855
|
+
},
|
|
803
856
|
"logging": {
|
|
804
857
|
"title": "Device Logging Override Setting",
|
|
805
858
|
"type": "string",
|
|
@@ -822,7 +875,7 @@
|
|
|
822
875
|
}
|
|
823
876
|
}
|
|
824
877
|
},
|
|
825
|
-
"required": ["deviceId", "configRemoteType", "logging"]
|
|
878
|
+
"required": ["deviceId", "configRemoteType", "connectionType", "logging"]
|
|
826
879
|
},
|
|
827
880
|
"uniqueItems": true
|
|
828
881
|
},
|
|
@@ -839,6 +892,31 @@
|
|
|
839
892
|
"placeholder": 1,
|
|
840
893
|
"description": "Indicates the number of seconds between pushes to SwitchBot API."
|
|
841
894
|
},
|
|
895
|
+
"reDiscoverDevices": {
|
|
896
|
+
"title": "Rediscover Devices Periodically",
|
|
897
|
+
"type": "boolean"
|
|
898
|
+
},
|
|
899
|
+
"reDiscoverDevicesInterval": {
|
|
900
|
+
"title": "Rediscover Devices Interval",
|
|
901
|
+
"type": "number",
|
|
902
|
+
"oneOf": [
|
|
903
|
+
{
|
|
904
|
+
"title": "1 Day",
|
|
905
|
+
"enum": [1]
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"title": "7 Days",
|
|
909
|
+
"enum": [7]
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
"title": "30 Days",
|
|
913
|
+
"enum": [30]
|
|
914
|
+
}
|
|
915
|
+
],
|
|
916
|
+
"condition": {
|
|
917
|
+
"functionBody": "return (model.options && model.options.reDiscoverDevices);"
|
|
918
|
+
}
|
|
919
|
+
},
|
|
842
920
|
"logging": {
|
|
843
921
|
"title": "Logging Setting",
|
|
844
922
|
"type": "string",
|
|
@@ -868,7 +946,7 @@
|
|
|
868
946
|
"title": "SwitchBot Account Info",
|
|
869
947
|
"expandable": true,
|
|
870
948
|
"expanded": false,
|
|
871
|
-
"items": ["credentials.token","credentials.secret"]
|
|
949
|
+
"items": ["credentials.token", "credentials.secret"]
|
|
872
950
|
},
|
|
873
951
|
{
|
|
874
952
|
"type": "fieldset",
|
|
@@ -889,8 +967,7 @@
|
|
|
889
967
|
"options.devices[].deviceId",
|
|
890
968
|
"options.devices[].hide_device",
|
|
891
969
|
"options.devices[].configDeviceType",
|
|
892
|
-
"options.devices[].
|
|
893
|
-
"options.devices[].ble",
|
|
970
|
+
"options.devices[].connectionType",
|
|
894
971
|
"options.devices[].scanDuration",
|
|
895
972
|
"options.devices[].bot.mode",
|
|
896
973
|
"options.devices[].bot.deviceType",
|
|
@@ -923,6 +1000,7 @@
|
|
|
923
1000
|
"options.devices[].lock.hide_contactsensor",
|
|
924
1001
|
"options.devices[].firmware",
|
|
925
1002
|
"options.devices[].refreshRate",
|
|
1003
|
+
"options.devices[].external",
|
|
926
1004
|
"options.devices[].logging"
|
|
927
1005
|
]
|
|
928
1006
|
}
|
|
@@ -958,6 +1036,8 @@
|
|
|
958
1036
|
"options.irdevices[].other.deviceType",
|
|
959
1037
|
"options.irdevices[].other.commandOn",
|
|
960
1038
|
"options.irdevices[].other.commandOff",
|
|
1039
|
+
"options.irdevices[].firmware",
|
|
1040
|
+
"options.irdevices[].external",
|
|
961
1041
|
"options.irdevices[].logging"
|
|
962
1042
|
]
|
|
963
1043
|
}
|
|
@@ -985,6 +1065,8 @@
|
|
|
985
1065
|
"key": "options.pushRate",
|
|
986
1066
|
"notitle": true
|
|
987
1067
|
},
|
|
1068
|
+
"options.reDiscoverDevices",
|
|
1069
|
+
"options.reDiscoverDevicesInterval",
|
|
988
1070
|
"options.logging"
|
|
989
1071
|
]
|
|
990
1072
|
}
|
package/dist/device/bot.d.ts
CHANGED
|
@@ -27,14 +27,12 @@ export declare class Bot {
|
|
|
27
27
|
windowCoveringService?: Service;
|
|
28
28
|
statefulProgrammableSwitchService?: Service;
|
|
29
29
|
On: CharacteristicValue;
|
|
30
|
-
OnCached: CharacteristicValue;
|
|
31
30
|
BatteryLevel: CharacteristicValue;
|
|
32
31
|
StatusLowBattery: CharacteristicValue;
|
|
33
32
|
power: deviceStatus['power'];
|
|
34
33
|
deviceStatus: any;
|
|
35
34
|
connected?: boolean;
|
|
36
35
|
switchbot: switchbot;
|
|
37
|
-
SwitchToOpenAPI?: boolean;
|
|
38
36
|
serviceData: serviceData;
|
|
39
37
|
address: ad['address'];
|
|
40
38
|
mode: serviceData['mode'];
|
|
@@ -48,6 +46,8 @@ export declare class Bot {
|
|
|
48
46
|
doublePress: number;
|
|
49
47
|
botUpdateInProgress: boolean;
|
|
50
48
|
doBotUpdate: Subject<void>;
|
|
49
|
+
private readonly BLE;
|
|
50
|
+
private readonly OpenAPI;
|
|
51
51
|
constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: device & devicesConfig);
|
|
52
52
|
/**
|
|
53
53
|
* Parse the device status from the SwitchBot api
|
|
@@ -60,7 +60,6 @@ export declare class Bot {
|
|
|
60
60
|
*/
|
|
61
61
|
refreshStatus(): Promise<void>;
|
|
62
62
|
BLERefreshStatus(): Promise<void>;
|
|
63
|
-
getCustomBLEAddress(switchbot: any): Promise<void>;
|
|
64
63
|
openAPIRefreshStatus(): Promise<void>;
|
|
65
64
|
/**
|
|
66
65
|
* Pushes the requested changes to the SwitchBot API
|
|
@@ -71,36 +70,15 @@ export declare class Bot {
|
|
|
71
70
|
*/
|
|
72
71
|
pushChanges(): Promise<void>;
|
|
73
72
|
BLEpushChanges(): Promise<void>;
|
|
74
|
-
turnOnOff(device_list: any): Promise<any>;
|
|
75
73
|
openAPIpushChanges(): Promise<void>;
|
|
76
74
|
/**
|
|
77
|
-
*
|
|
75
|
+
* Handle requests to set the "On" characteristic
|
|
78
76
|
*/
|
|
79
|
-
|
|
80
|
-
apiError(e: any): Promise<void>;
|
|
81
|
-
statusCode({ res }: {
|
|
82
|
-
res: IncomingMessage;
|
|
83
|
-
}): Promise<void>;
|
|
84
|
-
offlineOff(): Promise<void>;
|
|
77
|
+
OnSet(value: CharacteristicValue): Promise<void>;
|
|
85
78
|
/**
|
|
86
|
-
*
|
|
79
|
+
* Updates the status for each of the HomeKit Characteristics
|
|
87
80
|
*/
|
|
88
|
-
|
|
89
|
-
retry({ max, fn }: {
|
|
90
|
-
max: number;
|
|
91
|
-
fn: {
|
|
92
|
-
(): any;
|
|
93
|
-
(): Promise<any>;
|
|
94
|
-
};
|
|
95
|
-
}): Promise<null>;
|
|
96
|
-
maxRetry(): Promise<number>;
|
|
97
|
-
config(device: device & devicesConfig): Promise<void>;
|
|
98
|
-
refreshRate(device: device & devicesConfig): Promise<void>;
|
|
99
|
-
scan(device: device & devicesConfig): Promise<void>;
|
|
100
|
-
logs(device: device & devicesConfig): Promise<void>;
|
|
101
|
-
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue;
|
|
102
|
-
PressOrSwitch(device: device & devicesConfig): Promise<void>;
|
|
103
|
-
allowPushChanges(device: device & devicesConfig): Promise<void>;
|
|
81
|
+
updateHomeKitCharacteristics(): Promise<void>;
|
|
104
82
|
removeOutletService(accessory: PlatformAccessory): Promise<void>;
|
|
105
83
|
removeGarageDoorService(accessory: PlatformAccessory): Promise<void>;
|
|
106
84
|
removeDoorService(accessory: PlatformAccessory): Promise<void>;
|
|
@@ -111,12 +89,40 @@ export declare class Bot {
|
|
|
111
89
|
removeWindowCoveringService(accessory: PlatformAccessory): Promise<void>;
|
|
112
90
|
removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): Promise<void>;
|
|
113
91
|
removeSwitchService(accessory: PlatformAccessory): Promise<void>;
|
|
92
|
+
private DoublePress;
|
|
93
|
+
getCustomBLEAddress(switchbot: any): Promise<void>;
|
|
94
|
+
BLEPushConnection(): Promise<void>;
|
|
95
|
+
BLERefreshConnection(switchbot: any): Promise<void>;
|
|
96
|
+
turnOnOff(device_list: any): Promise<any>;
|
|
97
|
+
retry({ max, fn }: {
|
|
98
|
+
max: number;
|
|
99
|
+
fn: {
|
|
100
|
+
(): any;
|
|
101
|
+
(): Promise<any>;
|
|
102
|
+
};
|
|
103
|
+
}): Promise<null>;
|
|
104
|
+
maxRetry(): Promise<number>;
|
|
105
|
+
PressOrSwitch(device: device & devicesConfig): Promise<void>;
|
|
106
|
+
allowPushChanges(device: device & devicesConfig): Promise<void>;
|
|
107
|
+
scan(device: device & devicesConfig): Promise<void>;
|
|
108
|
+
statusCode({ res }: {
|
|
109
|
+
res: IncomingMessage;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
offlineOff(): Promise<void>;
|
|
112
|
+
apiError(e: any): Promise<void>;
|
|
113
|
+
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue;
|
|
114
|
+
private context;
|
|
115
|
+
refreshRate(device: device & devicesConfig): Promise<void>;
|
|
116
|
+
config(device: device & devicesConfig): Promise<void>;
|
|
117
|
+
logs(device: device & devicesConfig): Promise<void>;
|
|
114
118
|
/**
|
|
115
119
|
* Logging for Device
|
|
116
120
|
*/
|
|
117
121
|
infoLog(...log: any[]): void;
|
|
118
122
|
warnLog(...log: any[]): void;
|
|
123
|
+
debugWarnLog(...log: any[]): void;
|
|
119
124
|
errorLog(...log: any[]): void;
|
|
125
|
+
debugErrorLog(...log: any[]): void;
|
|
120
126
|
debugLog(...log: any[]): void;
|
|
121
127
|
enablingDeviceLogging(): boolean;
|
|
122
128
|
}
|
package/dist/device/bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/device/bot.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../src/device/bot.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAY,OAAO,E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