Skip to content

Commit

Permalink
fix(dingz): field name change
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johannrichard committed Nov 23, 2020
1 parent ea485ed commit 452fa79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/dingzAccessory.ts
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/util/dingzTypes.ts
Expand Up @@ -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?: {
Expand Down

0 comments on commit 452fa79

Please sign in to comment.