From df3a6870b38f6b1718dd998511075a6ddb591f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sat, 30 Oct 2021 21:28:47 +0000 Subject: [PATCH] Fix #210 --- src/controllers/controller.ts | 2 +- src/controllers/light-controller.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/controller.ts b/src/controllers/controller.ts index e628718..d368130 100644 --- a/src/controllers/controller.ts +++ b/src/controllers/controller.ts @@ -67,7 +67,7 @@ export abstract class Controller { } get isOff(): boolean { - return this.value === 0; + return this.stateObj.state === "off" || this.value === 0; } get min(): number { diff --git a/src/controllers/light-controller.ts b/src/controllers/light-controller.ts index 046316b..16a7a39 100644 --- a/src/controllers/light-controller.ts +++ b/src/controllers/light-controller.ts @@ -111,6 +111,10 @@ export class LightController extends Controller { } } + get isOff() { + return this.stateObj.state === "off"; + } + set _value(value) { if (!this.stateObj) return; const color_mode = this.stateObj.attributes.color_mode;