Skip to content

Commit

Permalink
Fix clearing device in device action (#11594)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Feb 7, 2022
1 parent 09d46da commit e9ec2da
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
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

0 comments on commit e9ec2da

Please sign in to comment.