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

Fix clearing device in device action #11594

Merged
merged 2 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -107,6 +107,11 @@ export class HaDeviceAction extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
if (this._deviceId === undefined) {
fireEvent(this, "value-changed", {
value: HaDeviceAction.defaultConfig,
});
}
}

private _deviceActionPicked(ev) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ export class HaDeviceCondition extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
if (this._deviceId === undefined) {
fireEvent(this, "value-changed", {
value: { ...HaDeviceCondition.defaultConfig, condition: "device" },
});
}
}

private _deviceConditionPicked(ev) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ export class HaDeviceTrigger extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
if (this._deviceId === undefined) {
fireEvent(this, "value-changed", {
value: { ...HaDeviceTrigger.defaultConfig, platform: "device" },
});
}
}

private _deviceTriggerPicked(ev) {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/developer-tools/state/developer-tools-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
}

entityIdChanged() {
if (this._entityId === "") {
if (!this._entityId) {
this._entity = undefined;
this._state = "";
this._stateAttributes = "";
Expand Down