From 43e7ca7ad682d73e33e5cba86915f3e1c45117c1 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 14 Jan 2022 16:53:22 +0100 Subject: [PATCH] Expose optional user settings to configure() (#10791) --- lib/extension/configure.ts | 3 ++- lib/types/types.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/extension/configure.ts b/lib/extension/configure.ts index fe2cd5822..e6befa866 100644 --- a/lib/extension/configure.ts +++ b/lib/extension/configure.ts @@ -112,7 +112,8 @@ export default class Configure extends Extension { logger.info(`Configuring '${device.name}'`); try { - await device.definition.configure(device.zh, this.zigbee.firstCoordinatorEndpoint(), logger); + await device.definition.configure(device.zh, this.zigbee.firstCoordinatorEndpoint(), logger, + device.options); logger.info(`Successfully configured '${device.name}'`); device.zh.meta.configured = zhc.getConfigureKey(device.definition); device.zh.save(); diff --git a/lib/types/types.d.ts b/lib/types/types.d.ts index 90f9aea4b..7b7b87463 100644 --- a/lib/types/types.d.ts +++ b/lib/types/types.d.ts @@ -115,7 +115,8 @@ declare global { options: zhc.DefinitionExpose[], vendor: string exposes: DefinitionExpose[] | ((device: zh.Device, options: KeyValue) => DefinitionExpose[]) - configure?: (device: zh.Device, coordinatorEndpoint: zh.Endpoint, logger: Logger) => Promise; + configure?: (device: zh.Device, coordinatorEndpoint: zh.Endpoint, logger: Logger, + options?: DeviceOptions) => Promise; onEvent?: (type: string, data: KeyValue, device: zh.Device, settings: KeyValue) => Promise; ota?: { isUpdateAvailable: (device: zh.Device, logger: Logger, data?: KeyValue) => Promise;