matterbridge-bthome 1.0.6-dev-20260524-fe2d2c8 → 1.1.0

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
@@ -27,24 +27,53 @@ If you like this project and find it useful, please consider giving it a star on
27
27
 
28
28
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
29
29
 
30
- ## [1.0.6] - Dev branch
30
+ ## [1.1.0] - 2026-06-07
31
+
32
+ ### Breaking changes
33
+
34
+ - [matterbridge]: Require matterbridge v.3.8.0 with matter v.1.5.1 and matter.js v.0.17.1.
35
+
36
+ ### Added
37
+
38
+ - [codecov]: Add merge of Jest and Vitest coverage reports. This allows to run both Jest and Vitest tests in the same package and have a unified coverage report in Codecov.
39
+
40
+ ### Changed
31
41
 
32
42
  - [package]: Update dependencies.
33
- - [package]: Bump package to `automator` v.3.1.10.
34
- - [package]: Bump `eslint` to v.10.4.0.
35
- - [package]: Bump `@types/node` to v.25.9.1.
36
- - [package]: Bump `ts-jest` to v.29.4.11.
37
- - [package]: Bump `typescript-eslint` to v.8.59.4.
38
- - [package]: Bump `vitest` to v.4.1.7.
39
- - [package]: Bump `@vitest/coverage-v8` to v.4.1.7.
40
- - [package]: Bump `eslint-plugin-jsdoc` to v.63.0.0.
43
+ - [package]: Bump package to `automator` v.3.1.11.
44
+
45
+ - [package]: Bump `@eslint/json` to v.2.0.0.
41
46
  - [package]: Bump `@eslint/markdown` to v.8.0.2.
42
- - [package]: Bump `npm-check-updates` to v.22.2.0.
43
- - [package]: Update `.devcontainer/devcontainer.json`.
44
- - [package]: Update `.vscode/settings.json`.
45
- - [package]: Add `.vscode/extensions.json`.
46
- - [package]: Refactor `scripts`.
47
- - [eslint]: Add `eslint` v.2.0.4 config.
47
+ - [package]: Bump `@types/node` to v.25.9.2.
48
+ - [package]: Bump `@vitest/coverage-istanbul` to v.4.1.8.
49
+ - [package]: Bump `@vitest/eslint-plugin` to v.1.6.19.
50
+ - [package]: Bump `eslint` to v.10.4.1.
51
+ - [package]: Bump `eslint-plugin-jsdoc` to v.63.0.2.
52
+ - [package]: Bump `eslint-plugin-prettier` to v.5.5.6.
53
+ - [package]: Bump `npm-check-updates` to v.22.2.3.
54
+ - [package]: Bump `ts-jest` to v.29.4.11.
55
+ - [package]: Bump `typescript-eslint` to v.8.60.1.
56
+ - [package]: Bump `vitest` to v.4.1.8.
57
+
58
+ - [oxlint]: Bump `oxlint` config to v.1.0.2.
59
+ - [oxfmt]: Bump `oxfmt` config to v.1.0.2.
60
+ - [jest]: Bump `jest` config to v.2.0.2.
61
+ - [vitest]: Bump `vitest` config to v.2.0.5.
62
+ - [eslint]: Bump `eslint` config to v.2.0.6.
63
+ - [prettier]: Bump `.prettierignore` config to v.1.0.1.
64
+ - [package]: Bump `.devcontainer/devcontainer.json` config to v.1.0.2.
65
+ - [package]: Bump `.vscode/settings.json` config to v.1.0.2.
66
+ - [package]: Bump `.vscode/extensions.json` config to v.1.0.1.
67
+ - [workflow]: Bump `.github\workflows\build.yml` config to v.2.0.4.
68
+ - [workflow]: Bump `.github\workflows\codecov.yml` config to v.2.0.5.
69
+ - [workflow]: Bump `.github\workflows\publish.yml` config to v.2.0.4.
70
+
71
+ - [claude]: Move CLAUDE.md in the repo root.
72
+ - [claude]: Add .claude/settings.json with permissions configuration.
73
+
74
+ ### Fixed
75
+
76
+ - [bthome]: Fix logger level.
48
77
 
49
78
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
50
79
 
@@ -13,7 +13,7 @@ export function decodeBTHome(buf) {
13
13
  ids.push(id);
14
14
  const spec = BTHOME_SPEC[id];
15
15
  if (!spec) {
16
- unknown.push(`0x${id.toString(16)} → 0x${buf.slice(offset - 1).toString('hex')}`);
16
+ unknown.push(`0x${id.toString(16)} → 0x${buf.subarray(offset - 1).toString('hex')}`);
17
17
  break;
18
18
  }
19
19
  let value;
@@ -56,7 +56,7 @@ export function decodeShellyManufacturerData(input) {
56
56
  break;
57
57
  }
58
58
  case 0x0a: {
59
- const macBytes = buf.slice(offset, offset + 6);
59
+ const macBytes = buf.subarray(offset, offset + 6);
60
60
  offset += 6;
61
61
  result.mac = macBytes.toString('hex').match(/.{2}/g)?.join(':');
62
62
  break;
@@ -38,14 +38,14 @@ export const BTHOME_SPEC = {
38
38
  0x53: {
39
39
  name: 'text',
40
40
  parser(buf, off) {
41
- return buf.slice(off + 1, off + 1 + buf[off]).toString('utf8');
41
+ return buf.subarray(off + 1, off + 1 + buf[off]).toString('utf8');
42
42
  },
43
43
  bytes: null,
44
44
  },
45
45
  0x54: {
46
46
  name: 'raw',
47
47
  parser(buf, off) {
48
- return buf.slice(off + 1, off + 1 + buf[off]).toString('hex');
48
+ return buf.subarray(off + 1, off + 1 + buf[off]).toString('hex');
49
49
  },
50
50
  bytes: null,
51
51
  },
@@ -137,7 +137,7 @@ export const BTHOME_SPEC = {
137
137
  signed: false,
138
138
  factor: 1,
139
139
  parser(buf, off) {
140
- const [rc, patch, minor, major] = buf.slice(off, off + 4);
140
+ const [rc, patch, minor, major] = buf.subarray(off, off + 4);
141
141
  return `${major}.${minor}.${patch}.${rc}`;
142
142
  },
143
143
  },
@@ -147,7 +147,7 @@ export const BTHOME_SPEC = {
147
147
  signed: false,
148
148
  factor: 1,
149
149
  parser(buf, off) {
150
- const [minor, patch, major] = buf.slice(off, off + 3);
150
+ const [minor, patch, major] = buf.subarray(off, off + 3);
151
151
  return `${major}.${minor}.${patch}`;
152
152
  },
153
153
  },
package/dist/module.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { bridgedNode, contactSensor, genericSwitch, humiditySensor, lightSensor, MatterbridgeDynamicPlatform, MatterbridgeEndpoint, occupancySensor, powerSource, pressureSensor, temperatureSensor, } from 'matterbridge';
2
2
  import { BLUE, db, debugStringify, idn, nf, rs } from 'matterbridge/logger';
3
3
  import { NumberTag } from 'matterbridge/matter';
4
+ import { fireAndForget } from 'matterbridge/utils';
4
5
  import { BTHome } from './BTHome.js';
5
6
  export default function initializePlugin(matterbridge, log, config) {
6
7
  return new Platform(matterbridge, log, config);
@@ -12,12 +13,12 @@ export class Platform extends MatterbridgeDynamicPlatform {
12
13
  constructor(matterbridge, log, config) {
13
14
  super(matterbridge, log, config);
14
15
  this.config = config;
15
- if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.7.0')) {
16
- throw new Error(`This plugin requires Matterbridge version >= "3.7.0". Please update Matterbridge to the latest version in the frontend.`);
16
+ if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.8.0')) {
17
+ throw new Error(`This plugin requires Matterbridge version >= "3.8.0". Please update Matterbridge to the latest version in the frontend.`);
17
18
  }
18
19
  this.log.info('Initializing platform:', this.config.name);
19
20
  this.btHome.on('discovered', (device) => {
20
- void (async () => {
21
+ fireAndForget((async () => {
21
22
  this.log.notice(`Discovered new BTHome device: ${device.mac}`);
22
23
  this.log.info('- name:', device.localName);
23
24
  this.log.info('- rssi:', device.rssi);
@@ -27,13 +28,13 @@ export class Platform extends MatterbridgeDynamicPlatform {
27
28
  this.log.info('- data:', debugStringify(device.data));
28
29
  await this.addDevice(device);
29
30
  await this.savePeripherals();
30
- })();
31
+ })(), this.log, 'Error while handling discovered BTHome device');
31
32
  });
32
33
  this.btHome.on('update', (device) => {
33
- void (async () => {
34
+ fireAndForget((async () => {
34
35
  this.log.info(`${db}BTHome message from ${idn}${device.mac}${rs}${db} rssi ${BLUE}${device.rssi}${db} name ${BLUE}${device.localName}${db} version ${BLUE}${device.version}${db} ${BLUE}${device.encrypted ? 'encrypted ' : ''}${device.trigger ? 'trigger ' : ''}${db}data ${debugStringify(device.data)}`);
35
36
  await this.updateDevice(device);
36
- })();
37
+ })(), this.log, 'Error while handling updated BTHome device');
37
38
  });
38
39
  this.log.info('Finished initializing platform:', this.config.name);
39
40
  }
@@ -42,6 +43,7 @@ export class Platform extends MatterbridgeDynamicPlatform {
42
43
  await this.ready;
43
44
  await this.clearSelect();
44
45
  await this.loadPeripherals();
46
+ this.btHome.log.logLevel = this.log.logLevel;
45
47
  await this.btHome.start();
46
48
  }
47
49
  async onConfigure() {
@@ -79,6 +81,7 @@ export class Platform extends MatterbridgeDynamicPlatform {
79
81
  }
80
82
  async onChangeLoggerLevel(logLevel) {
81
83
  this.log.info(`Changing logger level for platform ${idn}${this.config.name}${rs}${nf} to ${logLevel}`);
84
+ this.btHome.log.logLevel = logLevel;
82
85
  this.bridgedDevices.forEach((device) => (device.log.logLevel = logLevel));
83
86
  }
84
87
  async onShutdown(reason) {
@@ -152,7 +155,7 @@ export class Platform extends MatterbridgeDynamicPlatform {
152
155
  continue;
153
156
  }
154
157
  if (converter && converter.deviceType && converter.cluster && converter.attribute) {
155
- const child = matterbridgeDevice.getChildEndpointByName(property);
158
+ const child = matterbridgeDevice.getChildEndpointById(property);
156
159
  let value = device.data[property];
157
160
  if (converter.factor && typeof value === 'number')
158
161
  value = value * converter.factor;
@@ -170,7 +173,7 @@ export class Platform extends MatterbridgeDynamicPlatform {
170
173
  }
171
174
  }
172
175
  if (converter && converter.deviceType && converter.cluster === 'Switch') {
173
- const child = matterbridgeDevice.getChildEndpointByName(property);
176
+ const child = matterbridgeDevice.getChildEndpointById(property);
174
177
  const value = device.data[property];
175
178
  if (child) {
176
179
  if (value === 'single_press')
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-bthome",
3
- "version": "1.0.6-dev-20260524-fe2d2c8",
3
+ "version": "1.1.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-bthome",
9
- "version": "1.0.6-dev-20260524-fe2d2c8",
9
+ "version": "1.1.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@stoprocent/noble": "2.5.3",
@@ -402,24 +402,6 @@
402
402
  "license": "MIT",
403
403
  "optional": true
404
404
  },
405
- "node_modules/async-function": {
406
- "version": "1.0.0",
407
- "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz",
408
- "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==",
409
- "license": "MIT",
410
- "engines": {
411
- "node": ">= 0.4"
412
- }
413
- },
414
- "node_modules/async-generator-function": {
415
- "version": "1.0.0",
416
- "resolved": "https://registry.npmjs.org/async-generator-function/-/async-generator-function-1.0.0.tgz",
417
- "integrity": "sha512-+NAXNqgCrB95ya4Sr66i1CL2hqLVckAk7xwRYWdcm39/ELQ6YNn1aw5r0bdQtqNZgQpEWzc5yc/igXc7aL5SLA==",
418
- "license": "MIT",
419
- "engines": {
420
- "node": ">= 0.4"
421
- }
422
- },
423
405
  "node_modules/braces": {
424
406
  "version": "3.0.3",
425
407
  "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
@@ -664,29 +646,17 @@
664
646
  "url": "https://github.com/sponsors/ljharb"
665
647
  }
666
648
  },
667
- "node_modules/generator-function": {
668
- "version": "2.0.1",
669
- "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz",
670
- "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==",
671
- "license": "MIT",
672
- "engines": {
673
- "node": ">= 0.4"
674
- }
675
- },
676
649
  "node_modules/get-intrinsic": {
677
- "version": "1.3.1",
678
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.1.tgz",
679
- "integrity": "sha512-fk1ZVEeOX9hVZ6QzoBNEC55+Ucqg4sTVwrVuigZhuRPESVFpMyXnd3sbXvPOwp7Y9riVyANiqhEuRF0G1aVSeQ==",
650
+ "version": "1.3.0",
651
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
652
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
680
653
  "license": "MIT",
681
654
  "dependencies": {
682
- "async-function": "^1.0.0",
683
- "async-generator-function": "^1.0.0",
684
655
  "call-bind-apply-helpers": "^1.0.2",
685
656
  "es-define-property": "^1.0.1",
686
657
  "es-errors": "^1.3.0",
687
658
  "es-object-atoms": "^1.1.1",
688
659
  "function-bind": "^1.1.2",
689
- "generator-function": "^2.0.0",
690
660
  "get-proto": "^1.0.1",
691
661
  "gopd": "^1.2.0",
692
662
  "has-symbols": "^1.1.0",
@@ -765,9 +735,9 @@
765
735
  }
766
736
  },
767
737
  "node_modules/hasown": {
768
- "version": "2.0.3",
769
- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
770
- "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
738
+ "version": "2.0.4",
739
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
740
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
771
741
  "license": "MIT",
772
742
  "dependencies": {
773
743
  "function-bind": "^1.1.2"
@@ -1076,9 +1046,9 @@
1076
1046
  }
1077
1047
  },
1078
1048
  "node_modules/semver": {
1079
- "version": "7.8.1",
1080
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.1.tgz",
1081
- "integrity": "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg==",
1049
+ "version": "7.8.2",
1050
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
1051
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
1082
1052
  "license": "ISC",
1083
1053
  "bin": {
1084
1054
  "semver": "bin/semver.js"
@@ -1201,9 +1171,9 @@
1201
1171
  }
1202
1172
  },
1203
1173
  "node_modules/tmp": {
1204
- "version": "0.2.5",
1205
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz",
1206
- "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==",
1174
+ "version": "0.2.7",
1175
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz",
1176
+ "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==",
1207
1177
  "license": "MIT",
1208
1178
  "engines": {
1209
1179
  "node": ">=14.14"
@@ -1231,9 +1201,9 @@
1231
1201
  }
1232
1202
  },
1233
1203
  "node_modules/usb": {
1234
- "version": "2.17.0",
1235
- "resolved": "https://registry.npmjs.org/usb/-/usb-2.17.0.tgz",
1236
- "integrity": "sha512-UuFgrlglgDn5ll6d5l7kl3nDb2Yx43qLUGcDq+7UNLZLtbNug0HZBb2Xodhgx2JZB1LqvU+dOGqLEeYUeZqsHg==",
1204
+ "version": "2.18.0",
1205
+ "resolved": "https://registry.npmjs.org/usb/-/usb-2.18.0.tgz",
1206
+ "integrity": "sha512-klAJPUTaSxRvTgrIh7om6UTrgRxdzioD+rJc/MaoiN8+OGdqRzai39tR00asnoCesPNikItWB9zBZoo0pJsWaA==",
1237
1207
  "hasInstallScript": true,
1238
1208
  "license": "MIT",
1239
1209
  "optional": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-bthome",
3
- "version": "1.0.6-dev-20260524-fe2d2c8",
3
+ "version": "1.1.0",
4
4
  "description": "Matterbridge BTHome plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",