Compare commits

...

37 Commits

Author SHA1 Message Date
Bram Kragten
b99b13251f 20240103.3 (#19263) 2024-01-03 15:03:00 +01:00
Bram Kragten
288d173a4d Bumped version to 20240103.3 2024-01-03 15:02:14 +01:00
Bram Kragten
2c69fe8c53 Fix checking todo item that dont support due date (#19262)
* Fix checking todo item that dont support due date

* make cleaner

* Revert "make cleaner"

This reverts commit fa33b33614.

* Update dialog-todo-item-editor.ts

* do check in 1 place
2024-01-03 15:00:24 +01:00
Paul Bottein
62dafac72b Display edit button for climate fan mode feature (#19259) 2024-01-03 15:00:23 +01:00
karwosts
22929672a0 Remove tile pointer/ripple/index when it has no action (#19137)
* Remove tile pointer/ripple/index when it has no action

* update

* Apply suggestions from code review

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>

---------

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
2024-01-03 15:00:22 +01:00
Bram Kragten
ae0eac3415 Bumped version to 20240103.0 2024-01-03 15:00:06 +01:00
Bram Kragten
4ea7d826bc 20240103.1 (#19258) 2024-01-03 12:37:44 +01:00
Bram Kragten
336214d97f Revert conditional rendering of condition (#19257)
* Fix conditionally showing `triggered by`

* revert conditional rendering

* Update add-automation-element-dialog.ts

* Update add-automation-element-dialog.ts
2024-01-03 12:29:30 +01:00
Bram Kragten
c9a0ae6e2d Bumped version to 20240103.1 2024-01-03 12:29:10 +01:00
Bram Kragten
0bc69fb9b3 20240103.0 (#19256) 2024-01-03 10:55:23 +01:00
Bram Kragten
6e7366bf69 Calculate used domains on open of action dialog (#19255) 2024-01-03 10:38:51 +01:00
Bram Kragten
8ee4aa9e63 Bumped version to 20240103.0 2024-01-03 10:38:30 +01:00
Bram Kragten
386c3ea1ca 20240102.0 (#19234) 2024-01-02 20:02:03 +01:00
Simon Lamon
c2f3e43ee5 Set default values for required and disabled for labeled slider (#19246)
Set default values
2024-01-02 20:01:15 +01:00
Bram Kragten
7354988ec9 Move notification services to main list (#19235) 2024-01-02 20:01:14 +01:00
Bram Kragten
53dedc6c65 Bumped version to 20240102.0 2024-01-02 18:49:50 +01:00
Bram Kragten
de3b9a5bb2 Give todo and calendar edit static header (#19233) 2024-01-02 18:48:59 +01:00
Bram Kragten
8d496e1511 Update add-automation-element-dialog.ts 2024-01-02 18:48:06 +01:00
JLo
01bd88ce10 New copy for device trigger in automation editor (#19232)
New copy for device trigger in automation editor: 
"Set of conditions provided by your device. Great way to start."
2024-01-02 18:44:33 +01:00
Josh McCarty
18b5fd59a6 Add missing device classes for entity-registry-settings-editor (#19231)
* Add connectivity device class for binary sensors

* Add update device class

* Separate connectivity and update
2024-01-02 18:44:32 +01:00
Bram Kragten
750c1d5013 Change format of service description (#19229) 2024-01-02 18:44:31 +01:00
Bram Kragten
f2226cdec2 Use brand icons in actions (#19227) 2024-01-02 18:44:30 +01:00
Bram Kragten
c125ec087a Remove references to "service call" from actions (#19226) 2024-01-02 18:44:29 +01:00
Bram Kragten
f099f66065 Automation editor tweaks (#19225)
* Automation editor tweaks

* fix styling
2024-01-02 18:44:28 +01:00
JLo
4fcf99faa7 Review on automation editor text (#19223)
- Added `.` to bloc descriptions
- Changed "Other" into "OTher triggers" "Other conditions" and "Other actions"
- Adapted a few descriptions
2024-01-02 18:44:28 +01:00
karwosts
2add88ccc2 Localize a device action string (#19203) 2024-01-02 18:44:27 +01:00
Bram Kragten
aa94ec7949 20240101.0 (#19217) 2024-01-01 14:08:07 +01:00
Bram Kragten
7b4ecfd30a 20231228.0 (#19170) 2023-12-28 15:34:42 +01:00
Bram Kragten
9d9e789f4b 20231227.0 (#19157) 2023-12-27 17:29:11 +01:00
Paul Bottein
6ce613acd2 20231208.2 (#18971) 2023-12-08 14:50:28 +01:00
Paul Bottein
aa38e2d409 20231208.1 (#18962) 2023-12-08 10:36:45 +01:00
Paul Bottein
fce4e5e382 20231206.0 (#18925) 2023-12-06 14:24:48 +01:00
Bram Kragten
eb5e7ba3f3 20231205.0 (#18916) 2023-12-05 18:10:37 +01:00
Bram Kragten
ae2e8e7402 20231204.0 (#18882) 2023-12-04 12:10:33 +01:00
Bram Kragten
b854d23431 20231130.0 (#18843) 2023-11-30 17:19:47 +01:00
Bram Kragten
ef735d65cf 20231129.1 (#18811) 2023-11-29 15:31:24 +01:00
Bram Kragten
2803e6aa95 20231129.0 (#18809) 2023-11-29 12:53:12 +01:00
19 changed files with 282 additions and 104 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20240101.0"
version = "20240103.3"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"

View File

@@ -29,6 +29,7 @@ import {
mdiFlash,
mdiFlower,
mdiFormatListBulleted,
mdiFormatListCheckbox,
mdiFormTextbox,
mdiGauge,
mdiGoogleAssistant,
@@ -64,6 +65,7 @@ import {
mdiTransmissionTower,
mdiWater,
mdiWaterPercent,
mdiWeatherPartlyCloudy,
mdiWeatherPouring,
mdiWeatherRainy,
mdiWeatherWindy,
@@ -128,6 +130,7 @@ export const FIXED_DOMAIN_ICONS = {
updater: mdiCloudUpload,
vacuum: mdiRobotVacuum,
wake_word: mdiChatSleep,
weather: mdiWeatherPartlyCloudy,
zone: mdiMapMarkerRadius,
};
@@ -166,6 +169,7 @@ export const FIXED_DEVICE_CLASS_ICONS = {
precipitation_intensity: mdiWeatherPouring,
pressure: mdiGauge,
reactive_power: mdiFlash,
shopping_List: mdiFormatListCheckbox,
signal_strength: mdiWifi,
sound_pressure: mdiEarHearing,
speed: mdiSpeedometer,

View File

@@ -10,9 +10,9 @@ class HaLabeledSlider extends LitElement {
@property() public caption?: string;
@property() public disabled?: boolean;
@property({ type: Boolean }) public disabled = false;
@property() public required?: boolean;
@property({ type: Boolean }) public required = true;
@property() public min: number = 0;

View File

@@ -4,7 +4,14 @@ import {
HassServices,
HassServiceTarget,
} from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
import {
css,
CSSResultGroup,
html,
LitElement,
PropertyValues,
nothing,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { ensureArray } from "../common/array/ensure-array";
@@ -83,6 +90,8 @@ export class HaServiceControl extends LitElement {
@property({ type: Boolean }) public showAdvanced?: boolean;
@property({ type: Boolean, reflect: true }) public hidePicker?: boolean;
@state() private _value!: this["value"];
@state() private _checkedKeys = new Set();
@@ -363,12 +372,14 @@ export class HaServiceControl extends LitElement {
)) ||
serviceData?.description;
return html`<ha-service-picker
.hass=${this.hass}
.value=${this._value?.service}
.disabled=${this.disabled}
@value-changed=${this._serviceChanged}
></ha-service-picker>
return html`${this.hidePicker
? nothing
: html`<ha-service-picker
.hass=${this.hass}
.value=${this._value?.service}
.disabled=${this.disabled}
@value-changed=${this._serviceChanged}
></ha-service-picker>`}
<div class="description">
${description ? html`<p>${description}</p>` : ""}
${this._manifest
@@ -735,6 +746,9 @@ export class HaServiceControl extends LitElement {
margin: var(--service-control-padding, 0 16px);
padding: 16px 0;
}
:host([hidePicker]) p {
padding-top: 0;
}
.checkbox-spacer {
width: 32px;
}

View File

@@ -52,6 +52,7 @@ export const serviceActionStruct: Describe<ServiceAction> = assign(
target: optional(targetStruct),
data: optional(object()),
response_variable: optional(string()),
metadata: optional(object()),
})
);
@@ -133,6 +134,7 @@ export interface ServiceAction extends BaseAction {
target?: HassServiceTarget;
data?: Record<string, unknown>;
response_variable?: string;
metadata?: Record<string, unknown>;
}
export interface DeviceAction extends BaseAction {

View File

@@ -168,6 +168,18 @@ const tryDescribeAction = <T extends ActionType>(
const service =
hass.localize(`component.${domain}.services.${serviceName}.name`) ||
hass.services[domain][serviceName]?.name;
if (config.metadata) {
return hass.localize(
`${actionTranslationBaseKey}.service.description.service_name`,
{
domain: domainToName(hass.localize, domain),
name: service || config.service,
targets: formatListWithAnds(hass.locale, targets),
}
);
}
return hass.localize(
`${actionTranslationBaseKey}.service.description.service_based_on_name`,
{
@@ -404,7 +416,9 @@ const tryDescribeAction = <T extends ActionType>(
if (actionType === "device_action") {
const config = action as DeviceAction;
if (!config.device_id) {
return "Device action";
return hass.localize(
`${actionTranslationBaseKey}.device_id.description.no_device`
);
}
const localized = localizeDeviceAutomationAction(
hass,

View File

@@ -83,9 +83,12 @@ export const updateItem = (
item: item.uid,
rename: item.summary,
status: item.status,
description: item.description || null,
description: item.description,
due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date: item.due?.includes("T") ? undefined : item.due || null,
due_date:
item.due === undefined || item.due?.includes("T")
? undefined
: item.due,
},
{ entity_id }
);
@@ -102,7 +105,10 @@ export const createItem = (
item: item.summary,
description: item.description || undefined,
due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date: item.due?.includes("T") ? undefined : item.due,
due_date:
item.due === undefined || item.due?.includes("T")
? undefined
: item.due,
},
{ entity_id }
);

View File

@@ -144,9 +144,9 @@ class DialogCalendarEventEditor extends LitElement {
escapeKeyAction
.heading=${createCloseHeading(
this.hass,
isCreate
? this.hass.localize("ui.components.calendar.event.add")
: this._summary
this.hass.localize(
`ui.components.calendar.event.${isCreate ? "add" : "edit"}`
)
)}
>
<div class="content">

View File

@@ -29,6 +29,8 @@ import { classMap } from "lit/directives/class-map";
import { storage } from "../../../../common/decorators/storage";
import { dynamicElement } from "../../../../common/dom/dynamic-element-directive";
import { fireEvent } from "../../../../common/dom/fire_event";
import { computeDomain } from "../../../../common/entity/compute_domain";
import { domainIconWithoutDefault } from "../../../../common/entity/domain_icon";
import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter";
import { handleStructError } from "../../../../common/structs/handle-errors";
import "../../../../components/ha-alert";
@@ -190,7 +192,13 @@ export default class HaAutomationActionRow extends LitElement {
<h3 slot="header">
<ha-svg-icon
class="action-icon"
.path=${ACTION_ICONS[type!]}
.path=${type === "service" &&
"service" in this.action &&
this.action.service
? domainIconWithoutDefault(
computeDomain(this.action.service as string)
) || ACTION_ICONS[type!]
: ACTION_ICONS[type!]}
></ha-svg-icon>
${capitalizeFirstLetter(
describeAction(this.hass, this._entityReg, this.action)

View File

@@ -191,6 +191,7 @@ export default class HaAutomationAction extends LitElement {
} else if (isService(action)) {
actions = this.actions.concat({
service: getService(action),
metadata: {},
});
} else {
const elClass = customElements.get(

View File

@@ -1,14 +1,21 @@
import "@material/mwc-list/mwc-list";
import { mdiClose, mdiContentPaste, mdiPlus } from "@mdi/js";
import Fuse, { IFuseOptions } from "fuse.js";
import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import {
CSSResultGroup,
LitElement,
PropertyValues,
css,
html,
nothing,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
import { repeat } from "lit/directives/repeat";
import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../../common/dom/fire_event";
import { domainIcon } from "../../../common/entity/domain_icon";
import { domainIconWithoutDefault } from "../../../common/entity/domain_icon";
import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event";
import { stringCompare } from "../../../common/string/compare";
import { LocalizeFunc } from "../../../common/translations/localize";
@@ -38,10 +45,13 @@ import { TRIGGER_GROUPS, TRIGGER_ICONS } from "../../../data/trigger";
import { HassDialog } from "../../../dialogs/make-dialog-manager";
import { haStyle, haStyleDialog } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
import { brandsUrl } from "../../../util/brands-url";
import {
AddAutomationElementDialogParams,
PASTE_VALUE,
} from "./show-add-automation-element-dialog";
import { computeDomain } from "../../../common/entity/compute_domain";
import { deepEqual } from "../../../common/util/deep-equal";
const TYPES = {
trigger: { groups: TRIGGER_GROUPS, icons: TRIGGER_ICONS },
@@ -59,7 +69,8 @@ interface ListItem {
key: string;
name: string;
description: string;
icon: string;
icon?: string;
image?: string;
group: boolean;
}
@@ -79,6 +90,8 @@ const ENTITY_DOMAINS_OTHER = new Set([
"image_processing",
]);
const ENTITY_DOMAINS_MAIN = new Set(["notify"]);
@customElement("add-automation-element-dialog")
class DialogAddAutomationElement extends LitElement implements HassDialog {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -93,13 +106,15 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
@state() private _manifests?: DomainManifestLookup;
@state() private _domains?: Set<string>;
@query("ha-dialog") private _dialog?: HaDialog;
private _fullScreen = false;
private _width?: number;
@state() private _width?: number;
private _height?: number;
@state() private _height?: number;
public showDialog(params): void {
this._params = params;
@@ -107,6 +122,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
if (this._params?.type === "action") {
this.hass.loadBackendTranslation("services");
this._fetchManifests();
this._calculateUsedDomains();
}
this._fullScreen = matchMedia(
"all and (max-width: 450px), all and (max-height: 500px)"
@@ -124,8 +140,19 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
this._prev = undefined;
this._filter = "";
this._manifests = undefined;
this._domains = undefined;
}
private _getGroups = (
type: AddAutomationElementDialogParams["type"],
group: string | undefined
): AutomationElementGroup =>
group
? isService(group)
? {}
: TYPES[type].groups[group].members!
: TYPES[type].groups;
private _convertToItem = (
key: string,
options,
@@ -158,11 +185,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
services: HomeAssistant["services"],
manifests?: DomainManifestLookup
): ListItem[] => {
const groups: AutomationElementGroup = group
? isService(group)
? {}
: TYPES[type].groups[group].members!
: TYPES[type].groups;
const groups = this._getGroups(type, group);
const flattenGroups = (grp: AutomationElementGroup) =>
Object.entries(grp).map(([key, options]) =>
@@ -192,21 +215,23 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
(
type: AddAutomationElementDialogParams["type"],
group: string | undefined,
domains: Set<string> | undefined,
localize: LocalizeFunc,
services: HomeAssistant["services"],
manifests?: DomainManifestLookup
): ListItem[] => {
if (type === "action" && isService(group)) {
const result = this._services(localize, services, manifests, group);
let result = this._services(localize, services, manifests, group);
if (group === `${SERVICE_PREFIX}media_player`) {
result.unshift(this._convertToItem("play_media", {}, type, localize));
result = [
this._convertToItem("play_media", {}, type, localize),
...result,
];
}
return result;
}
const groups: AutomationElementGroup = group
? TYPES[type].groups[group].members!
: TYPES[type].groups;
const groups = this._getGroups(type, group);
const result = Object.entries(groups).map(([key, options]) =>
this._convertToItem(key, options, type, localize)
@@ -215,15 +240,33 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
if (type === "action") {
if (!this._group) {
result.unshift(
...this._serviceGroups(localize, services, manifests, undefined)
...this._serviceGroups(
localize,
services,
manifests,
domains,
undefined
)
);
} else if (this._group === "helpers") {
result.unshift(
...this._serviceGroups(localize, services, manifests, "helper")
...this._serviceGroups(
localize,
services,
manifests,
domains,
"helper"
)
);
} else if (this._group === "other") {
result.unshift(
...this._serviceGroups(localize, services, manifests, "other")
...this._serviceGroups(
localize,
services,
manifests,
domains,
"other"
)
);
}
}
@@ -243,42 +286,54 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
}
);
private _serviceGroups = memoizeOne(
(
localize: LocalizeFunc,
services: HomeAssistant["services"],
manifests: DomainManifestLookup | undefined,
type: "helper" | "other" | undefined
): ListItem[] => {
if (!services || !manifests) {
return [];
}
const result: ListItem[] = [];
Object.keys(services).forEach((domain) => {
const manifest = manifests[domain];
if (
(type === undefined &&
manifest?.integration_type === "entity" &&
!ENTITY_DOMAINS_OTHER.has(domain)) ||
(type === "helper" && manifest?.integration_type === "helper") ||
(type === "other" &&
(ENTITY_DOMAINS_OTHER.has(domain) ||
!["helper", "entity"].includes(manifest?.integration_type || "")))
) {
result.push({
group: true,
icon: domainIcon(domain),
key: `${SERVICE_PREFIX}${domain}`,
name: domainToName(localize, domain, manifest),
description: "",
});
}
});
return result.sort((a, b) =>
stringCompare(a.name, b.name, this.hass.locale.language)
);
private _serviceGroups = (
localize: LocalizeFunc,
services: HomeAssistant["services"],
manifests: DomainManifestLookup | undefined,
domains: Set<string> | undefined,
type: "helper" | "other" | undefined
): ListItem[] => {
if (!services || !manifests) {
return [];
}
);
const result: ListItem[] = [];
Object.keys(services).forEach((domain) => {
const manifest = manifests[domain];
const domainUsed = !domains ? true : domains.has(domain);
if (
(type === undefined &&
(ENTITY_DOMAINS_MAIN.has(domain) ||
(manifest?.integration_type === "entity" &&
domainUsed &&
!ENTITY_DOMAINS_OTHER.has(domain)))) ||
(type === "helper" && manifest?.integration_type === "helper") ||
(type === "other" &&
!ENTITY_DOMAINS_MAIN.has(domain) &&
(ENTITY_DOMAINS_OTHER.has(domain) ||
(!domainUsed && manifest?.integration_type === "entity") ||
!["helper", "entity"].includes(manifest?.integration_type || "")))
) {
const icon = domainIconWithoutDefault(domain);
result.push({
group: true,
icon,
image: !icon
? brandsUrl({
domain,
type: "icon",
darkOptimized: this.hass.themes?.darkMode,
})
: undefined,
key: `${SERVICE_PREFIX}${domain}`,
name: domainToName(localize, domain, manifest),
description: "",
});
}
});
return result.sort((a, b) =>
stringCompare(a.name, b.name, this.hass.locale.language)
);
};
private _services = memoizeOne(
(
@@ -302,9 +357,17 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
const services_keys = Object.keys(services[dmn]);
for (const service of services_keys) {
const icon = domainIconWithoutDefault(dmn);
result.push({
group: false,
icon: domainIcon(dmn),
icon,
image: !icon
? brandsUrl({
domain: dmn,
type: "icon",
darkOptimized: this.hass.themes?.darkMode,
})
: undefined,
key: `${SERVICE_PREFIX}${dmn}.${service}`,
name: `${domain ? "" : `${domainToName(localize, dmn)}: `}${
this.hass.localize(`component.${dmn}.services.${service}.name`) ||
@@ -360,6 +423,13 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
this._manifests = manifests;
}
private _calculateUsedDomains() {
const domains = new Set(Object.keys(this.hass.states).map(computeDomain));
if (!deepEqual(domains, this._domains)) {
this._domains = domains;
}
}
protected _opened(): void {
// Store the width and height so that when we search, box doesn't jump
const boundingRect =
@@ -368,6 +438,16 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
this._height = boundingRect?.height;
}
protected willUpdate(changedProperties: PropertyValues): void {
if (
this._params?.type === "action" &&
changedProperties.has("hass") &&
changedProperties.get("hass")?.states !== this.hass.states
) {
this._calculateUsedDomains();
}
}
protected render() {
if (!this._params) {
return nothing;
@@ -385,6 +465,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
: this._getGroupItems(
this._params.type,
this._group,
this._domains,
this.hass.localize,
this.hass.services,
this._manifests
@@ -497,7 +578,18 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
>
${item.name}
<span slot="secondary">${item.description}</span>
<ha-svg-icon slot="graphic" .path=${item.icon}></ha-svg-icon>
${item.icon
? html`<ha-svg-icon
slot="graphic"
.path=${item.icon}
></ha-svg-icon>`
: html`<img
alt=""
slot="graphic"
src=${item.image}
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>`}
${item.group
? html`<ha-icon-next slot="meta"></ha-icon-next>`
: html`<ha-svg-icon
@@ -562,6 +654,10 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
ha-icon-next {
width: 24px;
}
mwc-list {
max-height: 468px;
max-width: 100vw;
}
search-input {
display: block;
margin: 0 16px;

View File

@@ -168,6 +168,7 @@ export class HaDeviceCondition extends LitElement {
}
ha-form {
display: block;
margin-top: 24px;
}
`;

View File

@@ -174,6 +174,7 @@ export class HaDeviceTrigger extends LitElement {
}
ha-form {
display: block;
margin-top: 24px;
}
`;

View File

@@ -118,6 +118,8 @@ const OVERRIDE_DEVICE_CLASSES = {
"carbon_monoxide",
"moisture",
], // Alarm
["connectivity"], // Connectivity
["update"], // Update
],
};

View File

@@ -287,21 +287,40 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
@eventOptions({ passive: true })
private handleRippleActivate(evt?: Event) {
if (!this.hasCardAction) return;
this._rippleHandlers.startPress(evt);
}
private handleRippleDeactivate() {
if (!this.hasCardAction) return;
this._rippleHandlers.endPress();
}
private handleRippleMouseEnter() {
if (!this.hasCardAction) return;
this._rippleHandlers.startHover();
}
private handleRippleMouseLeave() {
if (!this.hasCardAction) return;
this._rippleHandlers.endHover();
}
get hasCardAction() {
return (
!this._config?.tap_action ||
hasAction(this._config?.tap_action) ||
hasAction(this._config?.hold_action) ||
hasAction(this._config?.double_tap_action)
);
}
get hasIconAction() {
return (
!this._config?.icon_tap_action || hasAction(this._config?.icon_tap_action)
);
}
protected render() {
if (!this._config || !this.hass) {
return nothing;
@@ -368,8 +387,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
hasHold: hasAction(this._config!.hold_action),
hasDoubleClick: hasAction(this._config!.double_tap_action),
})}
role="button"
tabindex="0"
role=${ifDefined(this.hasCardAction ? "button" : undefined)}
tabindex=${ifDefined(this.hasCardAction ? "0" : undefined)}
aria-labelledby="info"
@mousedown=${this.handleRippleActivate}
@mouseup=${this.handleRippleDeactivate}
@@ -386,8 +405,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
<div class="content ${classMap(contentClasses)}">
<div
class="icon-container"
role="button"
tabindex="0"
role=${ifDefined(this.hasIconAction ? "button" : undefined)}
tabindex=${ifDefined(this.hasIconAction ? "0" : undefined)}
@action=${this._handleIconAction}
.actionHandler=${actionHandler()}
>

View File

@@ -476,7 +476,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
return;
}
await updateItem(this.hass!, this._entityId!, {
...item,
uid: item.uid,
summary: item.summary,
status:
item.status === TodoItemStatus.NeedsAction
? TodoItemStatus.Completed

View File

@@ -81,6 +81,7 @@ const EDITABLES_FEATURE_TYPES = new Set<UiFeatureTypes>([
"humidifier-modes",
"water-heater-operation-modes",
"lawn-mower-commands",
"climate-fan-modes",
"climate-preset-modes",
"numeric-input",
"update-actions",

View File

@@ -101,9 +101,9 @@ class DialogTodoItemEditor extends LitElement {
scrimClickAction
.heading=${createCloseHeading(
this.hass,
isCreate
? this.hass.localize("ui.components.todo.item.add")
: this._summary
this.hass.localize(
`ui.components.todo.item.${isCreate ? "add" : "edit"}`
)
)}
>
<div class="content">
@@ -324,14 +324,20 @@ class DialogTodoItemEditor extends LitElement {
(this._todoListSupportsFeature(
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
)
? // backend should accept null to clear the field, but it doesn't now
null
? null
: undefined),
due: this._due
? this._hasTime
? this._due.toISOString()
: this._formatDate(this._due)
: null,
: this._todoListSupportsFeature(
TodoListEntityFeature.SET_DUE_DATETIME_ON_ITEM
) ||
this._todoListSupportsFeature(
TodoListEntityFeature.SET_DUE_DATE_ON_ITEM
)
? null
: undefined,
status: this._checked
? TodoItemStatus.Completed
: TodoItemStatus.NeedsAction,

View File

@@ -2492,13 +2492,13 @@
"groups": {
"entity": {
"label": "Entity",
"description": "When something happens to an entity"
"description": "When something happens to an entity."
},
"time_location": {
"label": "Time and location",
"description": "When someone enters or leaves a zone, or at a specific time."
},
"other": { "label": "Other" }
"other": { "label": "Other triggers" }
},
"type": {
"calendar": {
@@ -2534,7 +2534,7 @@
"context_user_picked": "User firing event",
"context_user_pick": "Select user",
"description": {
"picker": "When an event is being received (event is an advanced concept in Home Assistant)",
"picker": "When an event is being received (event is an advanced concept in Home Assistant).",
"full": "When {eventTypes} event is fired"
}
},
@@ -2546,7 +2546,7 @@
"enter": "Enter",
"leave": "Leave",
"description": {
"picker": "When an entity created by a geolocation platform appears in or disappears from a zone",
"picker": "When an entity created by a geolocation platform appears in or disappears from a zone.",
"full": "When {source} {event, select, \n enter {enters}\n leave {leaves} other {} \n} {zone} {numberOfZones, plural,\n one {zone}\n other {zones}\n}"
}
},
@@ -2608,7 +2608,7 @@
"updated": "updated"
},
"description": {
"picker": "When a persistent notification is added or removed",
"picker": "When a persistent notification is added or removed.",
"full": "When a persistent notification is updated"
}
},
@@ -2619,7 +2619,7 @@
"sunset": "Sunset",
"offset": "Offset (optional)",
"description": {
"picker": "When the sun sets or rises",
"picker": "When the sun sets or rises.",
"sets": "When the sun sets{hasDuration, select, \n true { offset by {duration}} \n other {}\n }",
"rises": "When the sun rises{hasDuration, select, \n true { offset by {duration}} \n other {}\n }"
}
@@ -2648,7 +2648,7 @@
"value_template": "Value template",
"for": "For",
"description": {
"picker": "When a template is evaluated to true.",
"picker": "When a template evaluates to true.",
"full": "When a template changes from false to true{hasDuration, select, \n true { for {duration}} \n other {}\n }"
}
},
@@ -2669,7 +2669,7 @@
"minutes": "Minutes",
"seconds": "Seconds",
"description": {
"picker": "Periodically, every defined interval of time."
"picker": "Periodically, at a defined interval."
}
},
"webhook": {
@@ -2692,7 +2692,7 @@
"enter": "Enter",
"leave": "Leave",
"description": {
"picker": "When someone (or something) enters or leaves a zone",
"picker": "When someone (or something) enters or leaves a zone.",
"full": "When {entity} {event, select, \n enter {enters}\n leave {leaves} other {} \n} {zone} {numberOfZones, plural,\n one {zone} \n other {zones}\n}"
}
}
@@ -2734,7 +2734,7 @@
"label": "Time and location",
"description": "If someone is in a zone or if the current time is before or after a specified time."
},
"other": { "label": "Other" },
"other": { "label": "Other conditions" },
"building_blocks": {
"label": "Building blocks",
"description": "Build more complex conditions."
@@ -2760,13 +2760,13 @@
"preset_mode": "Preset mode"
},
"description": {
"picker": "If a device is in a certain state. Great way to start."
"picker": "Set of conditions provided by your device. Great way to start."
}
},
"not": {
"label": "Not",
"description": {
"picker": "Test if a condition is not true",
"picker": "Test if a condition is not true.",
"no_conditions": "Test if no condition matches",
"one_condition": "Test if 1 condition does not match",
"full": "Test if none of {count} conditions match"
@@ -2800,7 +2800,7 @@
"label": "[%key:ui::panel::config::automation::editor::triggers::type::state::label%]",
"state": "[%key:ui::panel::config::automation::editor::triggers::type::state::label%]",
"description": {
"picker": "If an entity (or attribute) is in a specific state",
"picker": "If an entity (or attribute) is in a specific state.",
"no_entity": "Confirm state",
"full": "Confirm{hasAttribute, select, \n true { {attribute} of}\n other {}\n} {numberOfEntities, plural,\n zero {an entity is}\n one {{entities} is}\n other {{entities} are}\n} {numberOfStates, plural,\n zero {a state}\n other {{states}}\n}{hasDuration, select, \n true { for {duration}} \n other {}\n }"
}
@@ -2821,7 +2821,7 @@
"label": "[%key:ui::panel::config::automation::editor::triggers::type::template::label%]",
"value_template": "[%key:ui::panel::config::automation::editor::triggers::type::template::value_template%]",
"description": {
"picker": "If a template is evaluated to true.",
"picker": "If a template evaluates to true.",
"full": "Test if template renders a value equal to true"
}
},
@@ -2844,7 +2844,7 @@
"sun": "Sunday"
},
"description": {
"picker": "If the current time is before or after a specified time",
"picker": "If the current time is before or after a specified time.",
"full": "Confirm the {hasTime, select, \n after {time is after {time_after}}\n before {time is before {time_before}}\n after_before {time is after {time_after} and before {time_before}} \n other {}\n }{hasTimeAndDay, select, \n true { and the }\n other {}\n}{hasDay, select, \n true { day is {day}}\n other {}\n}"
}
},
@@ -2862,7 +2862,7 @@
"entity": "[%key:ui::panel::config::automation::editor::triggers::type::zone::entity%]",
"zone": "[%key:ui::panel::config::automation::editor::triggers::type::zone::label%]",
"description": {
"picker": "If someone (or something) is in a zone",
"picker": "If someone (or something) is in a zone.",
"full": "Confirm {entity} {numberOfEntities, plural,\n one {is}\n other {are}\n} in {zone} {numberOfZones, plural,\n one {zone} \n other {zones}\n} "
}
}
@@ -2899,7 +2899,7 @@
"continue_on_error": "Continue on error",
"groups": {
"helpers": { "label": "Helpers" },
"other": { "label": "Other" },
"other": { "label": "Other actions" },
"building_blocks": {
"label": "Building blocks",
"description": "Build more complex sequences of actions."
@@ -2914,6 +2914,7 @@
"description": {
"service_based_on_template": "Call a service based on a template on {targets}",
"service_based_on_name": "Call a service ''{name}'' on {targets}",
"service_name": "{domain} ''{name}'' on {targets}",
"service": "Call a service",
"target_template": "templated {name}",
"target_unknown_entity": "unknown entity",
@@ -2990,7 +2991,8 @@
"flash": "Flash"
},
"description": {
"picker": "Do something on a device. Great way to start."
"picker": "Do something on a device. Great way to start.",
"no_device": "Device action"
}
},
"activate_scene": {
@@ -3069,14 +3071,14 @@
"response_variable": "The name of the variable to use as response",
"error": "Stop because of an unexpected error",
"description": {
"picker": "Stop the sequence of actions",
"picker": "Stop the sequence of actions.",
"full": "Stop {hasReason, select, \n true { because: {reason}} \n other {}\n }"
}
},
"parallel": {
"label": "Run in parallel",
"description": {
"picker": "perform a sequence of actions in parallel.",
"picker": "Perform a sequence of actions in parallel.",
"full": "Run {number} {number, plural,\n one {action}\n other {actions}\n} in parallel"
}
},