diff --git a/src/chips/AbstractChip.ts b/src/chips/AbstractChip.ts index 443752f..d330508 100644 --- a/src/chips/AbstractChip.ts +++ b/src/chips/AbstractChip.ts @@ -1,8 +1,6 @@ -import { HassServiceTarget } from 'home-assistant-js-websocket'; import { Registry } from '../Registry'; import { LovelaceChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types'; -import { isCallServiceActionConfig, isTargetableChip } from '../types/strategy/strategy-generics'; -import { logMessage, lvlFatal, lvlWarn } from '../utilities/debug'; +import { logMessage, lvlFatal } from '../utilities/debug'; abstract class AbstractChip { /** @@ -45,21 +43,6 @@ abstract class AbstractChip { getChipConfiguration(): LovelaceChipConfig { return this.configuration; } - - /** - * Set the target for the tap action. - * - * @param {HassServiceTarget} target Target of the tap action. - */ - setTapActionTarget(target: HassServiceTarget) { - if (isTargetableChip(this.configuration) && isCallServiceActionConfig(this.configuration.tap_action)) { - this.configuration.tap_action.target = target; - - return; - } - - logMessage(lvlWarn, 'Target not set: Invalid target or tap action.'); - } } export default AbstractChip; diff --git a/src/types/strategy/strategy-generics.ts b/src/types/strategy/strategy-generics.ts index 62197f7..0d00f50 100644 --- a/src/types/strategy/strategy-generics.ts +++ b/src/types/strategy/strategy-generics.ts @@ -306,28 +306,6 @@ export function isCallServiceActionConfig(object?: ActionConfig): object is Call !!object && (object.action === 'perform-action' || object.action === 'call-service') && 'perform_action' in object ); } - -/** - * List of chip types that are not considered "targetable". - * These chips do not support tap_action or similar targeting logic. - */ -const NON_TARGETABLE_CHIP_TYPES = ['back', 'menu', 'conditional', 'spacer'] as const; - -/** - * Type guard to check if a LovelaceChipConfig is "targetable". - * - * A targetable chip supports actions like tap_action. - * This function excludes chips of type "back", "menu", "conditional", and "spacer". - * - * @param object - The chip configuration object to check. - * @returns True if the chip is targetable; false otherwise. - */ -export function isTargetableChip( - object: LovelaceChipConfig, -): object is Exclude { - return !NON_TARGETABLE_CHIP_TYPES.includes(object.type as (typeof NON_TARGETABLE_CHIP_TYPES)[number]); -} - /** * Type guard to check if a given identifier exists in a list of supported identifiers. * diff --git a/src/views/HomeView.ts b/src/views/HomeView.ts index 847013a..06f06a9 100644 --- a/src/views/HomeView.ts +++ b/src/views/HomeView.ts @@ -130,7 +130,6 @@ class HomeView extends AbstractView { const chipConfigurations: LovelaceChipConfig[] = []; const exposedChips = Registry.getExposedNames('chip'); - const areaIds = Registry.areas.map((area) => area.area_id ?? ''); let Chip; @@ -164,7 +163,6 @@ class HomeView extends AbstractView { Chip = (await import(`../chips/${moduleName}`)).default; const currentChip = new Chip(); - currentChip.setTapActionTarget({ area_id: areaIds }); chipConfigurations.push(currentChip.getChipConfiguration()); } catch (e) { logMessage(lvlError, `Error creating the configuration for chip ${chipName}!`, e);