From 5687f9ed811e11b2915739ece6b0b2234e49d31c Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Thu, 20 Feb 2025 23:03:23 +0000 Subject: [PATCH 01/11] Add Enkin - ZDM150 --- src/devices/enkin.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/devices/enkin.js diff --git a/src/devices/enkin.js b/src/devices/enkin.js new file mode 100644 index 0000000000000..441cbd844fd61 --- /dev/null +++ b/src/devices/enkin.js @@ -0,0 +1,33 @@ +const {light, forcePowerSource} = require('zigbee-herdsman-converters/lib/modernExtend'); + +const {bind, onOff} = require('zigbee-herdsman-converters/lib/reporting'); + +const definitions = [{ + zigbeeModel: ['ZDM150'], + model: 'ZDM150', + vendor: 'Enkin', + description: '150W Dimmer Module', + extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], + + configure: async (device, coordinatorEndpoint) => { + device.powerSource = 'Mains (single phase)'; + + const endpoint = device.getEndpoint(1); + await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); + await onOff(endpoint, {min: 0, max: 0xfffe}); + + await endpoint.configureReporting('genOnOff', [ + {attribute: 'onOff', minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 1}, + ]); + await endpoint.configureReporting('genLevelCtrl', [ + {attribute: 'currentLevel', minimumReportInterval: 3, maximumReportInterval: 3600, reportableChange: 1}, + ]); + + device.save(); + + }, + meta: {}, +}]; + +module.exports = definitions; + From d852f9aaa5ff752e7be95e54dce76438ad83071a Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Thu, 20 Feb 2025 23:40:21 +0000 Subject: [PATCH 02/11] Updates after lint checks --- src/devices/enkin.js | 61 +++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/devices/enkin.js b/src/devices/enkin.js index 441cbd844fd61..c383f1f1868eb 100644 --- a/src/devices/enkin.js +++ b/src/devices/enkin.js @@ -1,33 +1,36 @@ -const {light, forcePowerSource} = require('zigbee-herdsman-converters/lib/modernExtend'); - -const {bind, onOff} = require('zigbee-herdsman-converters/lib/reporting'); - -const definitions = [{ - zigbeeModel: ['ZDM150'], - model: 'ZDM150', - vendor: 'Enkin', - description: '150W Dimmer Module', - extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], - - configure: async (device, coordinatorEndpoint) => { - device.powerSource = 'Mains (single phase)'; - - const endpoint = device.getEndpoint(1); - await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); - await onOff(endpoint, {min: 0, max: 0xfffe}); - - await endpoint.configureReporting('genOnOff', [ - {attribute: 'onOff', minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 1}, - ]); - await endpoint.configureReporting('genLevelCtrl', [ - {attribute: 'currentLevel', minimumReportInterval: 3, maximumReportInterval: 3600, reportableChange: 1}, - ]); - - device.save(); - +import {light, forcePowerSource} from '../lib/modernExtend'; +import {bind, onOff} from '../lib/reporting'; +import {DefinitionWithExtend} from '../lib/types'; + +const definitions: DefinitionWithExtend[] = [ + { + zigbeeModel: ['ZDM150'], + model: 'ZDM150', + vendor: 'Enkin', + description: '150W Dimmer Module', + extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], + + configure: async (device, coordinatorEndpoint) => { + device.powerSource = 'Mains (single phase)'; + + const endpoint = device.getEndpoint(1); + await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); + await onOff(endpoint, {min: 0, max: 0xfffe}); + + await endpoint.configureReporting('genOnOff', [ + {attribute: 'onOff', minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 1}, + ]); + await endpoint.configureReporting('genLevelCtrl', [ + {attribute: 'currentLevel', minimumReportInterval: 3, maximumReportInterval: 3600, reportableChange: 1}, + ]); + + device.save(); + + }, + meta: {}, }, - meta: {}, -}]; +]; +export default definitions; module.exports = definitions; From dad6bb3620bd961d9467d8f970a34741d51ba038 Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Fri, 21 Feb 2025 16:00:13 +0000 Subject: [PATCH 03/11] Fix formatting --- src/devices/enkin.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/devices/enkin.js b/src/devices/enkin.js index c383f1f1868eb..55858c3a4ee66 100644 --- a/src/devices/enkin.js +++ b/src/devices/enkin.js @@ -1,8 +1,7 @@ -import {light, forcePowerSource} from '../lib/modernExtend'; +import {forcePowerSource, light} from '../lib/modernExtend'; import {bind, onOff} from '../lib/reporting'; -import {DefinitionWithExtend} from '../lib/types'; -const definitions: DefinitionWithExtend[] = [ +const definitions = [ { zigbeeModel: ['ZDM150'], model: 'ZDM150', @@ -25,7 +24,6 @@ const definitions: DefinitionWithExtend[] = [ ]); device.save(); - }, meta: {}, }, @@ -33,4 +31,3 @@ const definitions: DefinitionWithExtend[] = [ export default definitions; module.exports = definitions; - From 60c776bda4ab112228d2693bf8ba284ce9898301 Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Fri, 21 Feb 2025 21:55:06 +0000 Subject: [PATCH 04/11] Rename to ts file --- src/devices/{enkin.js => enkin.ts} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename src/devices/{enkin.js => enkin.ts} (92%) diff --git a/src/devices/enkin.js b/src/devices/enkin.ts similarity index 92% rename from src/devices/enkin.js rename to src/devices/enkin.ts index 55858c3a4ee66..db560530f7246 100644 --- a/src/devices/enkin.js +++ b/src/devices/enkin.ts @@ -1,7 +1,8 @@ import {forcePowerSource, light} from '../lib/modernExtend'; import {bind, onOff} from '../lib/reporting'; +import {DefinitionWithExtend} from '../lib/types'; -const definitions = [ +const definitions: DefinitionWithExtend[] = [ { zigbeeModel: ['ZDM150'], model: 'ZDM150', @@ -10,8 +11,6 @@ const definitions = [ extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], configure: async (device, coordinatorEndpoint) => { - device.powerSource = 'Mains (single phase)'; - const endpoint = device.getEndpoint(1); await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); await onOff(endpoint, {min: 0, max: 0xfffe}); From acaea5ac589922367fb704a985ecfb3c83d35c98 Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Fri, 21 Feb 2025 22:05:43 +0000 Subject: [PATCH 05/11] Remove genOnOff --- src/devices/enkin.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/devices/enkin.ts b/src/devices/enkin.ts index db560530f7246..f50b3b8ef885a 100644 --- a/src/devices/enkin.ts +++ b/src/devices/enkin.ts @@ -2,7 +2,7 @@ import {forcePowerSource, light} from '../lib/modernExtend'; import {bind, onOff} from '../lib/reporting'; import {DefinitionWithExtend} from '../lib/types'; -const definitions: DefinitionWithExtend[] = [ +export const definitions: DefinitionWithExtend[] = [ { zigbeeModel: ['ZDM150'], model: 'ZDM150', @@ -15,9 +15,6 @@ const definitions: DefinitionWithExtend[] = [ await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); await onOff(endpoint, {min: 0, max: 0xfffe}); - await endpoint.configureReporting('genOnOff', [ - {attribute: 'onOff', minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 1}, - ]); await endpoint.configureReporting('genLevelCtrl', [ {attribute: 'currentLevel', minimumReportInterval: 3, maximumReportInterval: 3600, reportableChange: 1}, ]); @@ -27,6 +24,3 @@ const definitions: DefinitionWithExtend[] = [ meta: {}, }, ]; - -export default definitions; -module.exports = definitions; From e8d32ee6694d539df265f5d3f4fdd71327e37f40 Mon Sep 17 00:00:00 2001 From: Raymond <1412530+encryptix@users.noreply.github.com> Date: Tue, 25 Feb 2025 20:23:15 +0000 Subject: [PATCH 06/11] remove reprting section --- src/devices/enkin.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/devices/enkin.ts b/src/devices/enkin.ts index f50b3b8ef885a..bf6b088b8aed4 100644 --- a/src/devices/enkin.ts +++ b/src/devices/enkin.ts @@ -1,5 +1,4 @@ import {forcePowerSource, light} from '../lib/modernExtend'; -import {bind, onOff} from '../lib/reporting'; import {DefinitionWithExtend} from '../lib/types'; export const definitions: DefinitionWithExtend[] = [ @@ -9,18 +8,6 @@ export const definitions: DefinitionWithExtend[] = [ vendor: 'Enkin', description: '150W Dimmer Module', extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], - - configure: async (device, coordinatorEndpoint) => { - const endpoint = device.getEndpoint(1); - await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']); - await onOff(endpoint, {min: 0, max: 0xfffe}); - - await endpoint.configureReporting('genLevelCtrl', [ - {attribute: 'currentLevel', minimumReportInterval: 3, maximumReportInterval: 3600, reportableChange: 1}, - ]); - - device.save(); - }, meta: {}, }, ]; From 8f9ced0736a0a5a84cae0ed40fd8e7b6de20e7f1 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 20:25:31 +0000 Subject: [PATCH 07/11] [autofix.ci] apply automated fixes --- src/devices/enkin.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/devices/enkin.ts b/src/devices/enkin.ts index bf6b088b8aed4..4f3146dd51b10 100644 --- a/src/devices/enkin.ts +++ b/src/devices/enkin.ts @@ -1,13 +1,13 @@ -import {forcePowerSource, light} from '../lib/modernExtend'; -import {DefinitionWithExtend} from '../lib/types'; +import {forcePowerSource, light} from "../lib/modernExtend"; +import type {DefinitionWithExtend} from "../lib/types"; export const definitions: DefinitionWithExtend[] = [ { - zigbeeModel: ['ZDM150'], - model: 'ZDM150', - vendor: 'Enkin', - description: '150W Dimmer Module', - extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: 'Mains (single phase)'})], + zigbeeModel: ["ZDM150"], + model: "ZDM150", + vendor: "Enkin", + description: "150W Dimmer Module", + extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: "Mains (single phase)"})], meta: {}, }, ]; From 8a527d086a25fa81ce05a0735c25d3030a052158 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 1 Mar 2025 20:36:30 +0100 Subject: [PATCH 08/11] Update index.ts --- src/devices/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/devices/index.ts b/src/devices/index.ts index e120c9125e99a..b12c30870c522 100644 --- a/src/devices/index.ts +++ b/src/devices/index.ts @@ -77,6 +77,7 @@ import {definitions as eglo} from "./eglo"; import {definitions as elko} from "./elko"; import {definitions as enbrighten} from "./enbrighten"; import {definitions as enocean} from "./enocean"; +import {definitions as enkin} from "./enkin"; import {definitions as envilar} from "./envilar"; import {definitions as essentialb} from "./essentialb"; import {definitions as essentials} from "./essentials"; @@ -400,6 +401,7 @@ export default [ ...elko, ...enbrighten, ...enocean, + ...enkin, ...envilar, ...essentialb, ...essentials, From 05f08329ca7185f72ec247b79bc98cd90d7608ba Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 19:36:55 +0000 Subject: [PATCH 09/11] [autofix.ci] apply automated fixes --- src/devices/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/index.ts b/src/devices/index.ts index b12c30870c522..904ce6d3befeb 100644 --- a/src/devices/index.ts +++ b/src/devices/index.ts @@ -76,8 +76,8 @@ import {definitions as efekta} from "./efekta"; import {definitions as eglo} from "./eglo"; import {definitions as elko} from "./elko"; import {definitions as enbrighten} from "./enbrighten"; -import {definitions as enocean} from "./enocean"; import {definitions as enkin} from "./enkin"; +import {definitions as enocean} from "./enocean"; import {definitions as envilar} from "./envilar"; import {definitions as essentialb} from "./essentialb"; import {definitions as essentials} from "./essentials"; From 1001939fbd189929b2380a0f832b3d5908f5228d Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 1 Mar 2025 20:40:20 +0100 Subject: [PATCH 10/11] Update enkin.ts --- src/devices/enkin.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/devices/enkin.ts b/src/devices/enkin.ts index 4f3146dd51b10..a01d092d1fdda 100644 --- a/src/devices/enkin.ts +++ b/src/devices/enkin.ts @@ -8,6 +8,5 @@ export const definitions: DefinitionWithExtend[] = [ vendor: "Enkin", description: "150W Dimmer Module", extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: "Mains (single phase)"})], - meta: {}, }, ]; From 3e1952df49c2b52b3960d6fe3c8afa5d5a38efa3 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Sat, 1 Mar 2025 20:40:31 +0100 Subject: [PATCH 11/11] Update enkin.ts --- src/devices/enkin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/enkin.ts b/src/devices/enkin.ts index a01d092d1fdda..a699a57154ad3 100644 --- a/src/devices/enkin.ts +++ b/src/devices/enkin.ts @@ -6,7 +6,7 @@ export const definitions: DefinitionWithExtend[] = [ zigbeeModel: ["ZDM150"], model: "ZDM150", vendor: "Enkin", - description: "150W Dimmer Module", + description: "150W Dimmer module", extend: [light({powerOnBehavior: false, effect: false, configureReporting: true}), forcePowerSource({powerSource: "Mains (single phase)"})], }, ];