From 3759d91d1fc631d1f5b7b5e9e6442848fc36b876 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Fri, 3 Jan 2020 19:50:38 -0500 Subject: [PATCH] Setting button state correctly for stateful buttons --- src/Accessories/DeviceButton.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Accessories/DeviceButton.ts b/src/Accessories/DeviceButton.ts index 563a972..9ed0016 100644 --- a/src/Accessories/DeviceButton.ts +++ b/src/Accessories/DeviceButton.ts @@ -104,8 +104,8 @@ export class DeviceButton implements IAccessory { await this._dataProvider.sendCommand(this._deviceCommand); //change state if stateful - if (this._buttonInfo.IsStateful) { - this._buttonState = !this._buttonState + if (this._buttonInfo.IsStateful && this._buttonState != activeState) { + this._buttonState = activeState } else { this._switchService.getCharacteristic(Characteristic.On).updateValue(false); return callback(new Error("Normal Response"));