Add missing type to create device automation/script heading (#11635)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Joakim Sørensen 2022-02-10 10:40:34 +01:00 committed by GitHub
parent 92a9ed7080
commit b053881cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 8 deletions

View File

@ -60,18 +60,18 @@ export class DialogDeviceAutomation extends LitElement {
return; return;
} }
const { deviceId, script } = this._params; const { device, script } = this._params;
fetchDeviceActions(this.hass, deviceId).then((actions) => { fetchDeviceActions(this.hass, device.id).then((actions) => {
this._actions = actions; this._actions = actions;
}); });
if (script) { if (script) {
return; return;
} }
fetchDeviceTriggers(this.hass, deviceId).then((triggers) => { fetchDeviceTriggers(this.hass, device.id).then((triggers) => {
this._triggers = triggers; this._triggers = triggers;
}); });
fetchDeviceConditions(this.hass, deviceId).then((conditions) => { fetchDeviceConditions(this.hass, device.id).then((conditions) => {
this._conditions = conditions; this._conditions = conditions;
}); });
} }
@ -88,7 +88,14 @@ export class DialogDeviceAutomation extends LitElement {
.heading=${this.hass.localize( .heading=${this.hass.localize(
`ui.panel.config.devices.${ `ui.panel.config.devices.${
this._params.script ? "script" : "automation" this._params.script ? "script" : "automation"
}.create` }.create`,
{
type: this.hass.localize(
`ui.panel.config.devices.type.${
this._params.device.entry_type || "device"
}`
),
}
)} )}
> >
<div @entry-selected=${this.closeDialog}> <div @entry-selected=${this.closeDialog}>

View File

@ -1,7 +1,8 @@
import { fireEvent } from "../../../../common/dom/fire_event"; import { fireEvent } from "../../../../common/dom/fire_event";
import { DeviceRegistryEntry } from "../../../../data/device_registry";
export interface DeviceAutomationDialogParams { export interface DeviceAutomationDialogParams {
deviceId: string; device: DeviceRegistryEntry;
script?: boolean; script?: boolean;
} }

View File

@ -812,12 +812,15 @@ export class HaConfigDevicePage extends LitElement {
} }
private _showScriptDialog() { private _showScriptDialog() {
showDeviceAutomationDialog(this, { deviceId: this.deviceId, script: true }); showDeviceAutomationDialog(this, {
device: this._device(this.deviceId, this.devices)!,
script: true,
});
} }
private _showAutomationDialog() { private _showAutomationDialog() {
showDeviceAutomationDialog(this, { showDeviceAutomationDialog(this, {
deviceId: this.deviceId, device: this._device(this.deviceId, this.devices)!,
script: false, script: false,
}); });
} }