Options
All
  • Public
  • Public/Protected
  • All
Menu

custom-card-helpers

Index

Type aliases

ActionConfig

ActionHandlerEvent

ActionHandlerEvent: HASSDomEvent<ActionHandlerDetail>

HapticType

HapticType: "success" | "warning" | "failure" | "light" | "medium" | "heavy" | "selection"

Broadcast haptic feedback requests

LocalizeFunc

LocalizeFunc: (key: string, ...args: any[]) => string

Type declaration

    • (key: string, ...args: any[]): string
    • Parameters

      • key: string
      • Rest ...args: any[]

      Returns string

ValidHassDomEvent

ValidHassDomEvent: keyof HASSDomEvents

Variables

DEFAULT_DOMAIN_ICON

DEFAULT_DOMAIN_ICON: "hass:bookmark" = "hass:bookmark"

Icon to use when no icon specified for domain.

DEFAULT_PANEL

DEFAULT_PANEL: "lovelace" = "lovelace"

Panel to show when no panel is picked.

DEFAULT_VIEW_ENTITY_ID

DEFAULT_VIEW_ENTITY_ID: "group.default_view" = "group.default_view"

Entity ID of the default view.

DOMAINS_HIDE_MORE_INFO

DOMAINS_HIDE_MORE_INFO: string[] = ...

Domains that show no more info dialog.

DOMAINS_MORE_INFO_NO_HISTORY

DOMAINS_MORE_INFO_NO_HISTORY: string[] = ...

Domains that should have the history hidden in the more info dialog.

DOMAINS_TOGGLE

DOMAINS_TOGGLE: Set<string> = ...

Domains where we allow toggle in Lovelace.

DOMAINS_WITH_CARD

DOMAINS_WITH_CARD: string[] = ...

Domains that have a state card.

DOMAINS_WITH_MORE_INFO

DOMAINS_WITH_MORE_INFO: string[] = ...

Domains with separate more info dialog.

STATES_OFF

STATES_OFF: string[] = ...

States that we consider "off".

UNIT_C

UNIT_C: "°C" = "°C"

Temperature units.

UNIT_F

UNIT_F: "°F" = "°F"

fixedIcons

fixedIcons: { alert: string; automation: string; calendar: string; camera: string; climate: string; configurator: string; conversation: string; device_tracker: string; fan: string; group: string; history_graph: string; homeassistant: string; homekit: string; image_processing: string; input_boolean: string; input_datetime: string; input_number: string; input_select: string; input_text: string; light: string; mailbox: string; notify: string; person: string; plant: string; proximity: string; remote: string; scene: string; script: string; sensor: string; simple_alarm: string; sun: string; switch: string; timer: string; updater: string; vacuum: string; water_heater: string; weblink: string } = ...

Type declaration

  • alert: string
  • automation: string
  • calendar: string
  • camera: string
  • climate: string
  • configurator: string
  • conversation: string
  • device_tracker: string
  • fan: string
  • group: string
  • history_graph: string
  • homeassistant: string
  • homekit: string
  • image_processing: string
  • input_boolean: string
  • input_datetime: string
  • input_number: string
  • input_select: string
  • input_text: string
  • light: string
  • mailbox: string
  • notify: string
  • person: string
  • plant: string
  • proximity: string
  • remote: string
  • scene: string
  • script: string
  • sensor: string
  • simple_alarm: string
  • sun: string
  • switch: string
  • timer: string
  • updater: string
  • vacuum: string
  • water_heater: string
  • weblink: string

Functions

Const applyThemesOnElement

  • applyThemesOnElement(element: any, themes: any, localTheme: any, updateMeta?: boolean): void
  • Apply a theme to an element by setting the CSS variables on it.

    element: Element to apply theme on. themes: HASS Theme information localTheme: selected theme. updateMeta: boolean if we should update the theme-color meta element.

    Parameters

    • element: any
    • themes: any
    • localTheme: any
    • updateMeta: boolean = false

    Returns void

Const computeCardSize

  • computeCardSize(card: LovelaceCard): number | Promise<number>

computeDomain

  • computeDomain(entityId: string): string

computeEntity

  • computeEntity(entityId: string): string

computeRTL

computeRTLDirection

computeStateDisplay

  • computeStateDisplay(localize: LocalizeFunc, stateObj: HassEntity, locale: FrontendTranslationData, state?: string): string

computeStateDomain

  • computeStateDomain(stateObj: HassEntity): string

Const createThing

  • createThing(cardConfig: any, isRow?: boolean): any

Const debounce

  • debounce<T>(func: T, wait: number, immediate?: boolean): T
  • Returns a function, that, as long as it continues to be invoked, will not be triggered. It will be called after it stops being called for wait ms. This can be usefull for ResizeObservers for example.

    Type parameters

    • T: (...args: any[]) => unknown

    Parameters

    • func: T

      The function you want to debounce

    • wait: number

      Period to wait in ms

    • immediate: boolean = false

      Triggering on the leading edge instead of the trailing

    Returns T

    Debounced Function

domainIcon

  • domainIcon(domain: string, state?: string): string

durationToSeconds

  • durationToSeconds(duration: string): number

Const evaluateFilter

  • evaluateFilter(stateObj: HassEntity, filter: any): boolean

Const fireEvent

  • fireEvent<HassEvent>(node: HTMLElement | Window, type: HassEvent, detail?: HASSDomEvents[HassEvent], options?: { bubbles?: boolean; cancelable?: boolean; composed?: boolean }): Event
  • Dispatches a custom event with an optional detail value.

    Type parameters

    • HassEvent: keyof HASSDomEvents

    Parameters

    • node: HTMLElement | Window
    • type: HassEvent

      Name of event type.

    • Optional detail: HASSDomEvents[HassEvent]

      Detail value containing event-specific payload.

    • Optional options: { bubbles?: boolean; cancelable?: boolean; composed?: boolean }
      • Optional bubbles?: boolean
      • Optional cancelable?: boolean
      • Optional composed?: boolean

    Returns Event

    The new event that was fired.

Const formatDate

Const formatDateTime

Const formatNumber

  • Formats a number based on the specified language with thousands separator(s) and decimal character for better legibility.

    Parameters

    • num: string | number

      The number to format

    • Optional locale: FrontendTranslationData

      The user-selected language and number format, from hass.locale

    • Optional options: NumberFormatOptions

      Intl.NumberFormatOptions to use

    Returns string

Const formatTime

Const forwardHaptic

Const getLovelace

  • getLovelace(): any

Const handleAction

Const handleActionConfig

Const handleClick

hasAction

hasConfigOrEntityChanged

  • hasConfigOrEntityChanged(element: any, changedProps: Map<string | number | symbol, unknown>, forceUpdate: Boolean): boolean
  • Parameters

    • element: any
    • changedProps: Map<string | number | symbol, unknown>
    • forceUpdate: Boolean

    Returns boolean

hasDoubleClick

Const navigate

  • navigate(_node: any, path: string, replace?: boolean): void
  • Parameters

    • _node: any
    • path: string
    • replace: boolean = false

    Returns void

relativeTime

  • relativeTime(dateObj: Date, localize: LocalizeFunc, options?: { compareTime?: Date; includeTense?: boolean }): string
  • Parameters

    • dateObj: Date
    • localize: LocalizeFunc
    • options: { compareTime?: Date; includeTense?: boolean } = {}
      • Optional compareTime?: Date
      • Optional includeTense?: boolean

    Returns string

secondsToDuration

  • secondsToDuration(d: number): null | string

Const stateIcon

  • stateIcon(state: HassEntity): any

timerTimeRemaining

  • timerTimeRemaining(stateObj: HassEntity): number

Const toggleEntity

  • toggleEntity(hass: HomeAssistant, entityId: string): Promise<void>

Const turnOnOffEntities

  • turnOnOffEntities(hass: HomeAssistant, entityIds: string[], turnOn?: boolean): void

Const turnOnOffEntity

  • turnOnOffEntity(hass: HomeAssistant, entityId: string, turnOn?: boolean): Promise<void>

Generated using TypeDoc