From 452fa797141c685f1d485a89610ec5ca932be715 Mon Sep 17 00:00:00 2001 From: Johann Richard <189003+johannrichard@users.noreply.github.com> Date: Mon, 23 Nov 2020 21:26:43 +0100 Subject: [PATCH] fix(dingz): field name change The field name for the output value of dimmers differs between `/api/v1/dimmer/` and `/api/v1/state`. Once it's `value`, the other time it's `output`. This change fixes that. --- src/dingzAccessory.ts | 4 ++-- src/util/dingzTypes.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dingzAccessory.ts b/src/dingzAccessory.ts index e3bc18b..13b5e02 100644 --- a/src/dingzAccessory.ts +++ b/src/dingzAccessory.ts @@ -768,7 +768,7 @@ export class DingzDaAccessory extends EventEmitter { if (output && output !== 'non_dimmable') { service .getCharacteristic(this.platform.Characteristic.Brightness) - .updateValue(state.value); + .updateValue(state.output); } service .getCharacteristic(this.platform.Characteristic.On) @@ -823,7 +823,7 @@ export class DingzDaAccessory extends EventEmitter { callback: CharacteristicSetCallback, ) { const isOn: boolean = value > 0 ? true : false; - this.dingzStates.Dimmers[index].value = value as number; + this.dingzStates.Dimmers[index].output = value as number; this.dingzStates.Dimmers[index].on = isOn; await this.setDeviceDimmer(index, isOn, value as number); diff --git a/src/util/dingzTypes.ts b/src/util/dingzTypes.ts index 689f181..19e8558 100644 --- a/src/util/dingzTypes.ts +++ b/src/util/dingzTypes.ts @@ -69,7 +69,7 @@ export enum ButtonState { // Representation of dimmer in Dingz export interface DimmerState { on: boolean; - value: number; + output: number; ramp: number; disabled: boolean; index?: {