extra-map-card 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/emc-map.d.ts +46 -0
- package/dist/{extra-map-card.js → extra-map-card-bundle.js} +1 -1
- package/dist/extra-map-card.d.ts +45 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +311 -0
- package/dist/types/config.d.ts +65 -0
- package/dist/types/ha-frontend/data/frontend-local-data.d.ts +43 -0
- package/dist/types/ha-frontend/data/history.d.ts +21 -0
- package/dist/types/ha-frontend/data/image.d.ts +9 -0
- package/dist/types/ha-frontend/data/image_upload.d.ts +21 -0
- package/dist/types/ha-frontend/data/ws-templates.d.ts +19 -0
- package/dist/types/ha-frontend/data/ws-themes.d.ts +27 -0
- package/dist/types/ha-frontend/fire-event.d.ts +28 -0
- package/dist/types/ha-frontend/home-assistant.d.ts +70 -0
- package/dist/types/ha-frontend/lovelace/lovelace.d.ts +208 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/utilities/colors.d.ts +2 -0
- package/dist/utilities/compute_state_name.d.ts +5 -0
- package/dist/utilities/find-entities.d.ts +3 -0
- package/dist/utilities/has-changed.d.ts +19 -0
- package/dist/utilities/loader.d.ts +3 -0
- package/dist/utilities/map-utils.d.ts +15 -0
- package/dist/utilities/parse-aspect-ratio.d.ts +4 -0
- package/dist/utilities/process-config-entities.d.ts +3 -0
- package/package.json +7 -5
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LngLatLike } from '@maptiler/sdk';
|
|
2
|
+
import { HomeAssistant } from '@types';
|
|
3
|
+
import { LovelaceCardConfig } from './ha-frontend/lovelace/lovelace';
|
|
4
|
+
export interface EntityConfig {
|
|
5
|
+
entity: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MapEntityConfig extends EntityConfig {
|
|
13
|
+
label_mode?: 'state' | 'attribute' | 'name';
|
|
14
|
+
attribute?: string;
|
|
15
|
+
focus?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface HaMapEntity {
|
|
18
|
+
entity_id: string;
|
|
19
|
+
color: string;
|
|
20
|
+
label_mode?: 'name' | 'state' | 'attribute' | 'icon';
|
|
21
|
+
attribute?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
focus?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface HaMapPathPoint {
|
|
26
|
+
point: LngLatLike;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
}
|
|
29
|
+
export interface HaMapPaths {
|
|
30
|
+
points: HaMapPathPoint[];
|
|
31
|
+
color?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
gradualOpacity?: number;
|
|
34
|
+
fullDatetime?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface HaEntityMarker extends HTMLElement {
|
|
37
|
+
hass?: HomeAssistant;
|
|
38
|
+
entityId?: string;
|
|
39
|
+
entityName?: string;
|
|
40
|
+
entityPicture?: string;
|
|
41
|
+
entityColor?: string;
|
|
42
|
+
showIcon?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface CustomStyles {
|
|
45
|
+
light?: string;
|
|
46
|
+
dark?: string;
|
|
47
|
+
}
|
|
48
|
+
export type ThemeMode = 'auto' | 'light' | 'dark';
|
|
49
|
+
export interface ExtraMapCardConfig extends LovelaceCardConfig {
|
|
50
|
+
type: 'custom:extra-map-card';
|
|
51
|
+
title?: string;
|
|
52
|
+
api_key?: string;
|
|
53
|
+
aspect_ratio?: string;
|
|
54
|
+
entities?: (MapEntityConfig | string)[];
|
|
55
|
+
auto_fit?: boolean;
|
|
56
|
+
fit_zones?: boolean;
|
|
57
|
+
default_zoom?: number;
|
|
58
|
+
hours_to_show?: number;
|
|
59
|
+
theme_mode?: ThemeMode;
|
|
60
|
+
light_theme?: string;
|
|
61
|
+
dark_theme?: string;
|
|
62
|
+
show_all?: boolean;
|
|
63
|
+
block_more_info?: boolean;
|
|
64
|
+
custom_styles?: CustomStyles;
|
|
65
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare enum NumberFormat {
|
|
2
|
+
language = "language",
|
|
3
|
+
system = "system",
|
|
4
|
+
comma_decimal = "comma_decimal",
|
|
5
|
+
decimal_comma = "decimal_comma",
|
|
6
|
+
space_comma = "space_comma",
|
|
7
|
+
none = "none"
|
|
8
|
+
}
|
|
9
|
+
export declare enum TimeFormat {
|
|
10
|
+
language = "language",
|
|
11
|
+
system = "system",
|
|
12
|
+
am_pm = "12",
|
|
13
|
+
twenty_four = "24"
|
|
14
|
+
}
|
|
15
|
+
export declare enum TimeZone {
|
|
16
|
+
local = "local",
|
|
17
|
+
server = "server"
|
|
18
|
+
}
|
|
19
|
+
export declare enum DateFormat {
|
|
20
|
+
language = "language",
|
|
21
|
+
system = "system",
|
|
22
|
+
DMY = "DMY",
|
|
23
|
+
MDY = "MDY",
|
|
24
|
+
YMD = "YMD"
|
|
25
|
+
}
|
|
26
|
+
export declare enum FirstWeekday {
|
|
27
|
+
language = "language",
|
|
28
|
+
monday = "monday",
|
|
29
|
+
tuesday = "tuesday",
|
|
30
|
+
wednesday = "wednesday",
|
|
31
|
+
thursday = "thursday",
|
|
32
|
+
friday = "friday",
|
|
33
|
+
saturday = "saturday",
|
|
34
|
+
sunday = "sunday"
|
|
35
|
+
}
|
|
36
|
+
export interface FrontendLocaleData {
|
|
37
|
+
language: string;
|
|
38
|
+
number_format: NumberFormat;
|
|
39
|
+
time_format: TimeFormat;
|
|
40
|
+
date_format: DateFormat;
|
|
41
|
+
first_weekday: FirstWeekday;
|
|
42
|
+
time_zone: TimeZone;
|
|
43
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HomeAssistant } from '../home-assistant';
|
|
2
|
+
export type HistoryStates = Record<string, EntityHistoryState[]>;
|
|
3
|
+
export interface EntityHistoryState {
|
|
4
|
+
/** state */
|
|
5
|
+
s: string;
|
|
6
|
+
/** attributes */
|
|
7
|
+
a: Record<string, any>;
|
|
8
|
+
/** last_changed; if set, also applies to lu */
|
|
9
|
+
lc?: number;
|
|
10
|
+
/** last_updated */
|
|
11
|
+
lu: number;
|
|
12
|
+
}
|
|
13
|
+
export interface HistoryStreamMessage {
|
|
14
|
+
states: HistoryStates;
|
|
15
|
+
start_time?: number;
|
|
16
|
+
end_time?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const entityIdHistoryNeedsAttributes: (hass: HomeAssistant, entityId: string) => boolean;
|
|
19
|
+
export declare const fetchDateWS: (hass: HomeAssistant, startTime: Date, endTime: Date, entityIds: string[]) => Promise<HistoryStates>;
|
|
20
|
+
export declare const subscribeHistoryStatesTimeWindow: (hass: HomeAssistant, callbackFunction: (data: HistoryStates) => void, hoursToShow: number, entityIds: string[], noAttributes?: boolean, minimalResponse?: boolean, significantChangesOnly?: boolean) => Promise<() => Promise<void>>;
|
|
21
|
+
export declare const subscribeHistory: (hass: HomeAssistant, callbackFunction: (data: HistoryStates) => void, startTime: Date, endTime: Date, entityIds: string[]) => Promise<() => Promise<void>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HassEntityAttributeBase, HassEntityBase } from "home-assistant-js-websocket";
|
|
2
|
+
interface ImageEntityAttributes extends HassEntityAttributeBase {
|
|
3
|
+
access_token: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ImageEntity extends HassEntityBase {
|
|
6
|
+
attributes: ImageEntityAttributes;
|
|
7
|
+
}
|
|
8
|
+
export declare const computeImageUrl: (entity: ImageEntity) => string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HomeAssistant } from '../../ha-frontend/home-assistant';
|
|
2
|
+
interface Image {
|
|
3
|
+
filesize: number;
|
|
4
|
+
name: string;
|
|
5
|
+
uploaded_at: string;
|
|
6
|
+
content_type: string;
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const URL_PREFIX = "/api/image/serve/";
|
|
10
|
+
export declare const MEDIA_PREFIX = "media-source://image_upload";
|
|
11
|
+
export interface ImageMutableParams {
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const getIdFromUrl: (url: string) => string | undefined;
|
|
15
|
+
export declare const generateImageThumbnailUrl: (mediaId: string, size?: number, original?: boolean) => string;
|
|
16
|
+
export declare const fetchImages: (hass: HomeAssistant) => Promise<Image[]>;
|
|
17
|
+
export declare const createImage: (hass: HomeAssistant, file: File) => Promise<Image>;
|
|
18
|
+
export declare const updateImage: (hass: HomeAssistant, id: string, updates: Partial<ImageMutableParams>) => Promise<Image>;
|
|
19
|
+
export declare const deleteImage: (hass: HomeAssistant, id: string) => Promise<unknown>;
|
|
20
|
+
export declare const getImageData: (url: string) => Promise<Blob>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Connection, UnsubscribeFunc } from 'home-assistant-js-websocket';
|
|
2
|
+
export interface RenderTemplateResult {
|
|
3
|
+
result: string;
|
|
4
|
+
listeners: TemplateListeners;
|
|
5
|
+
}
|
|
6
|
+
interface TemplateListeners {
|
|
7
|
+
all: boolean;
|
|
8
|
+
domains: string[];
|
|
9
|
+
entities: string[];
|
|
10
|
+
time: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const subscribeRenderTemplate: (conn: Connection, onChange: (result: RenderTemplateResult) => void, params: {
|
|
13
|
+
template: string;
|
|
14
|
+
entity_ids?: string | string[];
|
|
15
|
+
variables?: Record<string, unknown>;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
strict?: boolean;
|
|
18
|
+
}) => Promise<UnsubscribeFunc>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Connection } from 'home-assistant-js-websocket';
|
|
2
|
+
export interface ThemeSettings {
|
|
3
|
+
theme: string;
|
|
4
|
+
dark?: boolean;
|
|
5
|
+
primaryColor?: string;
|
|
6
|
+
accentColor?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ThemeVars {
|
|
9
|
+
'primary-color': string;
|
|
10
|
+
'text-primary-color': string;
|
|
11
|
+
'accent-color': string;
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export type Theme = ThemeVars & {
|
|
15
|
+
modes?: {
|
|
16
|
+
light?: ThemeVars;
|
|
17
|
+
dark?: ThemeVars;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface Themes {
|
|
21
|
+
default_theme: string;
|
|
22
|
+
default_dark_theme: string | null;
|
|
23
|
+
themes: Record<string, Theme>;
|
|
24
|
+
darkMode: boolean;
|
|
25
|
+
theme: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const subscribeThemes: (conn: Connection, onChange: (themes: Themes) => void) => import("home-assistant-js-websocket").UnsubscribeFunc;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface HASSDomEvents {
|
|
3
|
+
}
|
|
4
|
+
}
|
|
5
|
+
export type ValidHassDomEvent = keyof HASSDomEvents;
|
|
6
|
+
export interface HASSDomEvent<T> extends Event {
|
|
7
|
+
detail: T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Dispatches a custom event with an optional detail value.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} type Name of event type.
|
|
13
|
+
* @param {*=} detail Detail value containing event-specific
|
|
14
|
+
* payload.
|
|
15
|
+
* @param {{ bubbles: (boolean|undefined),
|
|
16
|
+
* cancelable: (boolean|undefined),
|
|
17
|
+
* composed: (boolean|undefined) }=}
|
|
18
|
+
* options Object specifying options. These may include:
|
|
19
|
+
* `bubbles` (boolean, defaults to `true`),
|
|
20
|
+
* `cancelable` (boolean, defaults to false), and
|
|
21
|
+
* `node` on which to fire the event (HTMLElement, defaults to `this`).
|
|
22
|
+
* @return {Event} The new event that was fired.
|
|
23
|
+
*/
|
|
24
|
+
export declare const fireEvent: <HassEvent extends ValidHassDomEvent>(node: HTMLElement | Window, type: HassEvent, detail?: HASSDomEvents[HassEvent], options?: {
|
|
25
|
+
bubbles?: boolean;
|
|
26
|
+
cancelable?: boolean;
|
|
27
|
+
composed?: boolean;
|
|
28
|
+
}) => Event;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Auth, Connection, HassConfig, HassEntities, HassEntity, HassServices, HassServiceTarget, MessageBase } from 'home-assistant-js-websocket';
|
|
2
|
+
import { FrontendLocaleData } from './data/frontend-local-data';
|
|
3
|
+
import { Themes, ThemeSettings } from './data/ws-themes';
|
|
4
|
+
export interface Resources {
|
|
5
|
+
[language: string]: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export interface Context {
|
|
8
|
+
id: string;
|
|
9
|
+
parent_id?: string;
|
|
10
|
+
user_id?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ServiceCallResponse {
|
|
13
|
+
context: Context;
|
|
14
|
+
response?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface ServiceCallRequest {
|
|
17
|
+
domain: string;
|
|
18
|
+
service: string;
|
|
19
|
+
serviceData?: Record<string, any>;
|
|
20
|
+
target?: HassServiceTarget;
|
|
21
|
+
}
|
|
22
|
+
export interface HomeAssistant {
|
|
23
|
+
auth: Auth & {
|
|
24
|
+
external?: any;
|
|
25
|
+
};
|
|
26
|
+
connection: Connection;
|
|
27
|
+
connected: boolean;
|
|
28
|
+
states: HassEntities;
|
|
29
|
+
entities: {
|
|
30
|
+
[id: string]: any;
|
|
31
|
+
};
|
|
32
|
+
devices: {
|
|
33
|
+
[id: string]: any;
|
|
34
|
+
};
|
|
35
|
+
areas: {
|
|
36
|
+
[id: string]: any;
|
|
37
|
+
};
|
|
38
|
+
services: HassServices;
|
|
39
|
+
config: HassConfig;
|
|
40
|
+
themes: Themes;
|
|
41
|
+
selectedTheme: ThemeSettings | null;
|
|
42
|
+
panels: any;
|
|
43
|
+
panelUrl: string;
|
|
44
|
+
language: string;
|
|
45
|
+
selectedLanguage: string | null;
|
|
46
|
+
locale: FrontendLocaleData;
|
|
47
|
+
resources: Resources;
|
|
48
|
+
localize: any;
|
|
49
|
+
translationMetadata: any;
|
|
50
|
+
suspendWhenHidden: boolean;
|
|
51
|
+
enableShortcuts: boolean;
|
|
52
|
+
vibrate: boolean;
|
|
53
|
+
debugConnection: boolean;
|
|
54
|
+
dockedSidebar: 'docked' | 'always_hidden' | 'auto';
|
|
55
|
+
defaultPanel: string;
|
|
56
|
+
moreInfoEntityId: string | null;
|
|
57
|
+
user?: any;
|
|
58
|
+
userData?: any;
|
|
59
|
+
hassUrl(path?: any): string;
|
|
60
|
+
callService(domain: ServiceCallRequest['domain'], service: ServiceCallRequest['service'], serviceData?: ServiceCallRequest['serviceData'], target?: ServiceCallRequest['target'], notifyOnError?: boolean, returnResponse?: boolean): Promise<ServiceCallResponse>;
|
|
61
|
+
callApi<T>(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, parameters?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
|
|
62
|
+
fetchWithAuth(path: string, init?: Record<string, any>): Promise<Response>;
|
|
63
|
+
sendWS(msg: MessageBase): void;
|
|
64
|
+
callWS<T>(msg: MessageBase): Promise<T>;
|
|
65
|
+
formatEntityState(stateObj: HassEntity, state?: string): string;
|
|
66
|
+
formatEntityAttributeValue(stateObj: HassEntity, attribute: string, value?: any): string;
|
|
67
|
+
formatEntityAttributeName(stateObj: HassEntity, attribute: string): string;
|
|
68
|
+
}
|
|
69
|
+
/** Return if a component is loaded. */
|
|
70
|
+
export declare const isComponentLoaded: (hass: HomeAssistant, component: string) => boolean;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { HomeAssistant } from './../home-assistant';
|
|
2
|
+
import type { Connection } from 'home-assistant-js-websocket';
|
|
3
|
+
export interface Lovelace {
|
|
4
|
+
config: LovelaceConfig;
|
|
5
|
+
rawConfig: LovelaceRawConfig;
|
|
6
|
+
editMode: boolean;
|
|
7
|
+
urlPath: string | null;
|
|
8
|
+
mode: 'generated' | 'yaml' | 'storage';
|
|
9
|
+
locale: any;
|
|
10
|
+
enableFullEditMode: () => void;
|
|
11
|
+
setEditMode: (editMode: boolean) => void;
|
|
12
|
+
saveConfig: (newConfig: LovelaceRawConfig) => Promise<void>;
|
|
13
|
+
deleteConfig: () => Promise<void>;
|
|
14
|
+
showToast: (params: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function getLovelace(): Lovelace | null;
|
|
17
|
+
export declare function findCardIndex(card: any): Promise<string | null>;
|
|
18
|
+
export type LovelaceCardPath = [number, number] | [number, number, number];
|
|
19
|
+
export type LovelaceContainerPath = [number] | [number, number];
|
|
20
|
+
export declare const parseLovelaceCardPath: (path: LovelaceCardPath) => {
|
|
21
|
+
viewIndex: number;
|
|
22
|
+
sectionIndex?: number;
|
|
23
|
+
cardIndex: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const parseLovelaceContainerPath: (path: LovelaceContainerPath) => {
|
|
26
|
+
viewIndex: number;
|
|
27
|
+
sectionIndex?: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const getLovelaceContainerPath: (path: LovelaceCardPath) => LovelaceContainerPath;
|
|
30
|
+
type FindLovelaceContainer = {
|
|
31
|
+
(config: LovelaceConfig, path: [number]): LovelaceViewRawConfig;
|
|
32
|
+
(config: LovelaceConfig, path: [number, number]): LovelaceSectionRawConfig;
|
|
33
|
+
(config: LovelaceConfig, path: LovelaceContainerPath): LovelaceViewRawConfig | LovelaceSectionRawConfig;
|
|
34
|
+
};
|
|
35
|
+
export declare const findLovelaceContainer: FindLovelaceContainer;
|
|
36
|
+
export declare const findLovelaceCards: (config: LovelaceConfig, path: LovelaceContainerPath) => LovelaceCardConfig[] | undefined;
|
|
37
|
+
export declare const updateLovelaceContainer: (config: LovelaceConfig, path: LovelaceContainerPath, containerConfig: LovelaceViewRawConfig | LovelaceSectionRawConfig) => LovelaceConfig;
|
|
38
|
+
export declare const updateLovelaceCards: (config: LovelaceConfig, path: LovelaceContainerPath, cards: LovelaceCardConfig[]) => LovelaceConfig;
|
|
39
|
+
export interface LovelaceCardEditor extends LovelaceGenericElementEditor {
|
|
40
|
+
setConfig(config: LovelaceCardConfig): void;
|
|
41
|
+
}
|
|
42
|
+
export interface LovelaceGenericElementEditor<C = any> extends HTMLElement {
|
|
43
|
+
hass?: HomeAssistant;
|
|
44
|
+
lovelace?: LovelaceConfig;
|
|
45
|
+
context?: C;
|
|
46
|
+
setConfig(config: any): void;
|
|
47
|
+
focusYamlEditor?: () => void;
|
|
48
|
+
}
|
|
49
|
+
export interface LovelaceDashboardBaseConfig {
|
|
50
|
+
}
|
|
51
|
+
export interface LovelaceCard extends HTMLElement {
|
|
52
|
+
hass?: HomeAssistant;
|
|
53
|
+
isPanel?: boolean;
|
|
54
|
+
preview?: boolean;
|
|
55
|
+
layout?: string;
|
|
56
|
+
getCardSize(): number | Promise<number>;
|
|
57
|
+
getLayoutOptions?(): LovelaceLayoutOptions;
|
|
58
|
+
setConfig(config: LovelaceCardConfig): void;
|
|
59
|
+
}
|
|
60
|
+
export interface LovelaceConfig extends LovelaceDashboardBaseConfig {
|
|
61
|
+
background?: string;
|
|
62
|
+
views: LovelaceViewRawConfig[];
|
|
63
|
+
}
|
|
64
|
+
export interface LovelaceDashboardStrategyConfig extends LovelaceDashboardBaseConfig {
|
|
65
|
+
strategy: LovelaceStrategyConfig;
|
|
66
|
+
}
|
|
67
|
+
export interface LegacyLovelaceConfig extends LovelaceConfig {
|
|
68
|
+
resources?: LovelaceResource[];
|
|
69
|
+
}
|
|
70
|
+
export type LovelaceRawConfig = LovelaceConfig | LovelaceDashboardStrategyConfig;
|
|
71
|
+
export declare function isStrategyDashboard(config: LovelaceRawConfig): config is LovelaceDashboardStrategyConfig;
|
|
72
|
+
export declare const fetchConfig: (conn: Connection, urlPath: string | null, force: boolean) => Promise<LovelaceRawConfig>;
|
|
73
|
+
export declare const saveConfig: (hass: HomeAssistant, urlPath: string | null, config: LovelaceRawConfig) => Promise<void>;
|
|
74
|
+
export declare const deleteConfig: (hass: HomeAssistant, urlPath: string | null) => Promise<void>;
|
|
75
|
+
export interface ShowViewConfig {
|
|
76
|
+
user?: string;
|
|
77
|
+
}
|
|
78
|
+
interface LovelaceViewBackgroundConfig {
|
|
79
|
+
image?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface LovelaceBaseViewConfig {
|
|
82
|
+
index?: number;
|
|
83
|
+
title?: string;
|
|
84
|
+
path?: string;
|
|
85
|
+
icon?: string;
|
|
86
|
+
theme?: string;
|
|
87
|
+
panel?: boolean;
|
|
88
|
+
background?: string | LovelaceViewBackgroundConfig;
|
|
89
|
+
visible?: boolean | ShowViewConfig[];
|
|
90
|
+
subview?: boolean;
|
|
91
|
+
back_path?: string;
|
|
92
|
+
max_columns?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface LovelaceViewConfig extends LovelaceBaseViewConfig {
|
|
95
|
+
type?: string;
|
|
96
|
+
badges?: Array<string | LovelaceBadgeConfig>;
|
|
97
|
+
cards?: LovelaceCardConfig[];
|
|
98
|
+
sections?: LovelaceSectionRawConfig[];
|
|
99
|
+
}
|
|
100
|
+
export interface LovelaceStrategyViewConfig extends LovelaceBaseViewConfig {
|
|
101
|
+
strategy: LovelaceStrategyConfig;
|
|
102
|
+
}
|
|
103
|
+
export type LovelaceViewRawConfig = LovelaceViewConfig | LovelaceStrategyViewConfig;
|
|
104
|
+
export declare function isStrategyView(view: LovelaceViewRawConfig): view is LovelaceStrategyViewConfig;
|
|
105
|
+
export interface LovelaceBaseSectionConfig {
|
|
106
|
+
visibility?: Condition[];
|
|
107
|
+
column_span?: number;
|
|
108
|
+
row_span?: number;
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Use heading card instead.
|
|
111
|
+
*/
|
|
112
|
+
title?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface LovelaceSectionConfig extends LovelaceBaseSectionConfig {
|
|
115
|
+
type?: string;
|
|
116
|
+
cards?: LovelaceCardConfig[];
|
|
117
|
+
}
|
|
118
|
+
export interface LovelaceStrategySectionConfig extends LovelaceBaseSectionConfig {
|
|
119
|
+
strategy: LovelaceStrategyConfig;
|
|
120
|
+
}
|
|
121
|
+
export type LovelaceSectionRawConfig = LovelaceSectionConfig | LovelaceStrategySectionConfig;
|
|
122
|
+
export declare function isStrategySection(section: LovelaceSectionRawConfig): section is LovelaceStrategySectionConfig;
|
|
123
|
+
export interface LovelaceStrategyConfig {
|
|
124
|
+
type: string;
|
|
125
|
+
[key: string]: any;
|
|
126
|
+
}
|
|
127
|
+
export interface LovelaceBadgeConfig {
|
|
128
|
+
type: string;
|
|
129
|
+
[key: string]: any;
|
|
130
|
+
visibility?: Condition[];
|
|
131
|
+
}
|
|
132
|
+
export declare const ensureBadgeConfig: (config: Partial<LovelaceBadgeConfig> | string) => LovelaceBadgeConfig;
|
|
133
|
+
export interface LovelaceCardConfig {
|
|
134
|
+
index?: number;
|
|
135
|
+
view_index?: number;
|
|
136
|
+
view_layout?: any;
|
|
137
|
+
layout_options?: LovelaceLayoutOptions;
|
|
138
|
+
type: string;
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
visibility?: Condition[];
|
|
141
|
+
}
|
|
142
|
+
export type LovelaceLayoutOptions = {
|
|
143
|
+
grid_columns?: number | 'full';
|
|
144
|
+
grid_rows?: number | 'auto';
|
|
145
|
+
grid_max_columns?: number;
|
|
146
|
+
grid_min_columns?: number;
|
|
147
|
+
grid_min_rows?: number;
|
|
148
|
+
grid_max_rows?: number;
|
|
149
|
+
};
|
|
150
|
+
export interface LovelaceGridOptions {
|
|
151
|
+
columns?: number | 'full';
|
|
152
|
+
rows?: number | 'auto';
|
|
153
|
+
max_columns?: number;
|
|
154
|
+
min_columns?: number;
|
|
155
|
+
min_rows?: number;
|
|
156
|
+
max_rows?: number;
|
|
157
|
+
}
|
|
158
|
+
export type Condition = NumericStateCondition | StateCondition | ScreenCondition | UserCondition | OrCondition | AndCondition;
|
|
159
|
+
export interface LegacyCondition {
|
|
160
|
+
entity?: string;
|
|
161
|
+
state?: string | string[];
|
|
162
|
+
state_not?: string | string[];
|
|
163
|
+
}
|
|
164
|
+
interface BaseCondition {
|
|
165
|
+
condition: string;
|
|
166
|
+
}
|
|
167
|
+
export interface NumericStateCondition extends BaseCondition {
|
|
168
|
+
condition: 'numeric_state';
|
|
169
|
+
entity?: string;
|
|
170
|
+
below?: string | number;
|
|
171
|
+
above?: string | number;
|
|
172
|
+
}
|
|
173
|
+
export interface StateCondition extends BaseCondition {
|
|
174
|
+
condition: 'state';
|
|
175
|
+
entity?: string;
|
|
176
|
+
state?: string | string[];
|
|
177
|
+
state_not?: string | string[];
|
|
178
|
+
}
|
|
179
|
+
export interface ScreenCondition extends BaseCondition {
|
|
180
|
+
condition: 'screen';
|
|
181
|
+
media_query?: string;
|
|
182
|
+
}
|
|
183
|
+
export interface UserCondition extends BaseCondition {
|
|
184
|
+
condition: 'user';
|
|
185
|
+
users?: string[];
|
|
186
|
+
}
|
|
187
|
+
export interface OrCondition extends BaseCondition {
|
|
188
|
+
condition: 'or';
|
|
189
|
+
conditions?: Condition[];
|
|
190
|
+
}
|
|
191
|
+
export interface AndCondition extends BaseCondition {
|
|
192
|
+
condition: 'and';
|
|
193
|
+
conditions?: Condition[];
|
|
194
|
+
}
|
|
195
|
+
export type LovelaceResource = {
|
|
196
|
+
id: string;
|
|
197
|
+
type: 'css' | 'js' | 'module' | 'html';
|
|
198
|
+
url: string;
|
|
199
|
+
};
|
|
200
|
+
export type LovelaceResourcesMutableParams = {
|
|
201
|
+
res_type: LovelaceResource['type'];
|
|
202
|
+
url: string;
|
|
203
|
+
};
|
|
204
|
+
export declare const fetchResources: (conn: Connection) => Promise<LovelaceResource[]>;
|
|
205
|
+
export declare const createResource: (hass: HomeAssistant, values: LovelaceResourcesMutableParams) => Promise<LovelaceResource>;
|
|
206
|
+
export declare const updateResource: (hass: HomeAssistant, id: string, updates: Partial<LovelaceResourcesMutableParams>) => Promise<LovelaceResource>;
|
|
207
|
+
export declare const deleteResource: (hass: HomeAssistant, id: string) => Promise<unknown>;
|
|
208
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HassEntity } from 'home-assistant-js-websocket';
|
|
2
|
+
/** Compute the object ID of a state. */
|
|
3
|
+
export declare const computeObjectId: (entityId: string) => string;
|
|
4
|
+
export declare const computeStateNameFromEntityAttributes: (entityId: string, attributes: Record<string, any>) => string;
|
|
5
|
+
export declare const computeStateName: (stateObj: HassEntity) => string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { HomeAssistant } from '@types';
|
|
2
|
+
import type { HassEntity } from 'home-assistant-js-websocket';
|
|
3
|
+
export declare const findEntities: (hass: HomeAssistant, maxEntities: number, entities: string[], entitiesFallback: string[], includeDomains?: string[], entityFilter?: (stateObj: HassEntity) => boolean) => any[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PropertyValues } from 'lit';
|
|
2
|
+
type EntityCategory = 'config' | 'diagnostic';
|
|
3
|
+
export interface EntityRegistryDisplayEntry {
|
|
4
|
+
entity_id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
device_id?: string;
|
|
8
|
+
area_id?: string;
|
|
9
|
+
labels: string[];
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
entity_category?: EntityCategory;
|
|
12
|
+
translation_key?: string;
|
|
13
|
+
platform?: string;
|
|
14
|
+
display_precision?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function hasConfigChanged(element: any, changedProps: PropertyValues): boolean;
|
|
17
|
+
export declare function hasConfigOrEntityChanged(element: any, changedProps: PropertyValues): boolean;
|
|
18
|
+
export declare function hasConfigOrEntitiesChanged(element: any, changedProps: PropertyValues): boolean;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HomeAssistant } from '@types';
|
|
2
|
+
import { HaMapEntity } from 'types/config';
|
|
3
|
+
import { FrontendLocaleData, TimeZone } from 'types/ha-frontend/data/frontend-local-data';
|
|
4
|
+
export interface Address {
|
|
5
|
+
streetNumber: string;
|
|
6
|
+
streetName: string;
|
|
7
|
+
sublocality: string;
|
|
8
|
+
city: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const getEntityId: (entity: string | HaMapEntity) => string;
|
|
11
|
+
export declare const getAddress: import("memoize-one").MemoizedFn<(lat: number, lng: number, apiKey: string) => Promise<Address | null>>;
|
|
12
|
+
export declare const LOCAL_TIME_ZONE: string;
|
|
13
|
+
export declare const resolveTimeZone: (option: TimeZone, serverTimeZone: string) => string;
|
|
14
|
+
export declare const useAmPm: import("memoize-one").MemoizedFn<(locale: FrontendLocaleData) => boolean>;
|
|
15
|
+
export declare const formatTimeWeekday: (dateObj: Date, locale: FrontendLocaleData, config: HomeAssistant["config"]) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-map-card",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Lovelace custom map card for Home Assistant",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"home-assistant",
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
"author": "Viet Ngoc",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/ngocjohn/extra-map-card",
|
|
17
|
+
"url": "git+https://github.com/ngocjohn/extra-map-card.git",
|
|
18
18
|
"repo": "ngocjohn/extra-map-card"
|
|
19
19
|
},
|
|
20
|
-
"main": "dist/
|
|
21
|
-
"module": "dist/
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"module": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
22
23
|
"type": "module",
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
25
|
-
"import": "./dist/
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
"files": [
|