From 8d7d790a28983aa7e7e5fa95b22d3f08284c18ca Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 10 Mar 2025 21:09:14 +0100 Subject: [PATCH 1/3] chore: Small improvements to CI (#1337) --- .github/workflows/ci.yml | 2 +- .../{release_please.yml => release-please.yml} | 2 +- .../{update_deps.yml => update-dependencies.yml} | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) rename .github/workflows/{release_please.yml => release-please.yml} (93%) rename .github/workflows/{update_deps.yml => update-dependencies.yml} (63%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39e6b033b2..157d561c8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: ci +name: CI on: [pull_request, push] diff --git a/.github/workflows/release_please.yml b/.github/workflows/release-please.yml similarity index 93% rename from .github/workflows/release_please.yml rename to .github/workflows/release-please.yml index bebe5aca5b..2f9655929f 100644 --- a/.github/workflows/release_please.yml +++ b/.github/workflows/release-please.yml @@ -1,4 +1,4 @@ -name: release-please +name: Release Please on: push: diff --git a/.github/workflows/update_deps.yml b/.github/workflows/update-dependencies.yml similarity index 63% rename from .github/workflows/update_deps.yml rename to .github/workflows/update-dependencies.yml index 9742ff0779..0f54095ab0 100644 --- a/.github/workflows/update_deps.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,4 +1,4 @@ -name: update-deps +name: Update dependencies on: workflow_dispatch: @@ -10,7 +10,7 @@ permissions: pull-requests: write jobs: - update_deps: + update-dependencies: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -21,10 +21,18 @@ jobs: with: node-version: 22 cache: pnpm - - run: pnpm up --latest + - run: | + pnpm self-update + pnpm up --latest - uses: peter-evans/create-pull-request@v7 + id: cpr with: commit-message: 'fix(ignore): update dependencies' branch: 'deps/all' title: 'fix(ignore): update dependencies' token: ${{ secrets.GH_TOKEN }} + - uses: peter-evans/create-or-update-comment@v4 + if: ${{ steps.cpr.outputs.pull-request-number }} + with: + issue-number: ${{ steps.cpr.outputs.pull-request-number }} + body: 'CC: @Koenkk' From 3db0312020c8b84b92cb726609f5b673b0c9098a Mon Sep 17 00:00:00 2001 From: captainlettuce <31080747+captainlettuce@users.noreply.github.com> Date: Tue, 11 Mar 2025 20:31:54 +0100 Subject: [PATCH 2/3] fix: Zboss: fix joining of Lumi devices (#1331) Co-authored-by: captainLettuce --- src/adapter/const.ts | 12 ++++++++++++ src/adapter/ember/adapter/emberAdapter.ts | 11 +---------- src/adapter/zboss/adapter/zbossAdapter.ts | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/adapter/const.ts diff --git a/src/adapter/const.ts b/src/adapter/const.ts new file mode 100644 index 0000000000..0a3301db86 --- /dev/null +++ b/src/adapter/const.ts @@ -0,0 +1,12 @@ +import * as Zcl from '../zspec/zcl'; + +/** + * Workaround for devices that require a specific manufacturer code to be reported by coordinator while interviewing... + * - Lumi/Aqara devices do not work properly otherwise (missing features): https://github.com/Koenkk/zigbee2mqtt/issues/9274 + */ +export const WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE: {[ieeePrefix: string]: Zcl.ManufacturerCode} = { + // NOTE: Lumi has a new prefix registered since 2021, in case they start using that one with new devices, it might need to be added here too... + // "0x18c23c" https://maclookup.app/vendors/lumi-united-technology-co-ltd + '0x54ef44': Zcl.ManufacturerCode.LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN, + '0x04cf8c': Zcl.ManufacturerCode.LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN, +}; diff --git a/src/adapter/ember/adapter/emberAdapter.ts b/src/adapter/ember/adapter/emberAdapter.ts index 05c909b953..ea36df0630 100644 --- a/src/adapter/ember/adapter/emberAdapter.ts +++ b/src/adapter/ember/adapter/emberAdapter.ts @@ -13,6 +13,7 @@ import {EUI64, ExtendedPanId, NodeId, PanId} from '../../../zspec/tstypes'; import * as Zcl from '../../../zspec/zcl'; import * as Zdo from '../../../zspec/zdo'; import * as ZdoTypes from '../../../zspec/zdo/definition/tstypes'; +import {WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE} from '../../const'; import {DeviceJoinedPayload, DeviceLeavePayload, ZclPayload} from '../../events'; import { EMBER_HIGH_RAM_CONCENTRATOR, @@ -216,16 +217,6 @@ const DEFAULT_NETWORK_REQUEST_TIMEOUT = 10000; // nothing on the network to both const WATCHDOG_COUNTERS_FEED_INTERVAL = 3600000; // every hour... /** Default manufacturer code reported by coordinator. */ const DEFAULT_MANUFACTURER_CODE = Zcl.ManufacturerCode.SILICON_LABORATORIES; -/** - * Workaround for devices that require a specific manufacturer code to be reported by coordinator while interviewing... - * - Lumi/Aqara devices do not work properly otherwise (missing features): https://github.com/Koenkk/zigbee2mqtt/issues/9274 - */ -const WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE: {[ieeePrefix: string]: Zcl.ManufacturerCode} = { - // NOTE: Lumi has a new prefix registered since 2021, in case they start using that one with new devices, it might need to be added here too... - // "0x18c23c" https://maclookup.app/vendors/lumi-united-technology-co-ltd - '0x54ef44': Zcl.ManufacturerCode.LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN, - '0x04cf8c': Zcl.ManufacturerCode.LUMI_UNITED_TECHOLOGY_LTD_SHENZHEN, -}; /** * Relay calls between Z2M and EZSP-layer and handle any error that might occur via queue & waitress. diff --git a/src/adapter/zboss/adapter/zbossAdapter.ts b/src/adapter/zboss/adapter/zbossAdapter.ts index f2ad048550..323e5d6622 100644 --- a/src/adapter/zboss/adapter/zbossAdapter.ts +++ b/src/adapter/zboss/adapter/zbossAdapter.ts @@ -10,6 +10,7 @@ import * as ZSpec from '../../../zspec'; import * as Zcl from '../../../zspec/zcl'; import * as Zdo from '../../../zspec/zdo'; import * as ZdoTypes from '../../../zspec/zdo/definition/tstypes'; +import {WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE} from '../../const'; import {ZclPayload} from '../../events'; import {ZBOSSDriver} from '../driver'; import {CommandId, DeviceUpdateStatus} from '../enums'; @@ -29,6 +30,7 @@ export class ZBOSSAdapter extends Adapter { private queue: Queue; private readonly driver: ZBOSSDriver; private waitress: Waitress; + private currentManufacturerCode: Zcl.ManufacturerCode; constructor( networkOptions: TsType.NetworkOptions, @@ -39,6 +41,7 @@ export class ZBOSSAdapter extends Adapter { super(networkOptions, serialPortOptions, backupPath, adapterOptions); this.hasZdoMessageOverhead = false; this.manufacturerID = Zcl.ManufacturerCode.NORDIC_SEMICONDUCTOR_ASA; + this.currentManufacturerCode = Zcl.ManufacturerCode.NORDIC_SEMICONDUCTOR_ASA; const concurrent = adapterOptions && adapterOptions.concurrent ? adapterOptions.concurrent : 8; logger.debug(`Adapter concurrent: ${concurrent}`, NS); this.queue = new Queue(concurrent); @@ -64,6 +67,16 @@ export class ZBOSSAdapter extends Adapter { ieeeAddr: frame.payload.ieee, }); } else { + // set workaround manuf code if necessary, or revert to default if previous joined device required workaround and new one does not + const joinManufCode = WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE[frame.payload.ieee.substring(0, 8)] ?? this.manufacturerID; + + if (this.currentManufacturerCode !== joinManufCode) { + logger.debug(`[WORKAROUND] Setting coordinator manufacturer code to ${Zcl.ManufacturerCode[joinManufCode]}.`, NS); + + await this.driver.execCommand(CommandId.ZDO_SET_NODE_DESC_MANUF_CODE, {manufacturerCode: joinManufCode}); + + this.currentManufacturerCode = joinManufCode; + } // SECURE_REJOIN, UNSECURE_JOIN, TC_REJOIN this.emit('deviceJoined', { networkAddress: frame.payload.nwk, @@ -179,6 +192,14 @@ export class ZBOSSAdapter extends Adapter { public async permitJoin(seconds: number, networkAddress?: number): Promise { if (this.driver.isInitialized()) { + if (this.currentManufacturerCode !== this.manufacturerID) { + logger.debug(`[WORKAROUND] Resetting coordinator manufacturer code to ${Zcl.ManufacturerCode[this.manufacturerID]}.`, NS); + + await this.driver.execCommand(CommandId.ZDO_SET_NODE_DESC_MANUF_CODE, {manufacturerCode: this.manufacturerID}); + + this.currentManufacturerCode = this.manufacturerID; + } + const clusterId = Zdo.ClusterId.PERMIT_JOINING_REQUEST; // `authentication`: TC significance always 1 (zb specs) const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, clusterId, seconds, 1, []); From f0e52eb516558639d55f8baa7af0768966d44c83 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Tue, 11 Mar 2025 20:49:09 +0100 Subject: [PATCH 3/3] chore(master): release 3.3.2 (#1339) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 466b7195f8..f1507a00bb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.1" + ".": "3.3.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e589dfc5..ef197169b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [3.3.2](https://github.com/Koenkk/zigbee-herdsman/compare/v3.3.1...v3.3.2) (2025-03-11) + + +### Bug Fixes + +* Zboss: fix joining of Lumi devices ([#1331](https://github.com/Koenkk/zigbee-herdsman/issues/1331)) ([3db0312](https://github.com/Koenkk/zigbee-herdsman/commit/3db0312020c8b84b92cb726609f5b673b0c9098a)) + ## [3.3.1](https://github.com/Koenkk/zigbee-herdsman/compare/v3.3.0...v3.3.1) (2025-03-09) diff --git a/package.json b/package.json index a56a5c444d..059d68e0b9 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "clean": "rimraf temp coverage dist tsconfig.tsbuildinfo", "prepack": "pnpm run clean && pnpm run build" }, - "version": "3.3.1", + "version": "3.3.2", "pnpm": { "onlyBuiltDependencies": [ "@serialport/bindings-cpp",