diff --git a/src/language-service/src/schemas/lovelace/cards/index.d.ts b/src/language-service/src/schemas/lovelace/cards/index.d.ts index 7abcf4d83d..12815bcec3 100644 --- a/src/language-service/src/schemas/lovelace/cards/index.d.ts +++ b/src/language-service/src/schemas/lovelace/cards/index.d.ts @@ -39,5 +39,6 @@ export * as Sensor from "./sensor"; export * as ShoppingList from "./shopping_list"; export * as StatisticsGraph from "./statistics_graph"; export * as Thermostat from "./thermostat"; +export * as Tile from "./tile"; export * as VerticalStack from "./vertical_stack"; export * as WeatherForecast from "./weather_forecast"; diff --git a/src/language-service/src/schemas/lovelace/cards/tile.ts b/src/language-service/src/schemas/lovelace/cards/tile.ts new file mode 100644 index 0000000000..80fb5ae4a2 --- /dev/null +++ b/src/language-service/src/schemas/lovelace/cards/tile.ts @@ -0,0 +1,115 @@ +/** + * Tile Card + * Sources: + * - https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/cards/hui-tile-card.ts + * - https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/cards/types.ts + * - https://github.com/home-assistant/frontend/blob/dev/src/data/lovelace.ts + */ + +import { Action } from "../actions"; +import { Entity as EntityString } from "../../types"; + +export interface Schema { + /** + * The tile card gives you a quick overview of your entity. The card allows you to toggle the entity and show the more info dialog. + * https://www.home-assistant.io/dashboards/tile/ + */ + type: "tile"; + + /** + * Set the color when the entity is active. By default, the color is based on state, domain, and device_class of your entity. It accepts color token or hex color code. + * https://www.home-assistant.io/dashboards/tile/#color + */ + color?: string; + + /** + * Entity to show in the tile card + * https://www.home-assistant.io/dashboards/tile/#entity + */ + entity: EntityString; + + /** + * + */ + features?: TileFeatures[]; + + /** + * Overwrites icon. + * https://www.home-assistant.io/dashboards/tile/#icon + */ + icon?: string; + + /** + * Action taken on icon card tap. By default, it will toggle the entity (if possible), otherwise, show the “more-info” dialog. + * https://www.home-assistant.io/dashboards/tile/#icon_tap_action + */ + icon_tap_action?: Action; + + /** + * Overwrites friendly name. + * https://www.home-assistant.io/dashboards/tile/#name + */ + name?: string; + + /** + * If your entity has a picture, it will replace the icon. + * ttps://www.home-assistant.io/dashboards/tile/#show_entity_picture + */ + show_entity_picture?: boolean; + + /** + * Action taken on card tap. By default, it will show the “more-info” dialog. + * https://www.home-assistant.io/dashboards/tile/#tap_action + */ + tap_action?: Action; +} + +type TileFeatures = + | CoverOpenCloseFeature + | CoverTiltFeature + | LightBrightnessFeature + | VacuumCommandsFeature; + +interface CoverOpenCloseFeature { + /** + * Widget that display buttons to open, close or stop a cover. + * https://www.home-assistant.io/dashboards/tile/#cover-openclose + */ + type: "cover-open-close"; +} + +interface CoverTiltFeature { + /** + * Widget that display buttons to open, close or stop a cover. + * https://www.home-assistant.io/dashboards/tile/#cover-tilt + */ + type: "cover-tilt"; +} + +interface LightBrightnessFeature { + /** + * Widget that display a slider to select the brightness for a light. + * https://www.home-assistant.io/dashboards/tile/#light-brightness + */ + type: "light-brightness"; +} + +type VacuumCommands = + | "start_pause" + | "stop" + | "clean_spot" + | "locate" + | "return_home"; +interface VacuumCommandsFeature { + /** + * Widget that display buttons to control a vacuum. + * https://www.home-assistant.io/dashboards/tile/#vacuum-commands + */ + type: "vacuum-commands"; + + /** + * List of commands to show on the card. + * https://www.home-assistant.io/dashboards/tile/#commands + */ + commands: VacuumCommands[]; +} diff --git a/src/language-service/src/schemas/lovelace/types.ts b/src/language-service/src/schemas/lovelace/types.ts index 383650f6dc..a8ef8cb03c 100644 --- a/src/language-service/src/schemas/lovelace/types.ts +++ b/src/language-service/src/schemas/lovelace/types.ts @@ -46,6 +46,7 @@ export type Card = | cards.ShoppingList.Schema | cards.StatisticsGraph.Schema | cards.Thermostat.Schema + | cards.Tile.Schema | cards.VerticalStack.Schema | cards.WeatherForecast.Schema;