@switchbot/homebridge-switchbot 3.8.3 → 4.0.0-beta.1

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.
Files changed (205) hide show
  1. package/.github/npm-version-script.cjs +81 -0
  2. package/.github/workflows/beta-release.yml +12 -4
  3. package/CHANGELOG.md +15 -1
  4. package/config.schema.json +583 -937
  5. package/dist/device/blindtilt.d.ts +1 -4
  6. package/dist/device/blindtilt.d.ts.map +1 -1
  7. package/dist/device/blindtilt.js +68 -66
  8. package/dist/device/blindtilt.js.map +1 -1
  9. package/dist/device/bot.d.ts +1 -4
  10. package/dist/device/bot.d.ts.map +1 -1
  11. package/dist/device/bot.js +63 -59
  12. package/dist/device/bot.js.map +1 -1
  13. package/dist/device/ceilinglight.d.ts +1 -4
  14. package/dist/device/ceilinglight.d.ts.map +1 -1
  15. package/dist/device/ceilinglight.js +56 -65
  16. package/dist/device/ceilinglight.js.map +1 -1
  17. package/dist/device/colorbulb.d.ts +1 -4
  18. package/dist/device/colorbulb.d.ts.map +1 -1
  19. package/dist/device/colorbulb.js +73 -80
  20. package/dist/device/colorbulb.js.map +1 -1
  21. package/dist/device/contact.d.ts +1 -4
  22. package/dist/device/contact.d.ts.map +1 -1
  23. package/dist/device/contact.js +38 -38
  24. package/dist/device/contact.js.map +1 -1
  25. package/dist/device/curtain.d.ts +1 -4
  26. package/dist/device/curtain.d.ts.map +1 -1
  27. package/dist/device/curtain.js +60 -60
  28. package/dist/device/curtain.js.map +1 -1
  29. package/dist/device/device.d.ts +6 -6
  30. package/dist/device/device.d.ts.map +1 -1
  31. package/dist/device/device.js +86 -20
  32. package/dist/device/device.js.map +1 -1
  33. package/dist/device/fan.d.ts +1 -4
  34. package/dist/device/fan.d.ts.map +1 -1
  35. package/dist/device/fan.js +50 -51
  36. package/dist/device/fan.js.map +1 -1
  37. package/dist/device/hub.d.ts +1 -4
  38. package/dist/device/hub.d.ts.map +1 -1
  39. package/dist/device/hub.js +48 -48
  40. package/dist/device/hub.js.map +1 -1
  41. package/dist/device/humidifier.d.ts +1 -4
  42. package/dist/device/humidifier.d.ts.map +1 -1
  43. package/dist/device/humidifier.js +53 -55
  44. package/dist/device/humidifier.js.map +1 -1
  45. package/dist/device/iosensor.d.ts +1 -4
  46. package/dist/device/iosensor.d.ts.map +1 -1
  47. package/dist/device/iosensor.js +35 -35
  48. package/dist/device/iosensor.js.map +1 -1
  49. package/dist/device/lightstrip.d.ts +1 -4
  50. package/dist/device/lightstrip.d.ts.map +1 -1
  51. package/dist/device/lightstrip.js +57 -65
  52. package/dist/device/lightstrip.js.map +1 -1
  53. package/dist/device/lock.d.ts +1 -4
  54. package/dist/device/lock.d.ts.map +1 -1
  55. package/dist/device/lock.js +38 -39
  56. package/dist/device/lock.js.map +1 -1
  57. package/dist/device/meter.d.ts +1 -4
  58. package/dist/device/meter.d.ts.map +1 -1
  59. package/dist/device/meter.js +35 -35
  60. package/dist/device/meter.js.map +1 -1
  61. package/dist/device/meterplus.d.ts +1 -4
  62. package/dist/device/meterplus.d.ts.map +1 -1
  63. package/dist/device/meterplus.js +35 -35
  64. package/dist/device/meterplus.js.map +1 -1
  65. package/dist/device/motion.d.ts +1 -4
  66. package/dist/device/motion.d.ts.map +1 -1
  67. package/dist/device/motion.js +27 -27
  68. package/dist/device/motion.js.map +1 -1
  69. package/dist/device/plug.d.ts +1 -4
  70. package/dist/device/plug.d.ts.map +1 -1
  71. package/dist/device/plug.js +32 -32
  72. package/dist/device/plug.js.map +1 -1
  73. package/dist/device/robotvacuumcleaner.d.ts +1 -4
  74. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  75. package/dist/device/robotvacuumcleaner.js +39 -40
  76. package/dist/device/robotvacuumcleaner.js.map +1 -1
  77. package/dist/device/waterdetector.d.ts +1 -4
  78. package/dist/device/waterdetector.d.ts.map +1 -1
  79. package/dist/device/waterdetector.js +28 -28
  80. package/dist/device/waterdetector.js.map +1 -1
  81. package/dist/irdevice/airconditioner.d.ts +1 -1
  82. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  83. package/dist/irdevice/airconditioner.js +31 -32
  84. package/dist/irdevice/airconditioner.js.map +1 -1
  85. package/dist/irdevice/airpurifier.d.ts +1 -1
  86. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  87. package/dist/irdevice/airpurifier.js +11 -12
  88. package/dist/irdevice/airpurifier.js.map +1 -1
  89. package/dist/irdevice/camera.d.ts +1 -1
  90. package/dist/irdevice/camera.d.ts.map +1 -1
  91. package/dist/irdevice/camera.js +9 -10
  92. package/dist/irdevice/camera.js.map +1 -1
  93. package/dist/irdevice/fan.d.ts +1 -1
  94. package/dist/irdevice/fan.d.ts.map +1 -1
  95. package/dist/irdevice/fan.js +22 -23
  96. package/dist/irdevice/fan.js.map +1 -1
  97. package/dist/irdevice/irdevice.d.ts +6 -6
  98. package/dist/irdevice/irdevice.d.ts.map +1 -1
  99. package/dist/irdevice/irdevice.js +28 -14
  100. package/dist/irdevice/irdevice.js.map +1 -1
  101. package/dist/irdevice/light.d.ts +1 -1
  102. package/dist/irdevice/light.d.ts.map +1 -1
  103. package/dist/irdevice/light.js +12 -13
  104. package/dist/irdevice/light.js.map +1 -1
  105. package/dist/irdevice/other.d.ts +1 -1
  106. package/dist/irdevice/other.d.ts.map +1 -1
  107. package/dist/irdevice/other.js +12 -15
  108. package/dist/irdevice/other.js.map +1 -1
  109. package/dist/irdevice/tv.d.ts +1 -1
  110. package/dist/irdevice/tv.d.ts.map +1 -1
  111. package/dist/irdevice/tv.js +27 -28
  112. package/dist/irdevice/tv.js.map +1 -1
  113. package/dist/irdevice/vacuumcleaner.d.ts +1 -1
  114. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  115. package/dist/irdevice/vacuumcleaner.js +9 -10
  116. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  117. package/dist/irdevice/waterheater.d.ts +1 -1
  118. package/dist/irdevice/waterheater.d.ts.map +1 -1
  119. package/dist/irdevice/waterheater.js +9 -10
  120. package/dist/irdevice/waterheater.js.map +1 -1
  121. package/dist/platform.d.ts +9 -22
  122. package/dist/platform.d.ts.map +1 -1
  123. package/dist/platform.js +154 -260
  124. package/dist/platform.js.map +1 -1
  125. package/dist/settings.d.ts +64 -82
  126. package/dist/settings.d.ts.map +1 -1
  127. package/dist/settings.js +0 -20
  128. package/dist/settings.js.map +1 -1
  129. package/dist/utils.d.ts +1 -102
  130. package/dist/utils.d.ts.map +1 -1
  131. package/dist/utils.js +0 -105
  132. package/dist/utils.js.map +1 -1
  133. package/docs/assets/highlight.css +42 -0
  134. package/docs/assets/main.js +1 -1
  135. package/docs/functions/default.html +1 -1
  136. package/docs/index.html +61 -50
  137. package/docs/media/security-privacy-bluetooth.png +0 -0
  138. package/package.json +5 -7
  139. package/src/device/blindtilt.ts +74 -74
  140. package/src/device/bot.ts +68 -67
  141. package/src/device/ceilinglight.ts +59 -70
  142. package/src/device/colorbulb.ts +79 -88
  143. package/src/device/contact.ts +40 -43
  144. package/src/device/curtain.ts +66 -68
  145. package/src/device/device.ts +86 -40
  146. package/src/device/fan.ts +52 -56
  147. package/src/device/hub.ts +50 -53
  148. package/src/device/humidifier.ts +56 -61
  149. package/src/device/iosensor.ts +37 -40
  150. package/src/device/lightstrip.ts +62 -72
  151. package/src/device/lock.ts +41 -45
  152. package/src/device/meter.ts +37 -40
  153. package/src/device/meterplus.ts +37 -40
  154. package/src/device/motion.ts +29 -32
  155. package/src/device/plug.ts +34 -37
  156. package/src/device/robotvacuumcleaner.ts +41 -49
  157. package/src/device/waterdetector.ts +30 -33
  158. package/src/irdevice/airconditioner.ts +33 -35
  159. package/src/irdevice/airpurifier.ts +12 -13
  160. package/src/irdevice/camera.ts +10 -11
  161. package/src/irdevice/fan.ts +24 -25
  162. package/src/irdevice/irdevice.ts +31 -27
  163. package/src/irdevice/light.ts +14 -15
  164. package/src/irdevice/other.ts +14 -17
  165. package/src/irdevice/tv.ts +28 -29
  166. package/src/irdevice/vacuumcleaner.ts +10 -11
  167. package/src/irdevice/waterheater.ts +10 -11
  168. package/src/platform.ts +178 -287
  169. package/src/settings.ts +67 -88
  170. package/src/utils.ts +2 -106
  171. package/dist/types/bledevicestatus.d.ts +0 -281
  172. package/dist/types/bledevicestatus.d.ts.map +0 -1
  173. package/dist/types/bledevicestatus.js +0 -2
  174. package/dist/types/bledevicestatus.js.map +0 -1
  175. package/dist/types/devicelist.d.ts +0 -89
  176. package/dist/types/devicelist.d.ts.map +0 -1
  177. package/dist/types/devicelist.js +0 -6
  178. package/dist/types/devicelist.js.map +0 -1
  179. package/dist/types/deviceresponse.d.ts +0 -13
  180. package/dist/types/deviceresponse.d.ts.map +0 -1
  181. package/dist/types/deviceresponse.js +0 -2
  182. package/dist/types/deviceresponse.js.map +0 -1
  183. package/dist/types/devicestatus.d.ts +0 -149
  184. package/dist/types/devicestatus.d.ts.map +0 -1
  185. package/dist/types/devicestatus.js +0 -3
  186. package/dist/types/devicestatus.js.map +0 -1
  187. package/dist/types/devicewebhookstatus.d.ts +0 -156
  188. package/dist/types/devicewebhookstatus.d.ts.map +0 -1
  189. package/dist/types/devicewebhookstatus.js +0 -2
  190. package/dist/types/devicewebhookstatus.js.map +0 -1
  191. package/dist/types/irdevicelist.d.ts +0 -10
  192. package/dist/types/irdevicelist.d.ts.map +0 -1
  193. package/dist/types/irdevicelist.js +0 -2
  194. package/dist/types/irdevicelist.js.map +0 -1
  195. package/dist/types/pushbody.d.ts +0 -6
  196. package/dist/types/pushbody.d.ts.map +0 -1
  197. package/dist/types/pushbody.js +0 -2
  198. package/dist/types/pushbody.js.map +0 -1
  199. package/src/types/bledevicestatus.ts +0 -303
  200. package/src/types/devicelist.ts +0 -124
  201. package/src/types/deviceresponse.ts +0 -14
  202. package/src/types/devicestatus.ts +0 -178
  203. package/src/types/devicewebhookstatus.ts +0 -191
  204. package/src/types/irdevicelist.ts +0 -15
  205. package/src/types/pushbody.ts +0 -9
@@ -0,0 +1,81 @@
1
+ #!/bin/env node
2
+
3
+ /**
4
+ * This scripts queries the npm registry to pull out the latest version for a given tag.
5
+ */
6
+
7
+ const fs = require("fs");
8
+ const semver = require("semver");
9
+ const child_process = require("child_process");
10
+ const assert = require("assert");
11
+
12
+ const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
13
+
14
+ // Load the contents of the package.json file
15
+ const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
16
+
17
+ let refArgument = process.argv[2];
18
+ let tagArgument = process.argv[3] || "latest";
19
+
20
+ if (refArgument == null) {
21
+ console.error("ref argument is missing");
22
+ console.error("Usage: npm-version-script.cjs <ref> [tag]");
23
+ process.exit(1);
24
+ }
25
+
26
+ /**
27
+ * Queries the NPM registry for the latest version for the provided tag.
28
+ * @param tag The tag to query for.
29
+ * @returns {string} Returns the version.
30
+ */
31
+ function getTagVersionFromNpm(tag) {
32
+ try {
33
+ return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
34
+ } catch (e) {
35
+ throw e;
36
+ }
37
+ }
38
+
39
+ function desiredTargetVersion(ref) {
40
+ // ref is a GitHub action ref string
41
+ if (ref.startsWith("refs/pull/")) {
42
+ throw Error("The version script was executed inside a PR!");
43
+ }
44
+
45
+ assert(ref.startsWith("refs/heads/"))
46
+ let branchName = ref.slice("refs/heads/".length);
47
+
48
+ let results = branchName.match(BRANCH_VERSION_PATTERN);
49
+ if (results != null) {
50
+ if (results[1] !== tagArgument) {
51
+ console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
52
+ }
53
+
54
+ return results[2];
55
+ }
56
+
57
+ // legacy mode were we use the `betaVersion` property in the package.json
58
+ if (branchName === "beta" && packageJSON.betaVersion) {
59
+ return packageJSON.betaVersion
60
+ }
61
+
62
+ throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
63
+ }
64
+
65
+ // derive the base version from the branch ref
66
+ const baseVersion = desiredTargetVersion(refArgument);
67
+
68
+ // query the npm registry for the latest version of the provided tag name
69
+ const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
70
+ const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
71
+
72
+ let publishTag;
73
+ if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
74
+ publishTag = latestReleasedVersion; // set the current latest beta to be incremented
75
+ } else {
76
+ publishTag = baseVersion; // start of with a new beta version
77
+ }
78
+
79
+ // save the package.json
80
+ packageJSON.version = publishTag;
81
+ fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
@@ -3,8 +3,6 @@ name: Node-CI Beta
3
3
  on:
4
4
  push:
5
5
  branches: [beta-*.*.*, beta]
6
- release:
7
- types: [prereleased]
8
6
  workflow_dispatch:
9
7
 
10
8
  jobs:
@@ -14,15 +12,14 @@ jobs:
14
12
  enable_coverage: true
15
13
  secrets:
16
14
  token: ${{ secrets.GITHUB_TOKEN }}
15
+
17
16
  lint:
18
17
  needs: build_and_test
19
18
  uses: OpenWonderLabs/.github/.github/workflows/eslint.yml@latest
20
19
 
21
20
  publish:
22
21
  needs: lint
23
-
24
22
  if: ${{ github.repository == 'OpenWonderLabs/homebridge-switchbot' }}
25
-
26
23
  uses: OpenWonderLabs/.github/.github/workflows/npm-publish.yml@latest
27
24
  with:
28
25
  tag: 'beta'
@@ -32,6 +29,17 @@ jobs:
32
29
  secrets:
33
30
  npm_auth_token: ${{ secrets.npm_token }}
34
31
 
32
+ pre-release:
33
+ needs: publish
34
+ if: ${{ github.repository == 'OpenWonderLabs/homebridge-switchbot' }}
35
+ uses: OpenWonderLabs/.github/.github/workflows/pre-release.yml@latest
36
+ with:
37
+ npm_version: ${{ needs.publish.outputs.NPM_VERSION }}
38
+ body: |
39
+ **Beta Release**
40
+ **Version**: v${{ needs.publish.outputs.NPM_VERSION }}
41
+ [How To Test Beta Releases](https://github.com/OpenWonderLabs/homebridge-switchbot/wiki/Beta-Version)
42
+
35
43
  github-releases-to-discord:
36
44
  name: Discord Webhooks
37
45
  needs: [build_and_test,publish]
package/CHANGELOG.md CHANGED
@@ -2,11 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
4
4
 
5
+ ## [4.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v4.0.0) (2024-10-XX)
6
+
7
+ ### What's Changed
8
+ #### ⚠️ Breaking Changes
9
+ - OpenAPI is now support by Version [3.0.0](https://github.com/OpenWonderLabs/node-switchbot/releases/latest) of [`node-switchbot`](https://github.com/OpenWonderLabs/node-switchbot), so made changes to refect that.
10
+ - Moved all device specific configs to all the same levels to elimate the use of multiple of the same config.
11
+ - **If you have config set for any of the following SwitchBot device Types: `Curtain`, `Blind Tilt`, `Color Bulb`, `Strip Light`, `Hub`, `Meter`, `Meter Plus`, `Humidifier`, `Contact Sensor`, `Motion Sensor`, `Water Detector`, `Ceiling Light`, or `Lock`; you will need to re-setup your config for that deviceId**
12
+ - **If you have config set for any of the following IR device Types: `Fan`, `DIY Fan`, `Light`, `DIY Light`, `Air Conditioner`, `DIY Air Conditioner`, or `Others`; you will need to re-setup your config for that deviceId**
13
+
14
+ #### Other Changes
15
+ - Housekeeping and updated dependencies.
16
+
17
+ **Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.3...v4.0.0
18
+
5
19
  ## [3.8.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.8.3) (2024-10-09)
6
20
 
7
21
  ### What's Changed
8
22
  - Fix incorrect handling of openState in Contact Sensor [#1061](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1061), Thanks [@nzws](https://github.com/nzws)
9
- - Fix light level stuck at ma [#1066](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1066), Thanks [@4gra](https://github.com/4gra)
23
+ - Fix light level stuck at max [#1066](https://github.com/OpenWonderLabs/homebridge-switchbot/pull/1066), Thanks [@4gra](https://github.com/4gra)
10
24
  - Housekeeping and updated dependencies.
11
25
 
12
26
  **Full Changelog**: https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.2...v3.8.3