Compare commits

...

2 Commits

Author SHA1 Message Date
Simon Lamon 14e7f434e0 No need to show rename when alias is already provided (#53003)
* No need to show rename when alias is already provided

* Update src/panels/config/script/ha-script-editor.ts

* Apply suggestion from @MindFreeze

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2026-07-06 05:47:35 +00:00
Raman Gupta 535b1b03f2 Fix Z-Wave JS config parameter value type (#53011)
* Fix Z-Wave JS config parameter value type

Type ZWaveJSNodeConfigParam.value as number | null instead of any,
matching what the backend sends. This surfaced two comparison bugs:

- The enumerated picker no-op check compared the stored number against
  the picker's string value, so it never matched and re-selecting the
  current option re-sent the command to the device.
- The numeric input guard coerced null (unknown value) to 0, so
  entering 0 for a parameter with an unknown value was ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Treat empty numeric input as invalid instead of 0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 08:22:10 +03:00
4 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ export interface ZWaveJSNodeConfigParam {
property: number;
property_key: number | null;
endpoint: number;
value: any;
value: number | null;
configuration_value_type: string;
metadata: ZWaveJSNodeConfigParamMetadata;
}
@@ -1011,7 +1011,7 @@ export class HaAutomationEditor extends AutomationScriptEditorMixin<AutomationCo
this._manualEditor?.resetPastedConfig();
const id = this.automationId || String(Date.now());
if (!this.automationId) {
if (!this.automationId && !this.config?.alias) {
const saved = await this._promptAutomationAlias();
if (!saved) {
return;
@@ -372,7 +372,7 @@ class ZWaveJSNodeConfig extends LitElement {
return html`${labelAndDescription}
<ha-input
type="number"
.value=${item.value}
.value=${item.value?.toString()}
.min=${item.metadata.min}
.max=${item.metadata.max}
.property=${item.property}
@@ -493,7 +493,7 @@ class ZWaveJSNodeConfig extends LitElement {
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
return;
}
if (this._config![ev.target.key].value === value) {
if (this._config![ev.target.key].value === Number(value)) {
return;
}
this._setResult(ev.target.key, undefined);
@@ -505,8 +505,12 @@ class ZWaveJSNodeConfig extends LitElement {
if (ev.target === undefined || this._config![ev.target.key] === undefined) {
return;
}
const value = Number(ev.target.value);
if (Number(this._config![ev.target.key].value) === value) {
// An empty input must not be coerced to 0 by Number()
const value =
ev.target.value === undefined || ev.target.value === ""
? NaN
: Number(ev.target.value);
if (this._config![ev.target.key].value === value) {
return;
}
if (isNaN(value)) {
+5 -3
View File
@@ -919,9 +919,11 @@ export class HaScriptEditor extends SubscribeMixin(
this._manualEditor?.resetPastedConfig();
if (!this.scriptId) {
const saved = await this._promptScriptAlias();
if (!saved) {
return;
if (!this.config?.alias) {
const saved = await this._promptScriptAlias();
if (!saved) {
return;
}
}
this.currentEntityId = this._computeEntityIdFromAlias(this.config!.alias);
}