From 3bc227cb72a080cb993f9ea4f70fbeebf5ad67a1 Mon Sep 17 00:00:00 2001 From: Raymond Julin Date: Thu, 8 Apr 2021 23:41:25 +0200 Subject: [PATCH] fix: Hiding all setpoints didn't actually work --- src/config/setpoints.ts | 4 ++++ src/main.ts | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/setpoints.ts b/src/config/setpoints.ts index 0224de3..0524d8c 100644 --- a/src/config/setpoints.ts +++ b/src/config/setpoints.ts @@ -11,6 +11,10 @@ export default function parseSetpoints( setpoints: Setpoints | false, attributes: any ) { + if (setpoints === false) { + return {} + } + if (setpoints) { const def = Object.keys(setpoints) return def.reduce((result, name: string) => { diff --git a/src/main.ts b/src/main.ts index 81a118d..b7d9fc4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -77,7 +77,10 @@ function getModeList( return attributes[`${type}_modes`] .filter((modeOption) => shouldShowModeControl(modeOption, specification)) .map((modeOption) => { - const values = typeof specification[modeOption] === 'object' ? specification[modeOption] : {} as {} + const values = + typeof specification[modeOption] === 'object' + ? specification[modeOption] + : ({} as {}) return { icon: MODE_ICONS[modeOption], value: modeOption, @@ -166,7 +169,7 @@ export default class SimpleThermostat extends LitElement { const attributes = entity.attributes - let values = parseSetpoints(this.config?.setpoints ?? false, attributes) + let values = parseSetpoints(this.config?.setpoints ?? null, attributes) // If we are updating the values, and they are now equal // we can safely assume we've been able to update the set points