@switchbot/homebridge-switchbot 3.5.2-beta.0 → 3.5.2-beta.2
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 +8 -7
- package/config.schema.json +13 -13
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +121 -107
- package/dist/device/bot.js.map +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +2 -0
- package/dist/device/device.js.map +1 -1
- package/package.json +2 -2
- package/src/device/bot.ts +121 -101
- package/src/device/device.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
5
5
|
## [3.5.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.5.1) (2024-06-27)
|
|
6
6
|
|
|
7
7
|
### What's Changed
|
|
8
|
+
- Fix issue `RangeError: Maximum call stack size exceeded` introduced in `v3.5.0`
|
|
8
9
|
- Housekeeping and updated dependencies.
|
|
9
10
|
|
|
10
11
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.5.0...v3.5.1
|
|
@@ -35,7 +36,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
35
36
|
|
|
36
37
|
### What's Changed
|
|
37
38
|
- Add config that allows you to set `cool` and `heat`: `min` & `max`
|
|
38
|
-
-
|
|
39
|
+
- Fixed node-switchbot import [#928](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/928), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
39
40
|
- Code cleanup: Remove unnecessary await keyword [#929](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/929), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
40
41
|
- Code cleanup: Remove empty image tag [#930](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/930), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
41
42
|
- Housekeeping and updated dependencies.
|
|
@@ -61,7 +62,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
61
62
|
## [3.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.1.2) (2024-02-05)
|
|
62
63
|
|
|
63
64
|
### What's Changed
|
|
64
|
-
-
|
|
65
|
+
- Fixed node-switchbot import issue.
|
|
65
66
|
- Housekeeping and updated dependencies.
|
|
66
67
|
|
|
67
68
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.1.1...v3.1.2
|
|
@@ -69,9 +70,9 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
69
70
|
## [3.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.1.1) (2024-02-05)
|
|
70
71
|
|
|
71
72
|
### What's Changed
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
73
|
+
- Fixed BLE connection [#907](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/907), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
74
|
+
- Fixed BLE curtain mode [#908](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/908), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
75
|
+
- Fixed curtain characteristic warning [#909](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/909), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
75
76
|
- Revert curtain retry functionality [#911](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/911), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
76
77
|
- Code Cleaup [#910](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/910) [#912](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/912) [#913](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/913) [#917](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/917), Thanks [@dnicolson](https://github.com/dnicolson)
|
|
77
78
|
- Housekeeping and updated dependencies.
|
|
@@ -82,7 +83,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
82
83
|
|
|
83
84
|
### What's Changed
|
|
84
85
|
- Offical support for [Curtain 3](https://www.switch-bot.com/pages/switchbot-curtain-3), `deviceType`: `Curtain3`.
|
|
85
|
-
-
|
|
86
|
+
- Fixed issue with which prevented the plugin from loading.
|
|
86
87
|
- Housekeeping and updated dependencies.
|
|
87
88
|
|
|
88
89
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.0.0...v3.1.0
|
|
@@ -143,7 +144,7 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
143
144
|
### What's Changed
|
|
144
145
|
|
|
145
146
|
- Add Support for Stateless button on IR Lights [#863](https://github.com/OpenWonderLabs/homebridge-switchbot/issues/863)
|
|
146
|
-
- Fix noble [#864](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/864)
|
|
147
|
+
- Fix noble version [#864](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/864)
|
|
147
148
|
- Housekeeping and updated dependencies.
|
|
148
149
|
|
|
149
150
|
**Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.11.0...v2.12.0
|
package/config.schema.json
CHANGED
|
@@ -1676,17 +1676,17 @@
|
|
|
1676
1676
|
"placeholder": 3
|
|
1677
1677
|
},
|
|
1678
1678
|
"refreshRate": {
|
|
1679
|
-
"title": "
|
|
1679
|
+
"title": "Refresh Rate",
|
|
1680
1680
|
"type": "number",
|
|
1681
1681
|
"placeholder": 360
|
|
1682
1682
|
},
|
|
1683
1683
|
"updateRate": {
|
|
1684
|
-
"title": "
|
|
1684
|
+
"title": "Update Rate",
|
|
1685
1685
|
"type": "number",
|
|
1686
1686
|
"placeholder": 5
|
|
1687
1687
|
},
|
|
1688
1688
|
"pushRate": {
|
|
1689
|
-
"title": "
|
|
1689
|
+
"title": "Push Rate",
|
|
1690
1690
|
"type": "number",
|
|
1691
1691
|
"placeholder": 1
|
|
1692
1692
|
},
|
|
@@ -1763,17 +1763,8 @@
|
|
|
1763
1763
|
"options.devices[].configDeviceType",
|
|
1764
1764
|
"options.devices[].connectionType",
|
|
1765
1765
|
"options.devices[].webhook",
|
|
1766
|
-
"options.devices[].hub.hide_temperature",
|
|
1767
|
-
"options.devices[].hub.convertUnitTo",
|
|
1768
|
-
"options.devices[].hub.hide_humidity",
|
|
1769
|
-
"options.devices[].hub.hide_lightsensor",
|
|
1770
|
-
"options.devices[].scanDuration",
|
|
1771
|
-
"options.devices[].disableCaching",
|
|
1772
|
-
"options.devices[].maxRetries",
|
|
1773
|
-
"options.devices[].delayBetweenRetries",
|
|
1774
|
-
"options.devices[].maxRetry",
|
|
1775
|
-
"options.devices[].bot.mode",
|
|
1776
1766
|
"options.devices[].bot.deviceType",
|
|
1767
|
+
"options.devices[].bot.mode",
|
|
1777
1768
|
"options.devices[].bot.allowPush",
|
|
1778
1769
|
"options.devices[].bot.doublePress",
|
|
1779
1770
|
"options.devices[].bot.pushRatePress",
|
|
@@ -1783,6 +1774,10 @@
|
|
|
1783
1774
|
"options.devices[].iosensor.hide_temperature",
|
|
1784
1775
|
"options.devices[].iosensor.convertUnitTo",
|
|
1785
1776
|
"options.devices[].iosensor.hide_humidity",
|
|
1777
|
+
"options.devices[].hub.hide_temperature",
|
|
1778
|
+
"options.devices[].hub.convertUnitTo",
|
|
1779
|
+
"options.devices[].hub.hide_humidity",
|
|
1780
|
+
"options.devices[].hub.hide_lightsensor",
|
|
1786
1781
|
"options.devices[].waterdetector.hide_leak",
|
|
1787
1782
|
"options.devices[].humidifier.set_minStep",
|
|
1788
1783
|
"options.devices[].humidifier.hide_temperature",
|
|
@@ -1815,11 +1810,16 @@
|
|
|
1815
1810
|
"options.devices[].striplight.adaptiveLightingShift",
|
|
1816
1811
|
"options.devices[].lock.hide_contactsensor",
|
|
1817
1812
|
"options.devices[].lock.activate_latchbutton",
|
|
1813
|
+
"options.devices[].disableCaching",
|
|
1814
|
+
"options.devices[].maxRetries",
|
|
1815
|
+
"options.devices[].delayBetweenRetries",
|
|
1816
|
+
"options.devices[].maxRetry",
|
|
1818
1817
|
"options.devices[].mqttURL",
|
|
1819
1818
|
"options.devices[].mqttOptions",
|
|
1820
1819
|
"options.devices[].mqttPubOptions",
|
|
1821
1820
|
"options.devices[].history",
|
|
1822
1821
|
"options.devices[].firmware",
|
|
1822
|
+
"options.devices[].scanDuration",
|
|
1823
1823
|
{
|
|
1824
1824
|
"key": "options.devices[].refreshRate",
|
|
1825
1825
|
"description": "<em class='primary-text'>Specifies the interval, in seconds, for retrieving the latest device status from the SwitchBot API. This interval applies only to this specific device.</em>"
|
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":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAgD,MAAM,MAAM,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAElF;;;;GAIG;AACH,qBAAa,GAAI,SAAQ,UAAU;IA2F/B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB;IAzFtC,OAAO,CAAC,OAAO,CAKb;IAEF,OAAO,CAAC,MAAM,CAAC,CAIb;IAEF,OAAO,CAAC,UAAU,CAAC,CAIjB;IAEF,OAAO,CAAC,IAAI,CAAC,CAIX;IAEF,OAAO,CAAC,MAAM,CAAC,CAIb;IAEF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,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa9D,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa9D,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAahE,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7D,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAahE,2BAA2B,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxE,uCAAuC,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAapF,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAahE,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;IA0BzB,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CjC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa;IAyCnD,iBAAiB;IAOjB,oBAAoB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAyD3B,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAuDtC"}
|
package/dist/device/bot.js
CHANGED
|
@@ -1098,83 +1098,123 @@ export class Bot extends deviceBase {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
async removeOutletService(accessory) {
|
|
1100
1100
|
// If outletService still present, then remove first
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
accessory.
|
|
1105
|
-
|
|
1101
|
+
accessory.context.Outlet = accessory.context.Outlet ?? {};
|
|
1102
|
+
this.Outlet = {
|
|
1103
|
+
Name: accessory.context.Outlet.Name ?? accessory.displayName,
|
|
1104
|
+
Service: accessory.getService(this.hap.Service.Outlet),
|
|
1105
|
+
On: accessory.context.On ?? false,
|
|
1106
|
+
};
|
|
1107
|
+
accessory.context.Outlet = this.Outlet;
|
|
1108
|
+
await this.warnLog('Removing any leftover Outlet Service');
|
|
1109
|
+
accessory.removeService(this.Outlet.Service);
|
|
1106
1110
|
}
|
|
1107
1111
|
async removeGarageDoorService(accessory) {
|
|
1108
1112
|
// If garageDoorService still present, then remove first
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
accessory.
|
|
1113
|
-
|
|
1113
|
+
accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
|
|
1114
|
+
this.GarageDoor = {
|
|
1115
|
+
Name: accessory.context.GarageDoor.Name ?? accessory.displayName,
|
|
1116
|
+
Service: accessory.getService(this.hap.Service.GarageDoorOpener),
|
|
1117
|
+
On: accessory.context.On ?? false,
|
|
1118
|
+
};
|
|
1119
|
+
accessory.context.GarageDoor = this.GarageDoor;
|
|
1120
|
+
await this.warnLog('Removing any leftover Garage Door Service');
|
|
1121
|
+
accessory.removeService(this.GarageDoor.Service);
|
|
1114
1122
|
}
|
|
1115
1123
|
async removeDoorService(accessory) {
|
|
1116
1124
|
// If doorService still present, then remove first
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
accessory.
|
|
1121
|
-
|
|
1125
|
+
accessory.context.Door = accessory.context.Door ?? {};
|
|
1126
|
+
this.Door = {
|
|
1127
|
+
Name: accessory.context.Door.Name ?? accessory.displayName,
|
|
1128
|
+
Service: accessory.getService(this.hap.Service.Door),
|
|
1129
|
+
On: accessory.context.On ?? false,
|
|
1130
|
+
};
|
|
1131
|
+
accessory.context.Door = this.Door;
|
|
1132
|
+
await this.warnLog('Removing any leftover Door Service');
|
|
1133
|
+
accessory.removeService(this.Door.Service);
|
|
1122
1134
|
}
|
|
1123
1135
|
async removeLockService(accessory) {
|
|
1124
1136
|
// If lockService still present, then remove first
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
accessory.
|
|
1129
|
-
|
|
1137
|
+
accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
|
|
1138
|
+
this.LockMechanism = {
|
|
1139
|
+
Name: accessory.context.LockMechanism.Name ?? accessory.displayName,
|
|
1140
|
+
Service: accessory.getService(this.hap.Service.LockMechanism),
|
|
1141
|
+
On: accessory.context.On ?? false,
|
|
1142
|
+
};
|
|
1143
|
+
accessory.context.LockMechanism = this.LockMechanism;
|
|
1144
|
+
this.warnLog('Removing any leftover Lock Service');
|
|
1145
|
+
accessory.removeService(this.LockMechanism.Service);
|
|
1130
1146
|
}
|
|
1131
1147
|
async removeFaucetService(accessory) {
|
|
1132
1148
|
// If faucetService still present, then remove first
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
accessory.
|
|
1137
|
-
|
|
1149
|
+
accessory.context.Faucet = accessory.context.Faucet ?? {};
|
|
1150
|
+
this.Faucet = {
|
|
1151
|
+
Name: accessory.context.Faucet.Name ?? accessory.displayName,
|
|
1152
|
+
Service: accessory.getService(this.hap.Service.Valve),
|
|
1153
|
+
On: accessory.context.On ?? false,
|
|
1154
|
+
};
|
|
1155
|
+
accessory.context.Faucet = this.Faucet;
|
|
1156
|
+
await this.warnLog('Removing any leftover Faucet Service');
|
|
1157
|
+
accessory.removeService(this.Faucet.Service);
|
|
1138
1158
|
}
|
|
1139
1159
|
async removeFanService(accessory) {
|
|
1140
1160
|
// If fanService still present, then remove first
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
accessory.
|
|
1145
|
-
|
|
1161
|
+
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
1162
|
+
this.Fan = {
|
|
1163
|
+
Name: accessory.context.Fan.Name ?? accessory.displayName,
|
|
1164
|
+
Service: accessory.getService(this.hap.Service.Fan),
|
|
1165
|
+
On: accessory.context.On ?? false,
|
|
1166
|
+
};
|
|
1167
|
+
accessory.context.Fan = this.Fan;
|
|
1168
|
+
this.warnLog('Removing any leftover Fan Service');
|
|
1169
|
+
accessory.removeService(this.Fan.Service);
|
|
1146
1170
|
}
|
|
1147
1171
|
async removeWindowService(accessory) {
|
|
1148
1172
|
// If windowService still present, then remove first
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
accessory.
|
|
1153
|
-
|
|
1173
|
+
accessory.context.Window = accessory.context.Window ?? {};
|
|
1174
|
+
this.Window = {
|
|
1175
|
+
Name: accessory.context.Window.Name ?? accessory.displayName,
|
|
1176
|
+
Service: accessory.getService(this.hap.Service.Window),
|
|
1177
|
+
On: accessory.context.On ?? false,
|
|
1178
|
+
};
|
|
1179
|
+
accessory.context.Window = this.Window;
|
|
1180
|
+
await this.warnLog('Removing any leftover Window Service');
|
|
1181
|
+
accessory.removeService(this.Window.Service);
|
|
1154
1182
|
}
|
|
1155
1183
|
async removeWindowCoveringService(accessory) {
|
|
1156
1184
|
// If windowCoveringService still present, then remove first
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
accessory.
|
|
1161
|
-
|
|
1185
|
+
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
1186
|
+
this.WindowCovering = {
|
|
1187
|
+
Name: accessory.context.WindowCovering.Name ?? accessory.displayName,
|
|
1188
|
+
Service: accessory.getService(this.hap.Service.WindowCovering),
|
|
1189
|
+
On: accessory.context.On ?? false,
|
|
1190
|
+
};
|
|
1191
|
+
accessory.context.WindowCovering = this.WindowCovering;
|
|
1192
|
+
await this.warnLog('Removing any leftover Window Covering Service');
|
|
1193
|
+
accessory.removeService(this.WindowCovering.Service);
|
|
1162
1194
|
}
|
|
1163
1195
|
async removeStatefulProgrammableSwitchService(accessory) {
|
|
1164
1196
|
// If statefulProgrammableSwitchService still present, then remove first
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
accessory.
|
|
1169
|
-
|
|
1197
|
+
accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
|
|
1198
|
+
this.StatefulProgrammableSwitch = {
|
|
1199
|
+
Name: accessory.context.StatefulProgrammableSwitch.Name ?? accessory.displayName,
|
|
1200
|
+
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch),
|
|
1201
|
+
On: accessory.context.On ?? false,
|
|
1202
|
+
};
|
|
1203
|
+
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
|
|
1204
|
+
await this.warnLog('Removing any leftover Stateful Programmable Switch Service');
|
|
1205
|
+
accessory.removeService(this.StatefulProgrammableSwitch.Service);
|
|
1170
1206
|
}
|
|
1171
1207
|
async removeSwitchService(accessory) {
|
|
1172
1208
|
// If switchService still present, then remove first
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
accessory.
|
|
1177
|
-
|
|
1209
|
+
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
1210
|
+
this.Switch = {
|
|
1211
|
+
Name: accessory.context.Switch.Name ?? accessory.displayName,
|
|
1212
|
+
Service: accessory.getService(this.hap.Service.Switch),
|
|
1213
|
+
On: accessory.context.On ?? false,
|
|
1214
|
+
};
|
|
1215
|
+
accessory.context.Switch = this.Switch;
|
|
1216
|
+
await this.warnLog('Removing any leftover Switch Service');
|
|
1217
|
+
accessory.removeService(this.Switch.Service);
|
|
1178
1218
|
}
|
|
1179
1219
|
async getOn() {
|
|
1180
1220
|
let On;
|
|
@@ -1264,69 +1304,43 @@ export class Bot extends deviceBase {
|
|
|
1264
1304
|
}
|
|
1265
1305
|
async getBotConfigSettings(device) {
|
|
1266
1306
|
//Bot Device Type
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
this.botDeviceType = this.accessory.context.deviceType;
|
|
1275
|
-
await this.debugWarnLog(`Using Device Type: ${this.botDeviceType}`);
|
|
1276
|
-
}
|
|
1277
|
-
else {
|
|
1278
|
-
this.botDeviceType = 'outlet';
|
|
1279
|
-
await this.errorLog(`No Device Type Set, deviceType: ${this.device.bot?.deviceType}`);
|
|
1280
|
-
await this.warnLog(`Using default deviceType: ${this.botDeviceType}`);
|
|
1281
|
-
}
|
|
1307
|
+
this.botDeviceType = this.accessory.context.botDeviceType === device.bot?.deviceType ? this.accessory.context.botDeviceType
|
|
1308
|
+
: device.bot?.deviceType ?? 'outlet';
|
|
1309
|
+
const botDeviceType = this.accessory.context.botDeviceType ? `Using Device Type: ${this.botDeviceType}, from Accessory Cache.`
|
|
1310
|
+
: device.bot?.deviceType ? `Using Device Type: ${this.botDeviceType}`
|
|
1311
|
+
: `No Device Type Set, deviceType: ${this.device.bot?.deviceType}, Using default deviceType: ${this.botDeviceType}`;
|
|
1312
|
+
await this.debugWarnLog(botDeviceType);
|
|
1313
|
+
this.accessory.context.botDeviceType = this.botDeviceType;
|
|
1282
1314
|
// Bot Mode
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
else if (device.bot?.mode === 'switch') {
|
|
1289
|
-
this.botMode = 'switch';
|
|
1290
|
-
await this.debugLog(`Using Bot Mode: ${this.botMode}`);
|
|
1291
|
-
}
|
|
1292
|
-
else if (device.bot?.mode === 'press') {
|
|
1293
|
-
this.botMode = 'press';
|
|
1294
|
-
await this.debugLog(`Using Bot Mode: ${this.botMode}`);
|
|
1295
|
-
}
|
|
1296
|
-
else if (device.bot?.mode === 'multipress') {
|
|
1297
|
-
this.botMode = 'multipress';
|
|
1298
|
-
await this.debugLog(`Using Bot Mode: ${this.botMode}`);
|
|
1299
|
-
}
|
|
1300
|
-
else {
|
|
1301
|
-
throw new Error(`Bot Mode: ${this.botMode}`);
|
|
1302
|
-
}
|
|
1315
|
+
this.botMode = this.accessory.context.botMode ?? device.bot?.mode ?? 'switch';
|
|
1316
|
+
const botMode = this.accessory.context.botMode ? `Using Bot Mode: ${this.botMode}, from Accessory Cache.`
|
|
1317
|
+
: device.bot?.mode ? `Using Bot Mode: ${this.botMode}` : `No Bot Mode Set, Using default Bot Mode: ${this.botMode}`;
|
|
1318
|
+
await this.debugWarnLog(botMode);
|
|
1319
|
+
this.accessory.context.botMode = this.botMode;
|
|
1303
1320
|
// Bot Double Press
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}
|
|
1321
|
+
this.doublePress = this.accessory.context.doublePress ?? device.bot?.doublePress ?? 1;
|
|
1322
|
+
const doublePress = this.accessory.context.doublePress ? `Using Double Press: ${this.doublePress}, from Accessory Cache.`
|
|
1323
|
+
: device.bot?.doublePress ? `Using Double Press: ${this.doublePress}`
|
|
1324
|
+
: `No Double Press Set, Using default Double Press: ${this.doublePress}`;
|
|
1325
|
+
await this.debugWarnLog(doublePress);
|
|
1326
|
+
this.accessory.context.doublePress = this.doublePress;
|
|
1311
1327
|
// Bot Press PushRate
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
await this.debugLog(`Using Default Bot pushRatePress: ${this.pushRatePress}`);
|
|
1319
|
-
}
|
|
1328
|
+
this.pushRatePress = this.accessory.context.pushRatePress ?? device.bot?.pushRatePress ?? 15;
|
|
1329
|
+
const pushRatePress = this.accessory.context.pushRatePress ? `Using Push Rate Press: ${this.pushRatePress}, from Accessory Cache.`
|
|
1330
|
+
: device.bot?.pushRatePress ? `Using Bot Push Rate Press: ${this.pushRatePress}`
|
|
1331
|
+
: `No Push Rate Press Set, Using default Push Rate Press: ${this.pushRatePress}`;
|
|
1332
|
+
await this.debugWarnLog(pushRatePress);
|
|
1333
|
+
this.accessory.context.pushRatePress = this.pushRatePress;
|
|
1320
1334
|
// Bot Allow Push
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
await this.debugLog(`Allowing Push Changes: ${this.allowPush}`);
|
|
1335
|
+
this.allowPush = this.accessory.context.allowPush ?? device.bot?.allowPush ?? false;
|
|
1336
|
+
const allowPush = this.accessory.context.allowPush ? `Using Allow Push: ${this.allowPush}, from Accessory Cache.`
|
|
1337
|
+
: device.bot?.allowPush ? `Using Allow Push: ${this.allowPush}`
|
|
1338
|
+
: `No Allow Push Set, Using default Allow Push: ${this.allowPush}`;
|
|
1339
|
+
await this.debugWarnLog(allowPush);
|
|
1340
|
+
this.accessory.context.allowPush = this.allowPush;
|
|
1328
1341
|
// Bot Multi Press Count
|
|
1329
1342
|
this.multiPressCount = 0;
|
|
1343
|
+
await this.debugWarnLog(`Multi Press Count: ${this.multiPressCount}`);
|
|
1330
1344
|
}
|
|
1331
1345
|
async BLEPushConnection() {
|
|
1332
1346
|
if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
|