mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +00:00
Replace all default exports in common/ with named exports (#3790)
This commit is contained in:
parent
f871387fa6
commit
1f4d359050
@ -2,7 +2,7 @@ import "@polymer/paper-styles/element-styles/paper-material-styles";
|
|||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { EventsMixin } from "../mixins/events-mixin";
|
import { EventsMixin } from "../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../mixins/localize-mixin";
|
import LocalizeMixin from "../mixins/localize-mixin";
|
||||||
import { fetchThumbnailUrlWithCache } from "../data/camera";
|
import { fetchThumbnailUrlWithCache } from "../data/camera";
|
||||||
|
@ -6,10 +6,10 @@ import "../components/entity/ha-entity-toggle";
|
|||||||
import "../components/ha-card";
|
import "../components/ha-card";
|
||||||
import "../state-summary/state-card-content";
|
import "../state-summary/state-card-content";
|
||||||
|
|
||||||
import computeStateDomain from "../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import stateMoreInfoType from "../common/entity/state_more_info_type";
|
import { stateMoreInfoType } from "../common/entity/state_more_info_type";
|
||||||
import canToggleState from "../common/entity/can_toggle_state";
|
import { canToggleState } from "../common/entity/can_toggle_state";
|
||||||
import { EventsMixin } from "../mixins/events-mixin";
|
import { EventsMixin } from "../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../mixins/localize-mixin";
|
import LocalizeMixin from "../mixins/localize-mixin";
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "../components/state-history-charts";
|
import "../components/state-history-charts";
|
||||||
import "../data/ha-state-history-data";
|
import "../data/ha-state-history-data";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { EventsMixin } from "../mixins/events-mixin";
|
import { EventsMixin } from "../mixins/events-mixin";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,7 +8,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import HassMediaPlayerEntity from "../util/hass-media-player-model";
|
import HassMediaPlayerEntity from "../util/hass-media-player-model";
|
||||||
import { fetchMediaPlayerThumbnailWithCache } from "../data/media-player";
|
import { fetchMediaPlayerThumbnailWithCache } from "../data/media-player";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { EventsMixin } from "../mixins/events-mixin";
|
import { EventsMixin } from "../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../mixins/localize-mixin";
|
import LocalizeMixin from "../mixins/localize-mixin";
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "../components/ha-card";
|
import "../components/ha-card";
|
||||||
import "../components/ha-markdown";
|
import "../components/ha-markdown";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import LocalizeMixin from "../mixins/localize-mixin";
|
import LocalizeMixin from "../mixins/localize-mixin";
|
||||||
import computeObjectId from "../common/entity/compute_object_id";
|
import { computeObjectId } from "../common/entity/compute_object_id";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @appliesMixin LocalizeMixin
|
* @appliesMixin LocalizeMixin
|
||||||
|
@ -4,7 +4,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "../components/ha-card";
|
import "../components/ha-card";
|
||||||
import "../components/ha-icon";
|
import "../components/ha-icon";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { EventsMixin } from "../mixins/events-mixin";
|
import { EventsMixin } from "../mixins/events-mixin";
|
||||||
|
|
||||||
class HaPlantCard extends EventsMixin(PolymerElement) {
|
class HaPlantCard extends EventsMixin(PolymerElement) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
|
|
||||||
import "../components/ha-card";
|
import "../components/ha-card";
|
||||||
import "../components/ha-icon";
|
import "../components/ha-icon";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
|
|
||||||
export default function attributeClassNames(
|
export const attributeClassNames = (
|
||||||
stateObj: HassEntity,
|
stateObj: HassEntity,
|
||||||
attributes: string[]
|
attributes: string[]
|
||||||
): string {
|
): string => {
|
||||||
if (!stateObj) {
|
if (!stateObj) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -13,4 +13,4 @@ export default function attributeClassNames(
|
|||||||
)
|
)
|
||||||
.filter((attr) => attr !== "")
|
.filter((attr) => attr !== "")
|
||||||
.join(" ");
|
.join(" ");
|
||||||
}
|
};
|
||||||
|
@ -2,7 +2,7 @@ import { HassEntity } from "home-assistant-js-websocket";
|
|||||||
|
|
||||||
/** Return an icon representing a binary sensor state. */
|
/** Return an icon representing a binary sensor state. */
|
||||||
|
|
||||||
export default function binarySensorIcon(state: HassEntity) {
|
export const binarySensorIcon = (state: HassEntity) => {
|
||||||
const activated = state.state && state.state === "off";
|
const activated = state.state && state.state === "off";
|
||||||
switch (state.attributes.device_class) {
|
switch (state.attributes.device_class) {
|
||||||
case "battery":
|
case "battery":
|
||||||
@ -48,4 +48,4 @@ export default function binarySensorIcon(state: HassEntity) {
|
|||||||
default:
|
default:
|
||||||
return activated ? "hass:radiobox-blank" : "hass:checkbox-marked-circle";
|
return activated ? "hass:radiobox-blank" : "hass:checkbox-marked-circle";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
export default function canToggleDomain(hass: HomeAssistant, domain: string) {
|
export const canToggleDomain = (hass: HomeAssistant, domain: string) => {
|
||||||
const services = hass.services[domain];
|
const services = hass.services[domain];
|
||||||
if (!services) {
|
if (!services) {
|
||||||
return false;
|
return false;
|
||||||
@ -13,4 +13,4 @@ export default function canToggleDomain(hass: HomeAssistant, domain: string) {
|
|||||||
return "open_cover" in services;
|
return "open_cover" in services;
|
||||||
}
|
}
|
||||||
return "turn_on" in services;
|
return "turn_on" in services;
|
||||||
}
|
};
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import canToggleDomain from "./can_toggle_domain";
|
import { canToggleDomain } from "./can_toggle_domain";
|
||||||
import computeStateDomain from "./compute_state_domain";
|
import { computeStateDomain } from "./compute_state_domain";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import { supportsFeature } from "./supports-feature";
|
import { supportsFeature } from "./supports-feature";
|
||||||
|
|
||||||
export default function canToggleState(
|
export const canToggleState = (hass: HomeAssistant, stateObj: HassEntity) => {
|
||||||
hass: HomeAssistant,
|
|
||||||
stateObj: HassEntity
|
|
||||||
) {
|
|
||||||
const domain = computeStateDomain(stateObj);
|
const domain = computeStateDomain(stateObj);
|
||||||
if (domain === "group") {
|
if (domain === "group") {
|
||||||
return stateObj.state === "on" || stateObj.state === "off";
|
return stateObj.state === "on" || stateObj.state === "off";
|
||||||
@ -17,4 +14,4 @@ export default function canToggleState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return canToggleDomain(hass, domain);
|
return canToggleDomain(hass, domain);
|
||||||
}
|
};
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export default function computeDomain(entityId: string): string {
|
export const computeDomain = (entityId: string): string => {
|
||||||
return entityId.substr(0, entityId.indexOf("."));
|
return entityId.substr(0, entityId.indexOf("."));
|
||||||
}
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/** Compute the object ID of a state. */
|
/** Compute the object ID of a state. */
|
||||||
export default function computeObjectId(entityId: string): string {
|
export const computeObjectId = (entityId: string): string => {
|
||||||
return entityId.substr(entityId.indexOf(".") + 1);
|
return entityId.substr(entityId.indexOf(".") + 1);
|
||||||
}
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import computeStateDomain from "./compute_state_domain";
|
import { computeStateDomain } from "./compute_state_domain";
|
||||||
import formatDateTime from "../datetime/format_date_time";
|
import formatDateTime from "../datetime/format_date_time";
|
||||||
import formatDate from "../datetime/format_date";
|
import formatDate from "../datetime/format_date";
|
||||||
import formatTime from "../datetime/format_time";
|
import formatTime from "../datetime/format_time";
|
||||||
import { LocalizeFunc } from "../translations/localize";
|
import { LocalizeFunc } from "../translations/localize";
|
||||||
|
|
||||||
export default (
|
export const computeStateDisplay = (
|
||||||
localize: LocalizeFunc,
|
localize: LocalizeFunc,
|
||||||
stateObj: HassEntity,
|
stateObj: HassEntity,
|
||||||
language: string
|
language: string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import computeDomain from "./compute_domain";
|
import { computeDomain } from "./compute_domain";
|
||||||
|
|
||||||
export default function computeStateDomain(stateObj: HassEntity) {
|
export const computeStateDomain = (stateObj: HassEntity) => {
|
||||||
return computeDomain(stateObj.entity_id);
|
return computeDomain(stateObj.entity_id);
|
||||||
}
|
};
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import computeObjectId from "./compute_object_id";
|
import { computeObjectId } from "./compute_object_id";
|
||||||
|
|
||||||
export default (stateObj: HassEntity): string =>
|
export const computeStateName = (stateObj: HassEntity): string => {
|
||||||
stateObj.attributes.friendly_name === undefined
|
return stateObj.attributes.friendly_name === undefined
|
||||||
? computeObjectId(stateObj.entity_id).replace(/_/g, " ")
|
? computeObjectId(stateObj.entity_id).replace(/_/g, " ")
|
||||||
: stateObj.attributes.friendly_name || "";
|
: stateObj.attributes.friendly_name || "";
|
||||||
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/** Return an icon representing a cover state. */
|
/** Return an icon representing a cover state. */
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import domainIcon from "./domain_icon";
|
import { domainIcon } from "./domain_icon";
|
||||||
|
|
||||||
export default function coverIcon(state: HassEntity): string {
|
export const coverIcon = (state: HassEntity): string => {
|
||||||
const open = state.state !== "closed";
|
const open = state.state !== "closed";
|
||||||
switch (state.attributes.device_class) {
|
switch (state.attributes.device_class) {
|
||||||
case "garage":
|
case "garage":
|
||||||
@ -18,4 +18,4 @@ export default function coverIcon(state: HassEntity): string {
|
|||||||
default:
|
default:
|
||||||
return domainIcon("cover", state.state);
|
return domainIcon("cover", state.state);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -48,7 +48,7 @@ const fixedIcons = {
|
|||||||
weblink: "hass:open-in-new",
|
weblink: "hass:open-in-new",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function domainIcon(domain: string, state?: string): string {
|
export const domainIcon = (domain: string, state?: string): string => {
|
||||||
if (domain in fixedIcons) {
|
if (domain in fixedIcons) {
|
||||||
return fixedIcons[domain];
|
return fixedIcons[domain];
|
||||||
}
|
}
|
||||||
@ -103,4 +103,4 @@ export default function domainIcon(domain: string, state?: string): string {
|
|||||||
);
|
);
|
||||||
return DEFAULT_DOMAIN_ICON;
|
return DEFAULT_DOMAIN_ICON;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import computeDomain from "./compute_domain";
|
import { computeDomain } from "./compute_domain";
|
||||||
|
|
||||||
export type FilterFunc = (entityId: string) => boolean;
|
export type FilterFunc = (entityId: string) => boolean;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { DEFAULT_VIEW_ENTITY_ID } from "../const";
|
|||||||
import { GroupEntity } from "../../types";
|
import { GroupEntity } from "../../types";
|
||||||
|
|
||||||
// Return an ordered array of available views
|
// Return an ordered array of available views
|
||||||
export default function extractViews(entities: HassEntities): GroupEntity[] {
|
export const extractViews = (entities: HassEntities): GroupEntity[] => {
|
||||||
const views: GroupEntity[] = [];
|
const views: GroupEntity[] = [];
|
||||||
|
|
||||||
Object.keys(entities).forEach((entityId) => {
|
Object.keys(entities).forEach((entityId) => {
|
||||||
@ -24,4 +24,4 @@ export default function extractViews(entities: HassEntities): GroupEntity[] {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return views;
|
return views;
|
||||||
}
|
};
|
||||||
|
@ -2,10 +2,10 @@ import { HassEntity } from "home-assistant-js-websocket";
|
|||||||
import { supportsFeature } from "./supports-feature";
|
import { supportsFeature } from "./supports-feature";
|
||||||
|
|
||||||
// Expects classNames to be an object mapping feature-bit -> className
|
// Expects classNames to be an object mapping feature-bit -> className
|
||||||
export default function featureClassNames(
|
export const featureClassNames = (
|
||||||
stateObj: HassEntity,
|
stateObj: HassEntity,
|
||||||
classNames: { [feature: number]: string }
|
classNames: { [feature: number]: string }
|
||||||
) {
|
) => {
|
||||||
if (!stateObj || !stateObj.attributes.supported_features) {
|
if (!stateObj || !stateObj.attributes.supported_features) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -16,4 +16,4 @@ export default function featureClassNames(
|
|||||||
)
|
)
|
||||||
.filter((attr) => attr !== "")
|
.filter((attr) => attr !== "")
|
||||||
.join(" ");
|
.join(" ");
|
||||||
}
|
};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { HassEntities } from "home-assistant-js-websocket";
|
import { HassEntities } from "home-assistant-js-websocket";
|
||||||
import { GroupEntity } from "../../types";
|
import { GroupEntity } from "../../types";
|
||||||
|
|
||||||
export default function getGroupEntities(
|
export const getGroupEntities = (
|
||||||
entities: HassEntities,
|
entities: HassEntities,
|
||||||
group: GroupEntity
|
group: GroupEntity
|
||||||
) {
|
) => {
|
||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
group.attributes.entity_id.forEach((entityId) => {
|
group.attributes.entity_id.forEach((entityId) => {
|
||||||
@ -16,4 +16,4 @@ export default function getGroupEntities(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { HassEntities } from "home-assistant-js-websocket";
|
import { HassEntities } from "home-assistant-js-websocket";
|
||||||
import computeDomain from "./compute_domain";
|
import { computeDomain } from "./compute_domain";
|
||||||
import getGroupEntities from "./get_group_entities";
|
import { getGroupEntities } from "./get_group_entities";
|
||||||
import { GroupEntity } from "../../types";
|
import { GroupEntity } from "../../types";
|
||||||
|
|
||||||
// Return an object containing all entities that the view will show
|
// Return an object containing all entities that the view will show
|
||||||
// including embedded groups.
|
// including embedded groups.
|
||||||
export default function getViewEntities(
|
export const getViewEntities = (
|
||||||
entities: HassEntities,
|
entities: HassEntities,
|
||||||
view: GroupEntity
|
view: GroupEntity
|
||||||
): HassEntities {
|
): HassEntities => {
|
||||||
const viewEntities = {};
|
const viewEntities = {};
|
||||||
|
|
||||||
view.attributes.entity_id.forEach((entityId) => {
|
view.attributes.entity_id.forEach((entityId) => {
|
||||||
@ -32,4 +32,4 @@ export default function getViewEntities(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return viewEntities;
|
return viewEntities;
|
||||||
}
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
|
|
||||||
export default function hasLocation(stateObj: HassEntity) {
|
export const hasLocation = (stateObj: HassEntity) => {
|
||||||
return (
|
return (
|
||||||
"latitude" in stateObj.attributes && "longitude" in stateObj.attributes
|
"latitude" in stateObj.attributes && "longitude" in stateObj.attributes
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/** Return an icon representing an input datetime state. */
|
/** Return an icon representing an input datetime state. */
|
||||||
import domainIcon from "./domain_icon";
|
import { domainIcon } from "./domain_icon";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
|
|
||||||
export default function inputDateTimeIcon(state: HassEntity): string {
|
export const inputDateTimeIcon = (state: HassEntity): string => {
|
||||||
if (!state.attributes.has_date) {
|
if (!state.attributes.has_date) {
|
||||||
return "hass:clock";
|
return "hass:clock";
|
||||||
}
|
}
|
||||||
@ -10,4 +10,4 @@ export default function inputDateTimeIcon(state: HassEntity): string {
|
|||||||
return "hass:calendar";
|
return "hass:calendar";
|
||||||
}
|
}
|
||||||
return domainIcon("input_datetime");
|
return domainIcon("input_datetime");
|
||||||
}
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** Return an icon representing a sensor state. */
|
/** Return an icon representing a sensor state. */
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { UNIT_C, UNIT_F } from "../const";
|
import { UNIT_C, UNIT_F } from "../const";
|
||||||
import domainIcon from "./domain_icon";
|
import { domainIcon } from "./domain_icon";
|
||||||
|
|
||||||
const fixedDeviceClassIcons = {
|
const fixedDeviceClassIcons = {
|
||||||
humidity: "hass:water-percent",
|
humidity: "hass:water-percent",
|
||||||
@ -12,7 +12,7 @@ const fixedDeviceClassIcons = {
|
|||||||
signal_strength: "hass:wifi",
|
signal_strength: "hass:wifi",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function sensorIcon(state: HassEntity) {
|
export const sensorIcon = (state: HassEntity) => {
|
||||||
const dclass = state.attributes.device_class;
|
const dclass = state.attributes.device_class;
|
||||||
|
|
||||||
if (dclass && dclass in fixedDeviceClassIcons) {
|
if (dclass && dclass in fixedDeviceClassIcons) {
|
||||||
@ -49,4 +49,4 @@ export default function sensorIcon(state: HassEntity) {
|
|||||||
return "hass:thermometer";
|
return "hass:thermometer";
|
||||||
}
|
}
|
||||||
return domainIcon("sensor");
|
return domainIcon("sensor");
|
||||||
}
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import computeDomain from "./compute_domain";
|
import { computeDomain } from "./compute_domain";
|
||||||
import { HassEntities } from "home-assistant-js-websocket";
|
import { HassEntities } from "home-assistant-js-websocket";
|
||||||
import { GroupEntity } from "../../types";
|
import { GroupEntity } from "../../types";
|
||||||
|
|
||||||
// Split a collection into a list of groups and a 'rest' list of ungrouped
|
// Split a collection into a list of groups and a 'rest' list of ungrouped
|
||||||
// entities.
|
// entities.
|
||||||
// Returns { groups: [], ungrouped: {} }
|
// Returns { groups: [], ungrouped: {} }
|
||||||
export default function splitByGroups(entities: HassEntities) {
|
export const splitByGroups = (entities: HassEntities) => {
|
||||||
const groups: GroupEntity[] = [];
|
const groups: GroupEntity[] = [];
|
||||||
const ungrouped: HassEntities = {};
|
const ungrouped: HassEntities = {};
|
||||||
|
|
||||||
@ -26,4 +26,4 @@ export default function splitByGroups(entities: HassEntities) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return { groups, ungrouped };
|
return { groups, ungrouped };
|
||||||
}
|
};
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import canToggleState from "./can_toggle_state";
|
import { canToggleState } from "./can_toggle_state";
|
||||||
import computeStateDomain from "./compute_state_domain";
|
import { computeStateDomain } from "./compute_state_domain";
|
||||||
import { DOMAINS_WITH_CARD } from "../const";
|
import { DOMAINS_WITH_CARD } from "../const";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
export default function stateCardType(
|
export const stateCardType = (hass: HomeAssistant, stateObj: HassEntity) => {
|
||||||
hass: HomeAssistant,
|
|
||||||
stateObj: HassEntity
|
|
||||||
) {
|
|
||||||
if (stateObj.state === "unavailable") {
|
if (stateObj.state === "unavailable") {
|
||||||
return "display";
|
return "display";
|
||||||
}
|
}
|
||||||
@ -24,4 +21,4 @@ export default function stateCardType(
|
|||||||
return "toggle";
|
return "toggle";
|
||||||
}
|
}
|
||||||
return "display";
|
return "display";
|
||||||
}
|
};
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
/** Return an icon representing a state. */
|
/** Return an icon representing a state. */
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { DEFAULT_DOMAIN_ICON } from "../const";
|
import { DEFAULT_DOMAIN_ICON } from "../const";
|
||||||
|
import { binarySensorIcon } from "./binary_sensor_icon";
|
||||||
|
|
||||||
import computeDomain from "./compute_domain";
|
import { computeDomain } from "./compute_domain";
|
||||||
import domainIcon from "./domain_icon";
|
import { domainIcon } from "./domain_icon";
|
||||||
|
import { coverIcon } from "./cover_icon";
|
||||||
import binarySensorIcon from "./binary_sensor_icon";
|
import { sensorIcon } from "./sensor_icon";
|
||||||
import coverIcon from "./cover_icon";
|
import { inputDateTimeIcon } from "./input_dateteime_icon";
|
||||||
import sensorIcon from "./sensor_icon";
|
|
||||||
import inputDateTimeIcon from "./input_dateteime_icon";
|
|
||||||
|
|
||||||
const domainIcons = {
|
const domainIcons = {
|
||||||
binary_sensor: binarySensorIcon,
|
binary_sensor: binarySensorIcon,
|
||||||
@ -17,7 +16,7 @@ const domainIcons = {
|
|||||||
input_datetime: inputDateTimeIcon,
|
input_datetime: inputDateTimeIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function stateIcon(state: HassEntity) {
|
export const stateIcon = (state: HassEntity) => {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return DEFAULT_DOMAIN_ICON;
|
return DEFAULT_DOMAIN_ICON;
|
||||||
}
|
}
|
||||||
@ -31,4 +30,4 @@ export default function stateIcon(state: HassEntity) {
|
|||||||
return domainIcons[domain](state);
|
return domainIcons[domain](state);
|
||||||
}
|
}
|
||||||
return domainIcon(domain, state.state);
|
return domainIcon(domain, state.state);
|
||||||
}
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import computeStateDomain from "./compute_state_domain";
|
import { computeStateDomain } from "./compute_state_domain";
|
||||||
import { DOMAINS_HIDE_MORE_INFO, DOMAINS_WITH_MORE_INFO } from "../const";
|
import { DOMAINS_HIDE_MORE_INFO, DOMAINS_WITH_MORE_INFO } from "../const";
|
||||||
|
|
||||||
export default function stateMoreInfoType(stateObj: HassEntity) {
|
export const stateMoreInfoType = (stateObj: HassEntity) => {
|
||||||
const domain = computeStateDomain(stateObj);
|
const domain = computeStateDomain(stateObj);
|
||||||
|
|
||||||
if (DOMAINS_WITH_MORE_INFO.includes(domain)) {
|
if (DOMAINS_WITH_MORE_INFO.includes(domain)) {
|
||||||
@ -12,4 +12,4 @@ export default function stateMoreInfoType(stateObj: HassEntity) {
|
|||||||
return "hidden";
|
return "hidden";
|
||||||
}
|
}
|
||||||
return "default";
|
return "default";
|
||||||
}
|
};
|
||||||
|
@ -3,15 +3,12 @@
|
|||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* const states = [state1, state2]
|
* const states = [state1, state2]
|
||||||
* states.sort(statesSortByName);
|
* states.sort(statessortStatesByName);
|
||||||
*/
|
*/
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import computeStateName from "./compute_state_name";
|
import { computeStateName } from "./compute_state_name";
|
||||||
|
|
||||||
export default function sortStatesByName(
|
export const sortStatesByName = (entityA: HassEntity, entityB: HassEntity) => {
|
||||||
entityA: HassEntity,
|
|
||||||
entityB: HassEntity
|
|
||||||
) {
|
|
||||||
const nameA = computeStateName(entityA);
|
const nameA = computeStateName(entityA);
|
||||||
const nameB = computeStateName(entityB);
|
const nameB = computeStateName(entityB);
|
||||||
if (nameA < nameB) {
|
if (nameA < nameB) {
|
||||||
@ -21,4 +18,4 @@ export default function sortStatesByName(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import durationToSeconds from "../datetime/duration_to_seconds";
|
import durationToSeconds from "../datetime/duration_to_seconds";
|
||||||
|
|
||||||
export default function timerTimeRemaining(stateObj: HassEntity) {
|
export const timerTimeRemaining = (stateObj: HassEntity) => {
|
||||||
let timeRemaining = durationToSeconds(stateObj.attributes.remaining);
|
let timeRemaining = durationToSeconds(stateObj.attributes.remaining);
|
||||||
|
|
||||||
if (stateObj.state === "active") {
|
if (stateObj.state === "active") {
|
||||||
@ -11,4 +11,4 @@ export default function timerTimeRemaining(stateObj: HassEntity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return timeRemaining;
|
return timeRemaining;
|
||||||
}
|
};
|
||||||
|
@ -7,7 +7,7 @@ import memoizeOne from "memoize-one";
|
|||||||
|
|
||||||
import "./state-badge";
|
import "./state-badge";
|
||||||
|
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import {
|
import {
|
||||||
LitElement,
|
LitElement,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
|
@ -14,8 +14,8 @@ import { HomeAssistant } from "../../types";
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { forwardHaptic } from "../../data/haptics";
|
import { forwardHaptic } from "../../data/haptics";
|
||||||
|
|
||||||
import computeStateDomain from "../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import "../ha-switch";
|
import "../ha-switch";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
|
|||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
|
||||||
import "../ha-icon";
|
import "../ha-icon";
|
||||||
import stateIcon from "../../common/entity/state_icon";
|
import { stateIcon } from "../../common/entity/state_icon";
|
||||||
|
|
||||||
class HaStateIcon extends PolymerElement {
|
class HaStateIcon extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -14,11 +14,11 @@ import { classMap } from "lit-html/directives/class-map";
|
|||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
import computeStateDomain from "../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import domainIcon from "../../common/entity/domain_icon";
|
import { domainIcon } from "../../common/entity/domain_icon";
|
||||||
import stateIcon from "../../common/entity/state_icon";
|
import { stateIcon } from "../../common/entity/state_icon";
|
||||||
import timerTimeRemaining from "../../common/entity/timer_time_remaining";
|
import { timerTimeRemaining } from "../../common/entity/timer_time_remaining";
|
||||||
import secondsToDuration from "../../common/datetime/seconds_to_duration";
|
import secondsToDuration from "../../common/datetime/seconds_to_duration";
|
||||||
|
|
||||||
import "../ha-label-badge";
|
import "../ha-label-badge";
|
||||||
|
@ -9,8 +9,8 @@ import {
|
|||||||
query,
|
query,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import "../ha-icon";
|
import "../ha-icon";
|
||||||
import computeStateDomain from "../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||||
import stateIcon from "../../common/entity/state_icon";
|
import { stateIcon } from "../../common/entity/state_icon";
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
// Not duplicate, this is for typing.
|
// Not duplicate, this is for typing.
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
|
@ -3,7 +3,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
|
|
||||||
import "../ha-relative-time";
|
import "../ha-relative-time";
|
||||||
import "./state-badge";
|
import "./state-badge";
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import { computeRTL } from "../../common/util/compute_rtl";
|
import { computeRTL } from "../../common/util/compute_rtl";
|
||||||
|
|
||||||
class StateInfo extends PolymerElement {
|
class StateInfo extends PolymerElement {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
customElement,
|
customElement,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
|
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { HomeAssistant, CameraEntity } from "../types";
|
import { HomeAssistant, CameraEntity } from "../types";
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import {
|
import {
|
||||||
|
@ -8,9 +8,9 @@ import "../cards/ha-badges-card";
|
|||||||
import "../cards/ha-card-chooser";
|
import "../cards/ha-card-chooser";
|
||||||
import "./ha-demo-badge";
|
import "./ha-demo-badge";
|
||||||
|
|
||||||
import computeStateDomain from "../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||||
import splitByGroups from "../common/entity/split_by_groups";
|
import { splitByGroups } from "../common/entity/split_by_groups";
|
||||||
import getGroupEntities from "../common/entity/get_group_entities";
|
import { getGroupEntities } from "../common/entity/get_group_entities";
|
||||||
|
|
||||||
// mapping domain to size of the card.
|
// mapping domain to size of the card.
|
||||||
const DOMAINS_WITH_CARD = {
|
const DOMAINS_WITH_CARD = {
|
||||||
|
@ -13,7 +13,7 @@ import { fireEvent } from "../common/dom/fire_event";
|
|||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
import { subscribeNotifications } from "../data/persistent_notification";
|
import { subscribeNotifications } from "../data/persistent_notification";
|
||||||
import computeDomain from "../common/entity/compute_domain";
|
import { computeDomain } from "../common/entity/compute_domain";
|
||||||
|
|
||||||
@customElement("ha-menu-button")
|
@customElement("ha-menu-button")
|
||||||
class HaMenuButton extends LitElement {
|
class HaMenuButton extends LitElement {
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
PersistentNotification,
|
PersistentNotification,
|
||||||
subscribeNotifications,
|
subscribeNotifications,
|
||||||
} from "../data/persistent_notification";
|
} from "../data/persistent_notification";
|
||||||
import computeDomain from "../common/entity/compute_domain";
|
import { computeDomain } from "../common/entity/compute_domain";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
// tslint:disable-next-line: no-duplicate-imports
|
// tslint:disable-next-line: no-duplicate-imports
|
||||||
import { PaperIconItemElement } from "@polymer/paper-item/paper-icon-item";
|
import { PaperIconItemElement } from "@polymer/paper-item/paper-icon-item";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import compute_state_name from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
|
|
||||||
export interface DeviceAutomation {
|
export interface DeviceAutomation {
|
||||||
device_id: string;
|
device_id: string;
|
||||||
@ -69,7 +69,7 @@ export const localizeDeviceAutomationAction = (
|
|||||||
return hass.localize(
|
return hass.localize(
|
||||||
`component.${action.domain}.device_automation.action_type.${action.type}`,
|
`component.${action.domain}.device_automation.action_type.${action.type}`,
|
||||||
"entity_name",
|
"entity_name",
|
||||||
state ? compute_state_name(state) : "<unknown>",
|
state ? computeStateName(state) : "<unknown>",
|
||||||
"subtype",
|
"subtype",
|
||||||
hass.localize(
|
hass.localize(
|
||||||
`component.${action.domain}.device_automation.action_subtype.${
|
`component.${action.domain}.device_automation.action_subtype.${
|
||||||
@ -91,7 +91,7 @@ export const localizeDeviceAutomationCondition = (
|
|||||||
condition.type
|
condition.type
|
||||||
}`,
|
}`,
|
||||||
"entity_name",
|
"entity_name",
|
||||||
state ? compute_state_name(state) : "<unknown>",
|
state ? computeStateName(state) : "<unknown>",
|
||||||
"subtype",
|
"subtype",
|
||||||
hass.localize(
|
hass.localize(
|
||||||
`component.${condition.domain}.device_automation.condition_subtype.${
|
`component.${condition.domain}.device_automation.condition_subtype.${
|
||||||
@ -111,7 +111,7 @@ export const localizeDeviceAutomationTrigger = (
|
|||||||
trigger.type
|
trigger.type
|
||||||
}`,
|
}`,
|
||||||
"entity_name",
|
"entity_name",
|
||||||
state ? compute_state_name(state) : "<unknown>",
|
state ? computeStateName(state) : "<unknown>",
|
||||||
"subtype",
|
"subtype",
|
||||||
hass.localize(
|
hass.localize(
|
||||||
`component.${trigger.domain}.device_automation.trigger_subtype.${
|
`component.${trigger.domain}.device_automation.trigger_subtype.${
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createCollection, Connection } from "home-assistant-js-websocket";
|
import { createCollection, Connection } from "home-assistant-js-websocket";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import { debounce } from "../common/util/debounce";
|
import { debounce } from "../common/util/debounce";
|
||||||
|
|
||||||
export interface EntityRegistryEntry {
|
export interface EntityRegistryEntry {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import computeStateName from "../common/entity/compute_state_name";
|
import { computeStateName } from "../common/entity/compute_state_name";
|
||||||
import computeStateDomain from "../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||||
import computeStateDisplay from "../common/entity/compute_state_display";
|
|
||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import { LocalizeFunc } from "../common/translations/localize";
|
import { LocalizeFunc } from "../common/translations/localize";
|
||||||
|
import { computeStateDisplay } from "../common/entity/compute_state_display";
|
||||||
|
|
||||||
const DOMAINS_USE_LAST_UPDATED = ["climate", "water_heater"];
|
const DOMAINS_USE_LAST_UPDATED = ["climate", "water_heater"];
|
||||||
const LINE_ATTRIBUTES_TO_KEEP = [
|
const LINE_ATTRIBUTES_TO_KEEP = [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import computeObjectId from "../common/entity/compute_object_id";
|
import { computeObjectId } from "../common/entity/compute_object_id";
|
||||||
|
|
||||||
export interface EventAction {
|
export interface EventAction {
|
||||||
event: string;
|
event: string;
|
||||||
|
@ -8,7 +8,7 @@ import "../resources/ha-style";
|
|||||||
import "./more-info/more-info-controls";
|
import "./more-info/more-info-controls";
|
||||||
import "./more-info/more-info-settings";
|
import "./more-info/more-info-settings";
|
||||||
|
|
||||||
import computeStateDomain from "../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||||
import isComponentLoaded from "../common/config/is_component_loaded";
|
import isComponentLoaded from "../common/config/is_component_loaded";
|
||||||
|
|
||||||
import DialogMixin from "../mixins/dialog-mixin";
|
import DialogMixin from "../mixins/dialog-mixin";
|
||||||
|
@ -27,7 +27,7 @@ import "./more-info-vacuum";
|
|||||||
import "./more-info-water_heater";
|
import "./more-info-water_heater";
|
||||||
import "./more-info-weather";
|
import "./more-info-weather";
|
||||||
|
|
||||||
import stateMoreInfoType from "../../../common/entity/state_more_info_type";
|
import { stateMoreInfoType } from "../../../common/entity/state_more_info_type";
|
||||||
import dynamicContentUpdater from "../../../common/dom/dynamic_content_updater";
|
import dynamicContentUpdater from "../../../common/dom/dynamic_content_updater";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
|
|
||||||
import "../../../components/ha-cover-tilt-controls";
|
import "../../../components/ha-cover-tilt-controls";
|
||||||
import "../../../components/ha-labeled-slider";
|
import "../../../components/ha-labeled-slider";
|
||||||
|
|
||||||
import CoverEntity from "../../../util/cover-model";
|
import CoverEntity from "../../../util/cover-model";
|
||||||
|
import { featureClassNames } from "../../../common/entity/feature_class_names";
|
||||||
import attributeClassNames from "../../../common/entity/attribute_class_names";
|
|
||||||
import featureClassNames from "../../../common/entity/feature_class_names";
|
|
||||||
|
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
|
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
||||||
|
|
||||||
const FEATURE_CLASS_NAMES = {
|
const FEATURE_CLASS_NAMES = {
|
||||||
128: "has-set_tilt_position",
|
128: "has-set_tilt_position",
|
||||||
};
|
};
|
||||||
|
@ -10,8 +10,8 @@ import "../../../components/ha-paper-dropdown-menu";
|
|||||||
import "../../../components/ha-switch";
|
import "../../../components/ha-switch";
|
||||||
|
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
|
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
||||||
|
|
||||||
import attributeClassNames from "../../../common/entity/attribute_class_names";
|
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,7 +4,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
|
|
||||||
import "../../../state-summary/state-card-content";
|
import "../../../state-summary/state-card-content";
|
||||||
|
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import dynamicContentUpdater from "../../../common/dom/dynamic_content_updater";
|
import dynamicContentUpdater from "../../../common/dom/dynamic_content_updater";
|
||||||
|
|
||||||
class MoreInfoGroup extends PolymerElement {
|
class MoreInfoGroup extends PolymerElement {
|
||||||
|
@ -7,7 +7,7 @@ import "@vaadin/vaadin-date-picker/vaadin-date-picker";
|
|||||||
import "../../../components/ha-relative-time";
|
import "../../../components/ha-relative-time";
|
||||||
import "../../../components/paper-time-input";
|
import "../../../components/paper-time-input";
|
||||||
|
|
||||||
import attributeClassNames from "../../../common/entity/attribute_class_names";
|
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
||||||
|
|
||||||
class DatetimeInput extends PolymerElement {
|
class DatetimeInput extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -10,7 +10,7 @@ import "../../../components/ha-color-picker";
|
|||||||
import "../../../components/ha-labeled-slider";
|
import "../../../components/ha-labeled-slider";
|
||||||
import "../../../components/ha-paper-dropdown-menu";
|
import "../../../components/ha-paper-dropdown-menu";
|
||||||
|
|
||||||
import featureClassNames from "../../../common/entity/feature_class_names";
|
import { featureClassNames } from "../../../common/entity/feature_class_names";
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import "../../../components/ha-paper-slider";
|
|||||||
import "../../../components/ha-paper-dropdown-menu";
|
import "../../../components/ha-paper-dropdown-menu";
|
||||||
import HassMediaPlayerEntity from "../../../util/hass-media-player-model";
|
import HassMediaPlayerEntity from "../../../util/hass-media-player-model";
|
||||||
|
|
||||||
import attributeClassNames from "../../../common/entity/attribute_class_names";
|
import { attributeClassNames } from "../../../common/entity/attribute_class_names";
|
||||||
import isComponentLoaded from "../../../common/config/is_component_loaded";
|
import isComponentLoaded from "../../../common/config/is_component_loaded";
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
@ -14,7 +14,7 @@ import "../../../components/ha-switch";
|
|||||||
import { supportsFeature } from "../../../common/entity/supports-feature";
|
import { supportsFeature } from "../../../common/entity/supports-feature";
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
|
|
||||||
import featureClassNames from "../../../common/entity/feature_class_names";
|
import { featureClassNames } from "../../../common/entity/feature_class_names";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -11,8 +11,8 @@ import "../../state-summary/state-card-content";
|
|||||||
|
|
||||||
import "./controls/more-info-content";
|
import "./controls/more-info-content";
|
||||||
|
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import computeStateDomain from "../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||||
import isComponentLoaded from "../../common/config/is_component_loaded";
|
import isComponentLoaded from "../../common/config/is_component_loaded";
|
||||||
import { DOMAINS_MORE_INFO_NO_HISTORY } from "../../common/const";
|
import { DOMAINS_MORE_INFO_NO_HISTORY } from "../../common/const";
|
||||||
import { EventsMixin } from "../../mixins/events-mixin";
|
import { EventsMixin } from "../../mixins/events-mixin";
|
||||||
|
@ -8,8 +8,8 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import { EventsMixin } from "../../mixins/events-mixin";
|
import { EventsMixin } from "../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../mixins/localize-mixin";
|
import LocalizeMixin from "../../mixins/localize-mixin";
|
||||||
|
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
import computeDomain from "../../common/entity/compute_domain";
|
import { computeDomain } from "../../common/entity/compute_domain";
|
||||||
import { updateEntityRegistryEntry } from "../../data/entity_registry";
|
import { updateEntityRegistryEntry } from "../../data/entity_registry";
|
||||||
import { showSaveSuccessToast } from "../../util/toast-saved-success";
|
import { showSaveSuccessToast } from "../../util/toast-saved-success";
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import "../../components/ha-paper-icon-button-prev";
|
|||||||
import { EventsMixin } from "../../mixins/events-mixin";
|
import { EventsMixin } from "../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../mixins/localize-mixin";
|
import LocalizeMixin from "../../mixins/localize-mixin";
|
||||||
import { subscribeNotifications } from "../../data/persistent_notification";
|
import { subscribeNotifications } from "../../data/persistent_notification";
|
||||||
import computeDomain from "../../common/entity/compute_domain";
|
import { computeDomain } from "../../common/entity/compute_domain";
|
||||||
/*
|
/*
|
||||||
* @appliesMixin EventsMixin
|
* @appliesMixin EventsMixin
|
||||||
* @appliesMixin LocalizeMixin
|
* @appliesMixin LocalizeMixin
|
||||||
|
@ -20,7 +20,7 @@ import "../../../layouts/ha-app-layout";
|
|||||||
|
|
||||||
import Automation from "../js/automation";
|
import Automation from "../js/automation";
|
||||||
import unmountPreact from "../../../common/preact/unmount";
|
import unmountPreact from "../../../common/preact/unmount";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
@ -19,7 +19,7 @@ import "../../../components/entity/ha-entity-toggle";
|
|||||||
|
|
||||||
import "../ha-config-section";
|
import "../ha-config-section";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import { computeRTL } from "../../../common/util/compute_rtl";
|
import { computeRTL } from "../../../common/util/compute_rtl";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
@ -5,7 +5,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "./ha-automation-editor";
|
import "./ha-automation-editor";
|
||||||
import "./ha-automation-picker";
|
import "./ha-automation-picker";
|
||||||
|
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
|
|
||||||
class HaConfigAutomation extends PolymerElement {
|
class HaConfigAutomation extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -35,8 +35,8 @@ import { AlexaEntity, fetchCloudAlexaEntities } from "../../../../data/alexa";
|
|||||||
// tslint:disable-next-line: no-duplicate-imports
|
// tslint:disable-next-line: no-duplicate-imports
|
||||||
import { HaSwitch } from "../../../../components/ha-switch";
|
import { HaSwitch } from "../../../../components/ha-switch";
|
||||||
|
|
||||||
import computeStateName from "../../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../../common/entity/compute_state_name";
|
||||||
import computeDomain from "../../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||||
|
|
||||||
const DEFAULT_CONFIG_EXPOSE = true;
|
const DEFAULT_CONFIG_EXPOSE = true;
|
||||||
const IGNORE_INTERFACES = ["Alexa.EndpointHealth"];
|
const IGNORE_INTERFACES = ["Alexa.EndpointHealth"];
|
||||||
|
@ -40,8 +40,8 @@ import {
|
|||||||
// tslint:disable-next-line: no-duplicate-imports
|
// tslint:disable-next-line: no-duplicate-imports
|
||||||
import { HaSwitch } from "../../../../components/ha-switch";
|
import { HaSwitch } from "../../../../components/ha-switch";
|
||||||
|
|
||||||
import computeStateName from "../../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../../common/entity/compute_state_name";
|
||||||
import computeDomain from "../../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||||
|
|
||||||
const DEFAULT_CONFIG_EXPOSE = true;
|
const DEFAULT_CONFIG_EXPOSE = true;
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ import "../ha-config-section";
|
|||||||
import "../ha-entity-config";
|
import "../ha-entity-config";
|
||||||
import "./ha-form-customize";
|
import "./ha-form-customize";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import sortByName from "../../../common/entity/states_sort_by_name";
|
import { sortStatesByName } from "../../../common/entity/states_sort_by_name";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,7 +93,7 @@ class HaConfigCustomize extends LocalizeMixin(PolymerElement) {
|
|||||||
computeEntities(hass) {
|
computeEntities(hass) {
|
||||||
return Object.keys(hass.states)
|
return Object.keys(hass.states)
|
||||||
.map((key) => hass.states[key])
|
.map((key) => hass.states[key])
|
||||||
.sort(sortByName);
|
.sort(sortStatesByName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.define("ha-config-customize", HaConfigCustomize);
|
customElements.define("ha-config-customize", HaConfigCustomize);
|
||||||
|
@ -7,7 +7,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import hassAttributeUtil from "../../../util/hass-attributes-util";
|
import hassAttributeUtil from "../../../util/hass-attributes-util";
|
||||||
import "./ha-form-customize-attributes";
|
import "./ha-form-customize-attributes";
|
||||||
|
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
|
|
||||||
class HaFormCustomize extends PolymerElement {
|
class HaFormCustomize extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -36,7 +36,7 @@ import { ConfigEntry } from "../../../data/config_entries";
|
|||||||
import { AreaRegistryEntry } from "../../../data/area_registry";
|
import { AreaRegistryEntry } from "../../../data/area_registry";
|
||||||
import { navigate } from "../../../common/navigate";
|
import { navigate } from "../../../common/navigate";
|
||||||
import { LocalizeFunc } from "../../../common/translations/localize";
|
import { LocalizeFunc } from "../../../common/translations/localize";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
interface DeviceRowData extends DeviceRegistryEntry {
|
interface DeviceRowData extends DeviceRegistryEntry {
|
||||||
device?: DeviceRowData;
|
device?: DeviceRowData;
|
||||||
|
@ -11,7 +11,7 @@ import "../../../layouts/hass-subpage";
|
|||||||
|
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import "../../../components/entity/state-badge";
|
import "../../../components/entity/state-badge";
|
||||||
import { compare } from "../../../common/string/compare";
|
import { compare } from "../../../common/string/compare";
|
||||||
import {
|
import {
|
||||||
|
@ -20,8 +20,8 @@ import { HassEntity } from "home-assistant-js-websocket";
|
|||||||
// tslint:disable-next-line: no-duplicate-imports
|
// tslint:disable-next-line: no-duplicate-imports
|
||||||
import { HaSwitch } from "../../../components/ha-switch";
|
import { HaSwitch } from "../../../components/ha-switch";
|
||||||
|
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
class DialogEntityRegistryDetail extends LitElement {
|
class DialogEntityRegistryDetail extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property() public hass!: HomeAssistant;
|
||||||
|
@ -21,9 +21,9 @@ import "../../../layouts/hass-subpage";
|
|||||||
import "../../../layouts/hass-loading-screen";
|
import "../../../layouts/hass-loading-screen";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
import domainIcon from "../../../common/entity/domain_icon";
|
import { domainIcon } from "../../../common/entity/domain_icon";
|
||||||
import stateIcon from "../../../common/entity/state_icon";
|
import { stateIcon } from "../../../common/entity/state_icon";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import "../ha-config-section";
|
import "../ha-config-section";
|
||||||
import {
|
import {
|
||||||
showEntityRegistryDetailDialog,
|
showEntityRegistryDetailDialog,
|
||||||
|
@ -7,7 +7,7 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
|
|||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
import "../../components/ha-card";
|
import "../../components/ha-card";
|
||||||
|
|
||||||
import computeStateName from "../../common/entity/compute_state_name";
|
import { computeStateName } from "../../common/entity/compute_state_name";
|
||||||
|
|
||||||
class HaEntityConfig extends PolymerElement {
|
class HaEntityConfig extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -18,7 +18,7 @@ import "../../../components/ha-icon";
|
|||||||
import { computeRTL } from "../../../common/util/compute_rtl";
|
import { computeRTL } from "../../../common/util/compute_rtl";
|
||||||
import "../ha-config-section";
|
import "../ha-config-section";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import {
|
import {
|
||||||
loadConfigFlowDialog,
|
loadConfigFlowDialog,
|
||||||
showConfigFlowDialog,
|
showConfigFlowDialog,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { h, Component } from "preact";
|
import { h, Component } from "preact";
|
||||||
import "../../../../components/entity/ha-entity-picker";
|
import "../../../../components/entity/ha-entity-picker";
|
||||||
import hasLocation from "../../../../common/entity/has_location";
|
import { hasLocation } from "../../../../common/entity/has_location";
|
||||||
import computeStateDomain from "../../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../../common/entity/compute_state_domain";
|
||||||
|
|
||||||
function zoneAndLocationFilter(stateObj) {
|
function zoneAndLocationFilter(stateObj) {
|
||||||
return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone";
|
return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone";
|
||||||
|
@ -3,8 +3,8 @@ import "@polymer/paper-radio-button/paper-radio-button";
|
|||||||
import "@polymer/paper-radio-group/paper-radio-group";
|
import "@polymer/paper-radio-group/paper-radio-group";
|
||||||
import "../../../../components/entity/ha-entity-picker";
|
import "../../../../components/entity/ha-entity-picker";
|
||||||
|
|
||||||
import hasLocation from "../../../../common/entity/has_location";
|
import { hasLocation } from "../../../../common/entity/has_location";
|
||||||
import computeStateDomain from "../../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../../common/entity/compute_state_domain";
|
||||||
|
|
||||||
function zoneAndLocationFilter(stateObj) {
|
function zoneAndLocationFilter(stateObj) {
|
||||||
return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone";
|
return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone";
|
||||||
|
@ -5,8 +5,8 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "./ha-script-editor";
|
import "./ha-script-editor";
|
||||||
import "./ha-script-picker";
|
import "./ha-script-picker";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
|
|
||||||
class HaConfigScript extends PolymerElement {
|
class HaConfigScript extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -12,8 +12,8 @@ import "../../../components/ha-fab";
|
|||||||
import Script from "../js/script";
|
import Script from "../js/script";
|
||||||
import unmountPreact from "../../../common/preact/unmount";
|
import unmountPreact from "../../../common/preact/unmount";
|
||||||
|
|
||||||
import computeObjectId from "../../../common/entity/compute_object_id";
|
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import NavigateMixin from "../../../mixins/navigate-mixin";
|
import NavigateMixin from "../../../mixins/navigate-mixin";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import "../../../components/ha-fab";
|
|||||||
|
|
||||||
import "../ha-config-section";
|
import "../ha-config-section";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { triggerScript } from "../../../data/script";
|
import { triggerScript } from "../../../data/script";
|
||||||
|
@ -41,7 +41,7 @@ import { ItemSelectedEvent, NodeServiceData } from "./types";
|
|||||||
import { navigate } from "../../../common/navigate";
|
import { navigate } from "../../../common/navigate";
|
||||||
import { UnsubscribeFunc, HassEvent } from "home-assistant-js-websocket";
|
import { UnsubscribeFunc, HassEvent } from "home-assistant-js-websocket";
|
||||||
import { formatAsPaddedHex } from "./functions";
|
import { formatAsPaddedHex } from "./functions";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// for fire event
|
// for fire event
|
||||||
|
@ -26,9 +26,9 @@ import "./zwave-usercodes";
|
|||||||
import "./zwave-values";
|
import "./zwave-values";
|
||||||
import "./zwave-node-protection";
|
import "./zwave-node-protection";
|
||||||
|
|
||||||
import sortByName from "../../../common/entity/states_sort_by_name";
|
import { sortStatesByName } from "../../../common/entity/states_sort_by_name";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
|||||||
return Object.keys(hass.states)
|
return Object.keys(hass.states)
|
||||||
.map((key) => hass.states[key])
|
.map((key) => hass.states[key])
|
||||||
.filter((ent) => ent.entity_id.match("zwave[.]"))
|
.filter((ent) => ent.entity_id.match("zwave[.]"))
|
||||||
.sort(sortByName);
|
.sort(sortStatesByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
computeEntities(selectedNode) {
|
computeEntities(selectedNode) {
|
||||||
@ -481,7 +481,7 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
|||||||
!ent.entity_id.match("zwave[.]")
|
!ent.entity_id.match("zwave[.]")
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.sort(sortByName);
|
.sort(sortStatesByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedNodeChanged(selectedNode) {
|
selectedNodeChanged(selectedNode) {
|
||||||
|
@ -7,7 +7,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import "../../../components/buttons/ha-call-service-button";
|
import "../../../components/buttons/ha-call-service-button";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
class ZwaveGroups extends PolymerElement {
|
class ZwaveGroups extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
|
@ -6,7 +6,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|||||||
import formatTime from "../../common/datetime/format_time";
|
import formatTime from "../../common/datetime/format_time";
|
||||||
import formatDate from "../../common/datetime/format_date";
|
import formatDate from "../../common/datetime/format_date";
|
||||||
import { EventsMixin } from "../../mixins/events-mixin";
|
import { EventsMixin } from "../../mixins/events-mixin";
|
||||||
import domainIcon from "../../common/entity/domain_icon";
|
import { domainIcon } from "../../common/entity/domain_icon";
|
||||||
import { computeRTL } from "../../common/util/compute_rtl";
|
import { computeRTL } from "../../common/util/compute_rtl";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,7 +21,7 @@ import { processConfigEntities } from "../common/process-config-entities";
|
|||||||
import { createRowElement } from "../common/create-row-element";
|
import { createRowElement } from "../common/create-row-element";
|
||||||
import { EntitiesCardConfig, EntitiesCardEntityConfig } from "./types";
|
import { EntitiesCardConfig, EntitiesCardEntityConfig } from "./types";
|
||||||
|
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
|
|
||||||
@customElement("hui-entities-card")
|
@customElement("hui-entities-card")
|
||||||
|
@ -16,11 +16,11 @@ import "../../../components/ha-card";
|
|||||||
import "../components/hui-warning";
|
import "../components/hui-warning";
|
||||||
|
|
||||||
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
||||||
import stateIcon from "../../../common/entity/state_icon";
|
import { stateIcon } from "../../../common/entity/state_icon";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
|
|
||||||
import { HomeAssistant, LightEntity } from "../../../types";
|
import { HomeAssistant, LightEntity } from "../../../types";
|
||||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||||
|
@ -15,7 +15,7 @@ import "../components/hui-warning";
|
|||||||
|
|
||||||
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
|
@ -10,8 +10,7 @@ import {
|
|||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
|
|
||||||
import computeStateDisplay from "../../../common/entity/compute_state_display";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import relativeTime from "../../../common/datetime/relative_time";
|
import relativeTime from "../../../common/datetime/relative_time";
|
||||||
|
|
||||||
@ -20,6 +19,7 @@ import "../../../components/ha-card";
|
|||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
import "../components/hui-warning-element";
|
import "../components/hui-warning-element";
|
||||||
|
|
||||||
|
import { computeStateDisplay } from "../../../common/entity/compute_state_display";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||||
import { longPress } from "../common/directives/long-press-directive";
|
import { longPress } from "../common/directives/long-press-directive";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createErrorCardConfig } from "./hui-error-card";
|
import { createErrorCardConfig } from "./hui-error-card";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
|
|
||||||
export default class LegacyWrapperCard extends HTMLElement {
|
export default class LegacyWrapperCard extends HTMLElement {
|
||||||
constructor(tag, domain) {
|
constructor(tag, domain) {
|
||||||
|
@ -9,8 +9,8 @@ import {
|
|||||||
import "@polymer/paper-icon-button/paper-icon-button";
|
import "@polymer/paper-icon-button/paper-icon-button";
|
||||||
import "@thomasloven/round-slider";
|
import "@thomasloven/round-slider";
|
||||||
|
|
||||||
import stateIcon from "../../../common/entity/state_icon";
|
import { stateIcon } from "../../../common/entity/state_icon";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
@ -18,11 +18,11 @@ import {
|
|||||||
createTileLayer,
|
createTileLayer,
|
||||||
LeafletModuleType,
|
LeafletModuleType,
|
||||||
} from "../../../common/dom/setup-leaflet-map";
|
} from "../../../common/dom/setup-leaflet-map";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import { debounce } from "../../../common/util/debounce";
|
import { debounce } from "../../../common/util/debounce";
|
||||||
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
|
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
|
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { LovelaceCard } from "../types";
|
import { LovelaceCard } from "../types";
|
||||||
|
@ -14,10 +14,10 @@ import "../../../components/ha-card";
|
|||||||
import "../components/hui-image";
|
import "../components/hui-image";
|
||||||
import "../components/hui-warning";
|
import "../components/hui-warning";
|
||||||
|
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import computeStateDisplay from "../../../common/entity/compute_state_display";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
|
||||||
|
|
||||||
|
import { computeStateDisplay } from "../../../common/entity/compute_state_display";
|
||||||
import { longPress } from "../common/directives/long-press-directive";
|
import { longPress } from "../common/directives/long-press-directive";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||||
|
@ -10,16 +10,16 @@ import {
|
|||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
|
|
||||||
import computeStateDisplay from "../../../common/entity/compute_state_display";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { stateIcon } from "../../../common/entity/state_icon";
|
||||||
import stateIcon from "../../../common/entity/state_icon";
|
|
||||||
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
import "../components/hui-image";
|
import "../components/hui-image";
|
||||||
import "../components/hui-warning-element";
|
import "../components/hui-warning-element";
|
||||||
|
|
||||||
|
import { computeStateDisplay } from "../../../common/entity/compute_state_display";
|
||||||
import { DOMAINS_TOGGLE } from "../../../common/const";
|
import { DOMAINS_TOGGLE } from "../../../common/const";
|
||||||
import { LovelaceCard } from "../types";
|
import { LovelaceCard } from "../types";
|
||||||
import { EntityConfig } from "../entity-rows/types";
|
import { EntityConfig } from "../entity-rows/types";
|
||||||
|
@ -13,7 +13,7 @@ import { HassEntity } from "home-assistant-js-websocket";
|
|||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import { LovelaceCardEditor, LovelaceCard } from "../types";
|
import { LovelaceCardEditor, LovelaceCard } from "../types";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
@ -12,8 +12,8 @@ import {
|
|||||||
import "@polymer/paper-spinner/paper-spinner";
|
import "@polymer/paper-spinner/paper-spinner";
|
||||||
|
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import stateIcon from "../../../common/entity/state_icon";
|
import { stateIcon } from "../../../common/entity/state_icon";
|
||||||
|
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon";
|
import "../../../components/ha-icon";
|
||||||
|
@ -14,7 +14,7 @@ import "../../../components/ha-icon";
|
|||||||
import "../components/hui-warning";
|
import "../components/hui-warning";
|
||||||
|
|
||||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
@ -13,7 +13,7 @@ import "../../../components/ha-card";
|
|||||||
import "../components/hui-warning";
|
import "../components/hui-warning";
|
||||||
|
|
||||||
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
import isValidEntityId from "../../../common/entity/valid_entity_id";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
|
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { LovelaceElementConfig } from "../elements/types";
|
import { LovelaceElementConfig } from "../elements/types";
|
||||||
import { ActionConfig } from "../../../data/lovelace";
|
import { ActionConfig } from "../../../data/lovelace";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import computeDomain from "../../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||||
import { STATES_OFF } from "../../../../common/const";
|
import { STATES_OFF } from "../../../../common/const";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import computeDomain from "../../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
|
|
||||||
export const turnOnOffEntity = (
|
export const turnOnOffEntity = (
|
||||||
|
@ -10,13 +10,13 @@ import {
|
|||||||
HassConfig,
|
HassConfig,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
|
|
||||||
import extractViews from "../../../common/entity/extract_views";
|
import { extractViews } from "../../../common/entity/extract_views";
|
||||||
import getViewEntities from "../../../common/entity/get_view_entities";
|
import { getViewEntities } from "../../../common/entity/get_view_entities";
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import splitByGroups from "../../../common/entity/split_by_groups";
|
import { splitByGroups } from "../../../common/entity/split_by_groups";
|
||||||
import computeObjectId from "../../../common/entity/compute_object_id";
|
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||||
import computeStateDomain from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import computeDomain from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
|
|
||||||
import { EntityRowConfig, WeblinkConfig } from "../entity-rows/types";
|
import { EntityRowConfig, WeblinkConfig } from "../entity-rows/types";
|
||||||
import { LocalizeFunc } from "../../../common/translations/localize";
|
import { LocalizeFunc } from "../../../common/translations/localize";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import {
|
import {
|
||||||
LitElement,
|
LitElement,
|
||||||
html,
|
html,
|
||||||
|
@ -25,8 +25,8 @@ import {
|
|||||||
DataTabelColumnContainer,
|
DataTabelColumnContainer,
|
||||||
} from "../../../../components/ha-data-table";
|
} from "../../../../components/ha-data-table";
|
||||||
|
|
||||||
import computeStateName from "../../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../../common/entity/compute_state_name";
|
||||||
import computeDomain from "../../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../../common/entity/compute_domain";
|
||||||
|
|
||||||
import { computeRTL } from "../../../../common/util/compute_rtl";
|
import { computeRTL } from "../../../../common/util/compute_rtl";
|
||||||
import { computeUnusedEntities } from "../../common/compute-unused-entities";
|
import { computeUnusedEntities } from "../../common/compute-unused-entities";
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
import "../../../components/entity/ha-state-label-badge";
|
import "../../../components/entity/ha-state-label-badge";
|
||||||
import "../components/hui-warning-element";
|
import "../components/hui-warning-element";
|
||||||
|
|
||||||
import computeStateName from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import { LovelaceElement, StateBadgeElementConfig } from "./types";
|
import { LovelaceElement, StateBadgeElementConfig } from "./types";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user