@switchbot/homebridge-switchbot 5.4.1-beta.1 → 5.4.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.
package/README.md CHANGED
@@ -24,6 +24,33 @@
24
24
 
25
25
  ## Configuration
26
26
 
27
+ - ### If using OpenAPI Connection
28
+ 1. Download SwitchBot App on App Store or Google Play Store
29
+ 2. Register a SwitchBot account and log in into your account
30
+ 3. Generate an Token within the App
31
+ - Click Bottom Profile Tab
32
+ - Click Preference
33
+ - Click App version 10 Times, this will enable Developer Options
34
+ - Click Developer Options
35
+ - Click Copy `token` to Clipboard
36
+ 4. Input your `token` into the config parameter
37
+ 5. Generate an Secret within the App
38
+ - Click Bottom Profile Tab
39
+ - Click Preference
40
+ - Click App version 10 Times, this will enable Developer Options
41
+ - Click Developer Options
42
+ - Click Copy `secret` to Clipboard
43
+ 6. Input your `secret` into the config parameter
44
+ - ### If using BLE Connection
45
+ 1. Download SwitchBot App on App Store or Google Play Store
46
+ 2. Register a SwitchBot account and log in into your account
47
+ 3. Click on Device wanting to connect too plugin
48
+ - Click the Settings Gear
49
+ - Click Device Info
50
+ - Copy BLE Mac aka `deviceId`
51
+ 4. Input your `deviceId` into the Device Config
52
+
53
+
27
54
  ### OpenAPI Polling/Rate Advanced Settings (UI)
28
55
 
29
56
  You can now configure global OpenAPI polling and rate-limiting options directly from the Homebridge UI:
package/docs/index.html CHANGED
@@ -29,6 +29,50 @@
29
29
  <li>Click <strong>Install</strong></li>
30
30
  </ol>
31
31
  <h2 id="configuration" class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2>
32
+ <ul>
33
+ <li>
34
+ <h3 id="if-using-openapi-connection" class="tsd-anchor-link">If using OpenAPI Connection<a href="#if-using-openapi-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
35
+ <ol>
36
+ <li>Download SwitchBot App on App Store or Google Play Store</li>
37
+ <li>Register a SwitchBot account and log in into your account</li>
38
+ <li>Generate an Token within the App
39
+ <ul>
40
+ <li>Click Bottom Profile Tab</li>
41
+ <li>Click Preference</li>
42
+ <li>Click App version 10 Times, this will enable Developer Options</li>
43
+ <li>Click Developer Options</li>
44
+ <li>Click Copy <code>token</code> to Clipboard</li>
45
+ </ul>
46
+ </li>
47
+ <li>Input your <code>token</code> into the config parameter</li>
48
+ <li>Generate an Secret within the App
49
+ <ul>
50
+ <li>Click Bottom Profile Tab</li>
51
+ <li>Click Preference</li>
52
+ <li>Click App version 10 Times, this will enable Developer Options</li>
53
+ <li>Click Developer Options</li>
54
+ <li>Click Copy <code>secret</code> to Clipboard</li>
55
+ </ul>
56
+ </li>
57
+ <li>Input your <code>secret</code> into the config parameter</li>
58
+ </ol>
59
+ </li>
60
+ <li>
61
+ <h3 id="if-using-ble-connection" class="tsd-anchor-link">If using BLE Connection<a href="#if-using-ble-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
62
+ <ol>
63
+ <li>Download SwitchBot App on App Store or Google Play Store</li>
64
+ <li>Register a SwitchBot account and log in into your account</li>
65
+ <li>Click on Device wanting to connect too plugin
66
+ <ul>
67
+ <li>Click the Settings Gear</li>
68
+ <li>Click Device Info</li>
69
+ <li>Copy BLE Mac aka <code>deviceId</code></li>
70
+ </ul>
71
+ </li>
72
+ <li>Input your <code>deviceId</code> into the Device Config</li>
73
+ </ol>
74
+ </li>
75
+ </ul>
32
76
  <h3 id="openapi-pollingrate-advanced-settings-ui" class="tsd-anchor-link">OpenAPI Polling/Rate Advanced Settings (UI)<a href="#openapi-pollingrate-advanced-settings-ui" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
33
77
  <p>You can now configure global OpenAPI polling and rate-limiting options directly from the Homebridge UI:</p>
34
78
  <ul>
@@ -52,7 +96,7 @@
52
96
  <!-- Optionally add a screenshot here -->
53
97
  <ul>
54
98
  <li>
55
- <h3 id="if-using-openapi-connection" class="tsd-anchor-link">If using OpenAPI Connection<a href="#if-using-openapi-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
99
+ <h3 id="if-using-openapi-connection-1" class="tsd-anchor-link">If using OpenAPI Connection<a href="#if-using-openapi-connection-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
56
100
  <ol>
57
101
  <li>Download SwitchBot App on App Store or Google Play Store</li>
58
102
  <li>Register a SwitchBot account and log in into your account</li>
@@ -79,7 +123,7 @@
79
123
  </ol>
80
124
  </li>
81
125
  <li>
82
- <h3 id="if-using-ble-connection" class="tsd-anchor-link">If using BLE Connection<a href="#if-using-ble-connection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
126
+ <h3 id="if-using-ble-connection-1" class="tsd-anchor-link">If using BLE Connection<a href="#if-using-ble-connection-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>
83
127
  <ol>
84
128
  <li>Download SwitchBot App on App Store or Google Play Store</li>
85
129
  <li>Register a SwitchBot account and log in into your account</li>
@@ -558,9 +602,11 @@ Without this step, then you will receive the following error when the swichbot p
558
602
  <li><a href="#configuration"><span>Configuration</span></a></li>
559
603
  <li>
560
604
  <ul>
561
- <li><a href="#openapi-pollingrate-advanced-settings-ui"><span>Open<wbr/>API <wbr/>Polling/<wbr/>Rate <wbr/>Advanced <wbr/>Settings (<wbr/>UI)</span></a></li>
562
605
  <li><a href="#if-using-openapi-connection"><span>If using <wbr/>Open<wbr/>API <wbr/>Connection</span></a></li>
563
- <li><a href="#if-using-ble-connection"><span>If using <wbr/>BLE <wbr/>Connection</span></a></li></ul></li>
606
+ <li><a href="#if-using-ble-connection"><span>If using <wbr/>BLE <wbr/>Connection</span></a></li>
607
+ <li><a href="#openapi-pollingrate-advanced-settings-ui"><span>Open<wbr/>API <wbr/>Polling/<wbr/>Rate <wbr/>Advanced <wbr/>Settings (<wbr/>UI)</span></a></li>
608
+ <li><a href="#if-using-openapi-connection-1"><span>If using <wbr/>Open<wbr/>API <wbr/>Connection</span></a></li>
609
+ <li><a href="#if-using-ble-connection-1"><span>If using <wbr/>BLE <wbr/>Connection</span></a></li></ul></li>
564
610
  <li><a href="#troubleshooting"><span>Troubleshooting</span></a></li>
565
611
  <li>
566
612
  <ul>
@@ -28,7 +28,7 @@
28
28
  </div></li></ul></div>
29
29
  <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
30
30
  <ul>
31
- <li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/0e9b88ebdffe7667f1b2d029f9785832e3a892c2/src/index.ts#L23">index.ts:23</a></li></ul></aside></div>
31
+ <li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/d617933f74e48baac9424882bd875793703b7c49/src/index.ts#L23">index.ts:23</a></li></ul></aside></div>
32
32
  <div class="col-sidebar">
33
33
  <div class="page-menu">
34
34
  <div class="tsd-navigation settings">
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@switchbot/homebridge-switchbot",
3
3
  "displayName": "SwitchBot",
4
4
  "type": "module",
5
- "version": "5.4.1-beta.1",
5
+ "version": "5.4.1",
6
6
  "description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
7
7
  "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
8
8
  "contributors": [
@@ -93,7 +93,7 @@
93
93
  "dependencies": {
94
94
  "@homebridge/plugin-ui-utils": "^2.2.6",
95
95
  "class-validator": "^0.15.1",
96
- "node-switchbot": "^6.1.1"
96
+ "node-switchbot": "^6.1.2"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@antfu/eslint-config": "^10.0.0",
@@ -1,103 +0,0 @@
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
- import assert from 'node:assert'
8
- import child_process from 'node:child_process'
9
- import fs from 'node:fs'
10
- import process from 'node:process'
11
-
12
- const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
13
-
14
- // Load the contents of the package.json file
15
- const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
16
-
17
- const refArgument = process.argv[2]
18
- const tagArgument = process.argv[3] || 'latest'
19
-
20
- if (!refArgument) {
21
- console.error('ref argument is missing')
22
- console.error('Usage: npm-version-script-esm.js <ref> [tag]')
23
- process.exit(1)
24
- }
25
-
26
- /**
27
- * Queries the NPM registry for the latest version for the provided base version and tag.
28
- * If the tag is latest, then the base version is returned if it exists. For other tags, the latest
29
- * version found for that base version and tag is returned.
30
- * @param baseVersion The base version to query for, e.g. 2.0.0
31
- * @param tag The tag to query for, e.g. beta or latest
32
- * @returns {string} Returns the version, or '' if not found
33
- */
34
- function getTagVersionFromNpm(baseVersion, tag) {
35
- try {
36
- return JSON.parse(child_process.execSync(`npm info ${packageJSON.name} versions --json`).toString('utf8').trim())
37
- // find all published versions for this base version and tag
38
- .filter(v => tag === 'latest'
39
- ? v === baseVersion
40
- : v.startsWith(`${baseVersion}-${tag}.`))
41
- .reduce((_, current) => current, '') // choose the last as they're sorted in ascending order, or '' if there are none
42
- } catch (e) {
43
- console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
44
- // throw e;
45
- return ''
46
- }
47
- }
48
-
49
- function desiredTargetVersion(ref) {
50
- // ref is a GitHub action ref string
51
- if (ref.startsWith('refs/pull/')) {
52
- throw new Error('The version script was executed inside a PR!')
53
- }
54
-
55
- assert(ref.startsWith('refs/heads/'))
56
- const branchName = ref.slice('refs/heads/'.length)
57
-
58
- const results = branchName.match(BRANCH_VERSION_PATTERN)
59
- if (results !== null) {
60
- if (results[1] !== tagArgument) {
61
- console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
62
- }
63
-
64
- return results[2]
65
- }
66
-
67
- throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
68
- }
69
-
70
- // derive the base version from the branch ref
71
- const baseVersion = desiredTargetVersion(refArgument)
72
-
73
- // query the npm registry for the latest version of the provided tag name
74
- const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
75
-
76
- let publishTag
77
-
78
- if (latestReleasedVersion) {
79
- console.warn(`Latest published version for ${baseVersion} with tag ${tagArgument} is ${latestReleasedVersion}`)
80
- publishTag = latestReleasedVersion // set this released beta or alpha to be incremented
81
- } else {
82
- console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
83
- publishTag = baseVersion // start off with a new beta or alpha version
84
- }
85
-
86
- if (packageJSON.version !== publishTag) {
87
- // report the change for CI
88
- console.warn(`Changing version in package.json from ${packageJSON.version} to ${publishTag}`)
89
-
90
- // save the package.json
91
- // JSON.stringify does not end with a newline, but npm writes both of these
92
- // files with one. Leaving it off makes the file fail an eol-last lint rule,
93
- // which breaks any repo whose prepublishOnly lints the whole tree.
94
- packageJSON.version = publishTag
95
- fs.writeFileSync('package.json', `${JSON.stringify(packageJSON, null, 2)}\n`)
96
-
97
- // perform the same change to the package-lock.json
98
- const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
99
- packageLockJSON.version = publishTag
100
- fs.writeFileSync('package-lock.json', `${JSON.stringify(packageLockJSON, null, 2)}\n`)
101
- } else {
102
- console.warn(`Leaving version in package.json at ${packageJSON.version}`)
103
- }