Service control: Don't fire value changed for optional empty input (#8705)

This commit is contained in:
Bram Kragten 2021-03-25 14:15:57 +01:00 committed by GitHub
parent a3efa5676b
commit 77972c961b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,7 +335,10 @@ export class HaServiceControl extends LitElement {
ev.stopPropagation();
const key = (ev.currentTarget as any).key;
const value = ev.detail.value;
if (this.value?.data && this.value.data[key] === value) {
if (
this.value?.data?.[key] === value ||
(!this.value?.data?.[key] && (value === "" || value === undefined))
) {
return;
}