mirror of
https://github.com/DigiLive/mushroom-strategy.git
synced 2025-07-30 01:47:14 +02:00
Fix counting entity states
Entity states where counted multiple times if those entities also belong to a group. `Group` entities are excluded from the count now.
This commit is contained in:
@ -12,7 +12,7 @@ import {
|
||||
StrategyConfig,
|
||||
StrategyViewConfig,
|
||||
SupportedDomains,
|
||||
SupportedViews
|
||||
SupportedViews,
|
||||
} from './types/strategy/strategy-generics';
|
||||
import { logMessage, lvlFatal, lvlOff, lvlWarn, setDebugLevel } from './utilities/debug';
|
||||
import setupCustomLocalize from './utilities/localize';
|
||||
@ -37,10 +37,6 @@ class Registry {
|
||||
|
||||
/** Entries of Home Assistant's device registry. */
|
||||
private static _devices: DeviceRegistryEntry[];
|
||||
/** Entries of Home Assistant's state registry */
|
||||
private static _hassStates: HassEntities;
|
||||
/** Indicates whether this module is initialized. */
|
||||
private static _initialized: boolean = false;
|
||||
|
||||
/**
|
||||
* Home Assistant's Device registry.
|
||||
@ -52,6 +48,22 @@ class Registry {
|
||||
return Registry._devices;
|
||||
}
|
||||
|
||||
/** Entries of Home Assistant's state registry */
|
||||
private static _hassStates: HassEntities;
|
||||
|
||||
/** Home Assistant's State registry. */
|
||||
static get hassStates(): HassEntities {
|
||||
return Registry._hassStates;
|
||||
}
|
||||
|
||||
/** Indicates whether this module is initialized. */
|
||||
private static _initialized: boolean = false;
|
||||
|
||||
/** Get the initialization status of the Registry class. */
|
||||
static get initialized(): boolean {
|
||||
return Registry._initialized;
|
||||
}
|
||||
|
||||
/** Entries of Home Assistant's entity registry. */
|
||||
private static _entities: EntityRegistryEntry[];
|
||||
|
||||
@ -68,11 +80,6 @@ class Registry {
|
||||
/** Entries of Home Assistant's area registry. */
|
||||
private static _areas: StrategyArea[] = [];
|
||||
|
||||
/** Home Assistant's State registry. */
|
||||
static get hassStates(): HassEntities {
|
||||
return Registry._hassStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Home Assistant's Area registry.
|
||||
*
|
||||
@ -83,11 +90,6 @@ class Registry {
|
||||
return Registry._areas;
|
||||
}
|
||||
|
||||
/** Get the initialization status of the Registry class. */
|
||||
static get initialized(): boolean {
|
||||
return Registry._initialized;
|
||||
}
|
||||
|
||||
/** The Custom strategy configuration. */
|
||||
private static _strategyOptions: StrategyConfig;
|
||||
|
||||
@ -252,7 +254,7 @@ class Registry {
|
||||
states.push(
|
||||
...new RegistryFilter(Registry.entities)
|
||||
.whereDomain(domain)
|
||||
.where((entity) => !entity.entity_id.endsWith('_stateful_scene'))
|
||||
.where((entity) => !entity.entity_id.endsWith('_stateful_scene') && entity.platform !== 'group')
|
||||
.toList()
|
||||
.map((entity) => `states['${entity.entity_id}']`),
|
||||
);
|
||||
|
Reference in New Issue
Block a user