@homebridge-plugins/homebridge-ewelink 12.18.0-beta.2 → 12.18.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/CHANGELOG.md CHANGED
@@ -2,13 +2,27 @@
2
2
 
3
3
  All notable changes to `@homebridge-plugins/homebridge-ewelink` will be documented in this file.
4
4
 
5
- ## v12.18.0 (Pending Release)
5
+ ## v12.18.1 (2026-08-02)
6
+
7
+ ### Changed
8
+
9
+ - chore: add a test setup with tests for the shared helper functions
10
+ - chore(github): run the build and tests in ci, on node 22, 24 and 26
11
+ - chore: use the same lint setup across every plugin
12
+ - chore: add a changelog:sync script to populate the pending section from the commits
13
+ - chore: count a repeated commit subject once when syncing the changelog
14
+ - chore(github): check the changelog against the commits in ci
15
+ - chore(deps): dependency updates
16
+ - docs: add node 26 to the supported node versions
17
+
18
+ ## v12.18.0 (2026-07-27)
6
19
 
7
20
  ### Changed
8
21
 
9
22
  - feat(ui): add a remove all devices action to the my devices tab
10
23
  - fix(schema): declare required fields the standard way so the homebridge ui stops reporting a config validation failure
11
24
  - chore: declare the supports-hap transport keyword for the homebridge ui
25
+ - chore(deps): dependency updates
12
26
 
13
27
  ## v12.17.0 (2026-07-25)
14
28
 
package/README.md CHANGED
@@ -27,7 +27,7 @@ Homebridge plugin to integrate eWeLink devices into HomeKit
27
27
  ### Prerequisites
28
28
 
29
29
  - To use this plugin, you will need to already have:
30
- - [Node](https://nodejs.org): latest version of `v22` or `v24` - any other major version is not supported.
30
+ - [Node](https://nodejs.org): latest version of `v22`, `v24` or `v26` - any other major version is not supported.
31
31
  - [Homebridge](https://homebridge.io): `v1.6` or above - refer to link for more information and installation instructions.
32
32
 
33
33
  ### Setup
@@ -218,7 +218,7 @@
218
218
  <ul>
219
219
  <li>To use this plugin, you will need to already have:</li>
220
220
  <ul>
221
- <li><a href="https://nodejs.org" target="_blank">Node</a>: latest version of <code>v22</code> or <code>v24</code> - any other major version is not supported.</li>
221
+ <li><a href="https://nodejs.org" target="_blank">Node</a>: latest version of <code>v22</code>, <code>v24</code> or <code>v26</code> - any other major version is not supported.</li>
222
222
  <li><a href="https://homebridge.io" target="_blank">Homebridge</a>: <code>v1.6</code> or above - refer to link for more information and installation instructions.</li>
223
223
  </ul>
224
224
  </ul>
@@ -0,0 +1,77 @@
1
+ import { describe, expect, it } from 'vitest'
2
+
3
+ import { generateRandomString, hasProperty, parseDeviceId, parseError } from './functions.js'
4
+
5
+ describe('parseDeviceId', () => {
6
+ it('strips punctuation and spacing users paste in from the app', () => {
7
+ expect(parseDeviceId('10:00:ab:cd')).toBe('1000abcd')
8
+ expect(parseDeviceId(' 1000abcd ')).toBe('1000abcd')
9
+ expect(parseDeviceId('1000-abcd')).toBe('1000abcd')
10
+ })
11
+
12
+ it('lowercases the id, so matching is not case sensitive', () => {
13
+ expect(parseDeviceId('1000ABCD')).toBe('1000abcd')
14
+ })
15
+
16
+ it('restores the SW marker, which is uppercase in a real device id', () => {
17
+ // ⚠️ Deliberately documenting the current behaviour rather than asserting
18
+ // it is ideal: the id is lowercased first, then the FIRST "sw" is put back
19
+ // to uppercase. A second occurrence is left lowercase.
20
+ expect(parseDeviceId('SW123')).toBe('SW123')
21
+ expect(parseDeviceId('sw123')).toBe('SW123')
22
+ expect(parseDeviceId('swsw')).toBe('SWsw')
23
+ })
24
+
25
+ it('accepts an id that is already clean', () => {
26
+ expect(parseDeviceId('1000abcd')).toBe('1000abcd')
27
+ })
28
+ })
29
+
30
+ describe('generateRandomString', () => {
31
+ it('returns the requested length', () => {
32
+ expect(generateRandomString(16)).toHaveLength(16)
33
+ })
34
+
35
+ it('uses only lowercase letters and digits', () => {
36
+ expect(generateRandomString(200)).toMatch(/^[a-z0-9]+$/)
37
+ })
38
+
39
+ it('does not return the same value twice in a row', () => {
40
+ expect(generateRandomString(32)).not.toBe(generateRandomString(32))
41
+ })
42
+ })
43
+
44
+ describe('hasProperty', () => {
45
+ it('detects own properties, including ones set to undefined', () => {
46
+ // Device payloads regularly carry a key with no value, and that is
47
+ // different from the key being absent.
48
+ expect(hasProperty({ switch: undefined }, 'switch')).toBe(true)
49
+ expect(hasProperty({}, 'switch')).toBe(false)
50
+ })
51
+
52
+ it('ignores inherited properties', () => {
53
+ expect(hasProperty({}, 'toString')).toBe(false)
54
+ })
55
+ })
56
+
57
+ describe('parseError', () => {
58
+ it('appends the first stack frame to the message', () => {
59
+ const err = new Error('boom')
60
+ err.stack = 'Error: boom\n at thing (/a.js:1:1)'
61
+ expect(parseError(err)).toBe('boom at thing (/a.js:1:1)')
62
+ })
63
+
64
+ it('hides the stack for errors the caller expects', () => {
65
+ // The ACK timeout family (#773/#779) is noisy and routine, so those are
66
+ // logged without a stack.
67
+ const err = new Error('timeout')
68
+ err.stack = 'Error: timeout\n at thing (/a.js:1:1)'
69
+ expect(parseError(err, ['timeout'])).toBe('timeout')
70
+ })
71
+
72
+ it('returns the message when there is no stack', () => {
73
+ const err = new Error('nostack')
74
+ err.stack = ''
75
+ expect(parseError(err)).toBe('nostack')
76
+ })
77
+ })
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "Homebridge eWeLink",
4
4
  "alias": "eWeLink",
5
5
  "type": "module",
6
- "version": "12.18.0-beta.2",
6
+ "version": "12.18.1",
7
7
  "description": "Homebridge plugin to integrate eWeLink devices into HomeKit.",
8
8
  "author": {
9
9
  "name": "bwp91",
@@ -55,11 +55,15 @@
55
55
  "main": "lib/index.js",
56
56
  "engines": {
57
57
  "homebridge": "^1.6.0 || ^2.0.0",
58
- "node": "^22.12.0 || ^24.0.0"
58
+ "node": "^22.12.0 || ^24.0.0 || ^26.0.0"
59
59
  },
60
60
  "scripts": {
61
61
  "lint": "eslint . --max-warnings=0",
62
- "lint:fix": "npm run lint -- --fix"
62
+ "lint:fix": "npm run lint -- --fix",
63
+ "test": "vitest run",
64
+ "test:watch": "vitest watch",
65
+ "test-coverage": "npm run test -- --coverage",
66
+ "changelog:sync": "node .github/scripts/sync-changelog.mjs"
63
67
  },
64
68
  "dependencies": {
65
69
  "@homebridge/plugin-ui-utils": "^2.2.5",
@@ -70,6 +74,8 @@
70
74
  "ws": "^8.21.1"
71
75
  },
72
76
  "devDependencies": {
73
- "@antfu/eslint-config": "9.2.0"
77
+ "@antfu/eslint-config": "^9.2.0",
78
+ "@vitest/coverage-v8": "^4.1.10",
79
+ "vitest": "^4.1.10"
74
80
  }
75
81
  }