Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ export class DialogDeviceAutomation extends LitElement {
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;
});
if (script) {
return;
}
fetchDeviceTriggers(this.hass, deviceId).then((triggers) => {
fetchDeviceTriggers(this.hass, device.id).then((triggers) => {
this._triggers = triggers;
});
fetchDeviceConditions(this.hass, deviceId).then((conditions) => {
fetchDeviceConditions(this.hass, device.id).then((conditions) => {
this._conditions = conditions;
});
}
Expand All @@ -88,7 +88,14 @@ export class DialogDeviceAutomation extends LitElement {
.heading=${this.hass.localize(
`ui.panel.config.devices.${
this._params.script ? "script" : "automation"
}.create`
}.create`,
{
type: this.hass.localize(
`ui.panel.config.devices.type.${
device.entry_type || "device"
}`
),
}
)}
>
<div @entry-selected=${this.closeDialog}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { fireEvent } from "../../../../common/dom/fire_event";
import { DeviceRegistryEntry } from "../../../../data/device_registry";

export interface DeviceAutomationDialogParams {
deviceId: string;
device: DeviceRegistryEntry;
script?: boolean;
}

Expand Down
7 changes: 5 additions & 2 deletions src/panels/config/devices/ha-config-device-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,12 +812,15 @@ export class HaConfigDevicePage extends LitElement {
}

private _showScriptDialog() {
showDeviceAutomationDialog(this, { deviceId: this.deviceId, script: true });
showDeviceAutomationDialog(this, {
device: this._device(this.deviceId, this.devices)!,
script: true,
});
}

private _showAutomationDialog() {
showDeviceAutomationDialog(this, {
deviceId: this.deviceId,
device: this._device(this.deviceId, this.devices)!,
script: false,
});
}
Expand Down