diff --git a/src/Registry.ts b/src/Registry.ts index dabde3d..052d8fa 100644 --- a/src/Registry.ts +++ b/src/Registry.ts @@ -161,7 +161,9 @@ class Registry { })); // Process entries of the HASS area registry. - if (!Registry.strategyOptions.areas._?.hidden) { + if (Registry.strategyOptions.areas._?.hidden) { + Registry._areas = []; + } else { // Create and add the undisclosed area if not hidden in the strategy options. if (!Registry.strategyOptions.areas.undisclosed?.hidden) { Registry.areas.push(ConfigurationDefaults.areas.undisclosed); @@ -179,8 +181,6 @@ class Registry { // Remove hidden areas if configured as so and sort them by name. Registry._areas = new RegistryFilter(Registry.areas).isNotHidden().orderBy(['order', 'name'], 'asc').toList(); - } else { - Registry._areas = []; } // Sort views by order first and then by title. diff --git a/src/utilities/RegistryFilter.ts b/src/utilities/RegistryFilter.ts index f109800..bf331a5 100644 --- a/src/utilities/RegistryFilter.ts +++ b/src/utilities/RegistryFilter.ts @@ -1,3 +1,5 @@ +// noinspection JSUnusedGlobalSymbols + import { Registry } from '../Registry'; import { DeviceRegistryEntry } from '../types/homeassistant/data/device_registry'; import { EntityCategory, EntityRegistryEntry } from '../types/homeassistant/data/entity_registry'; @@ -25,7 +27,7 @@ class RegistryFilter { constructor(entries: T[]) { this.entries = entries; this.entryIdentifier = ( - entries.length == 0 || 'entity_id' in entries[0] ? 'entity_id' : 'floor_id' in entries[0] ? 'floor_id' : 'id' + entries.length === 0 || 'entity_id' in entries[0] ? 'entity_id' : 'floor_id' in entries[0] ? 'floor_id' : 'id' ) as ('entity_id' | 'floor_id' | 'id') & K; } diff --git a/src/utilities/debug.ts b/src/utilities/debug.ts index 43b706b..b14bdde 100644 --- a/src/utilities/debug.ts +++ b/src/utilities/debug.ts @@ -19,6 +19,7 @@ export enum DebugLevel { Fatal = 5, } +// noinspection JSUnusedGlobalSymbols /** * Individually exported log level constants. * diff --git a/src/views/HomeView.ts b/src/views/HomeView.ts index 5bee410..847013a 100644 --- a/src/views/HomeView.ts +++ b/src/views/HomeView.ts @@ -249,9 +249,9 @@ class HomeView extends AbstractView { // FIXME: The columns are too narrow when having HASS area cards. return { type: 'vertical-stack', - title: !(Registry.strategyOptions.home_view.hidden as HomeViewSections[]).includes('areasTitle') - ? localize('generic.areas') - : undefined, + title: (Registry.strategyOptions.home_view.hidden as HomeViewSections[]).includes('areasTitle') + ? undefined + : localize('generic.areas'), cards: Registry.stackHorizontal(cardConfigurations, 2), }; }