mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
ZWaveJS: Configuration.resetAll is only supported on CC v4+ (#22823)
This commit is contained in:
parent
d47966cdf7
commit
cae5540c44
@ -22,12 +22,14 @@ import "../../../../../components/buttons/ha-progress-button";
|
|||||||
import type { HaProgressButton } from "../../../../../components/buttons/ha-progress-button";
|
import type { HaProgressButton } from "../../../../../components/buttons/ha-progress-button";
|
||||||
import { computeDeviceName } from "../../../../../data/device_registry";
|
import { computeDeviceName } from "../../../../../data/device_registry";
|
||||||
import type {
|
import type {
|
||||||
|
ZWaveJSNodeCapabilities,
|
||||||
ZWaveJSNodeConfigParam,
|
ZWaveJSNodeConfigParam,
|
||||||
ZWaveJSNodeConfigParams,
|
ZWaveJSNodeConfigParams,
|
||||||
ZWaveJSSetConfigParamResult,
|
ZWaveJSSetConfigParamResult,
|
||||||
ZwaveJSNodeMetadata,
|
ZwaveJSNodeMetadata,
|
||||||
} from "../../../../../data/zwave_js";
|
} from "../../../../../data/zwave_js";
|
||||||
import {
|
import {
|
||||||
|
fetchZwaveNodeCapabilities,
|
||||||
fetchZwaveNodeConfigParameters,
|
fetchZwaveNodeConfigParameters,
|
||||||
fetchZwaveNodeMetadata,
|
fetchZwaveNodeMetadata,
|
||||||
invokeZWaveCCApi,
|
invokeZWaveCCApi,
|
||||||
@ -68,6 +70,8 @@ class ZWaveJSNodeConfig extends LitElement {
|
|||||||
|
|
||||||
@state() private _config?: ZWaveJSNodeConfigParams;
|
@state() private _config?: ZWaveJSNodeConfigParams;
|
||||||
|
|
||||||
|
@state() private _canResetAll = false;
|
||||||
|
|
||||||
@state() private _results: Record<string, ZWaveJSSetConfigParamResult> = {};
|
@state() private _results: Record<string, ZWaveJSSetConfigParamResult> = {};
|
||||||
|
|
||||||
@state() private _error?: string;
|
@state() private _error?: string;
|
||||||
@ -183,17 +187,19 @@ class ZWaveJSNodeConfig extends LitElement {
|
|||||||
</ha-card>
|
</ha-card>
|
||||||
</div>`
|
</div>`
|
||||||
)}
|
)}
|
||||||
<div class="reset">
|
${this._canResetAll
|
||||||
<ha-progress-button
|
? html`<div class="reset">
|
||||||
.disabled=${this._resetDialogProgress}
|
<ha-progress-button
|
||||||
.progress=${this._resetDialogProgress}
|
.disabled=${this._resetDialogProgress}
|
||||||
@click=${this._openResetDialog}
|
.progress=${this._resetDialogProgress}
|
||||||
>
|
@click=${this._openResetDialog}
|
||||||
${this.hass.localize(
|
>
|
||||||
"ui.panel.config.zwave_js.node_config.reset_to_default.button_label"
|
${this.hass.localize(
|
||||||
)}
|
"ui.panel.config.zwave_js.node_config.reset_to_default.button_label"
|
||||||
</ha-progress-button>
|
)}
|
||||||
</div>
|
</ha-progress-button>
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
<h3>
|
<h3>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.zwave_js.node_config.custom_config"
|
"ui.panel.config.zwave_js.node_config.custom_config"
|
||||||
@ -468,10 +474,19 @@ class ZWaveJSNodeConfig extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[this._nodeMetadata, this._config] = await Promise.all([
|
let capabilities: ZWaveJSNodeCapabilities | undefined;
|
||||||
|
[this._nodeMetadata, this._config, capabilities] = await Promise.all([
|
||||||
fetchZwaveNodeMetadata(this.hass, device.id),
|
fetchZwaveNodeMetadata(this.hass, device.id),
|
||||||
fetchZwaveNodeConfigParameters(this.hass, device.id),
|
fetchZwaveNodeConfigParameters(this.hass, device.id),
|
||||||
|
fetchZwaveNodeCapabilities(this.hass, device.id),
|
||||||
]);
|
]);
|
||||||
|
this._canResetAll =
|
||||||
|
capabilities &&
|
||||||
|
Object.values(capabilities).some((endpoint) =>
|
||||||
|
endpoint.some(
|
||||||
|
(capability) => capability.id === 0x70 && capability.version >= 4
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _openResetDialog(event: Event) {
|
private async _openResetDialog(event: Event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user