diff --git a/src/data/zwave_js.ts b/src/data/zwave_js.ts index 952804522f29..eed2117a341f 100644 --- a/src/data/zwave_js.ts +++ b/src/data/zwave_js.ts @@ -715,11 +715,13 @@ export const getZwaveNodeRawConfigParameter = ( device_id: string, property: number ): Promise => - hass.callWS({ - type: "zwave_js/get_raw_config_parameter", - device_id, - property, - }); + hass + .callWS<{ value: number }>({ + type: "zwave_js/get_raw_config_parameter", + device_id, + property, + }) + .then((res) => res.value); export const reinterviewZwaveNode = ( hass: HomeAssistant, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-custom-param.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-custom-param.ts index c6ff73ecf09c..b250c4cd3884 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-custom-param.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-custom-param.ts @@ -11,6 +11,7 @@ import { getZwaveNodeRawConfigParameter, setZwaveNodeRawConfigParameter, } from "../../../../../data/zwave_js"; +import { fireEvent } from "../../../../../common/dom/fire_event"; @customElement("zwave_js-custom-param") class ZWaveJSCustomParam extends LitElement { @@ -165,6 +166,10 @@ class ZWaveJSCustomParam extends LitElement { this._customParamNumber ); this._value = value; + fireEvent(this, "new-value", { + property: this._customParamNumber, + value: this._value, + }); } catch (err: any) { this._error = err?.message || "Unknown error"; } finally { @@ -206,6 +211,10 @@ class ZWaveJSCustomParam extends LitElement { this._valueSize, this._valueFormat ); + fireEvent(this, "new-value", { + property: this._customParamNumber, + value: this._value, + }); } catch (err: any) { this._error = err?.message || "Unknown error"; } finally { @@ -261,4 +270,10 @@ declare global { interface HTMLElementTagNameMap { "zwave_js-custom-param": ZWaveJSCustomParam; } + interface HASSDomEvents { + "new-value": { + property: number; + value: number; + }; + } } diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts index 3ee719f3df0e..6859413fe280 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts @@ -214,6 +214,7 @@ class ZWaveJSNodeConfig extends LitElement { @@ -389,6 +390,10 @@ class ZWaveJSNodeConfig extends LitElement { return false; } + private _handleNewValue() { + this._fetchData(); + } + private _switchToggled(ev) { this._setResult(ev.target.key, undefined); this._updateConfigParameter(ev.target, ev.detail.value ? 1 : 0);