Use min value instead of hard coded 0 (#10443)

This commit is contained in:
Bram Kragten 2021-10-28 17:16:09 +02:00 committed by GitHub
parent c30453a86f
commit 7cadaf1dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,10 +100,15 @@ export class HaFormInteger extends LitElement implements HaFormElement {
}
if (this.schema.optional) {
return 0;
return this.schema.valueMin || 0;
}
return this.schema.description?.suggested_value || this.schema.default || 0;
return (
this.schema.description?.suggested_value ||
this.schema.default ||
this.schema.valueMin ||
0
);
}
private _handleCheckboxChange(ev: Event) {