Remove firmware target from zwave_js firmware upload UI (#15425)

This commit is contained in:
Raman Gupta 2023-02-13 11:47:10 -05:00 committed by GitHub
parent 859e69d373
commit bf5eeba0a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 35 deletions

View File

@ -707,14 +707,10 @@ export const fetchZwaveNodeFirmwareUpdateCapabilities = (
export const uploadFirmwareAndBeginUpdate = async (
hass: HomeAssistant,
device_id: string,
file: File,
target?: number
file: File
) => {
const fd = new FormData();
fd.append("file", file);
if (target !== undefined) {
fd.append("target", target.toString());
}
const resp = await hass.fetchWithAuth(
`/api/zwave_js/firmware/upload/${device_id}`,
{

View File

@ -34,7 +34,6 @@ import {
showAlertDialog,
showConfirmationDialog,
} from "../../../../../dialogs/generic/show-dialog-box";
import { HaFormIntegerSchema } from "../../../../../components/ha-form/types";
@customElement("dialog-zwave_js-update-firmware-node")
class DialogZWaveJSUpdateFirmwareNode extends LitElement {
@ -56,8 +55,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
@state() private _nodeStatus?: ZWaveJSNodeStatus;
@state() private _firmwareTarget? = 0;
private _subscribedNodeStatus?: Promise<UnsubscribeFunc>;
private _subscribedNodeFirmwareUpdate?: Promise<UnsubscribeFunc>;
@ -80,7 +77,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
this._firmwareFile =
this._nodeStatus =
undefined;
this._firmwareTarget = 0;
this._uploading = this._updateInProgress = false;
fireEvent(this, "dialog-closed", { dialog: this.localName });
@ -95,12 +91,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
return html``;
}
const schema: HaFormIntegerSchema = {
name: "firmware_target",
type: "integer",
valueMin: 0,
};
const beginFirmwareUpdateHTML = html`<ha-file-upload
.hass=${this.hass}
.uploading=${this._uploading}
@ -111,17 +101,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
)}
@file-picked=${this._uploadFile}
></ha-file-upload>
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.update_firmware.firmware_target_intro"
)}
</p>
<ha-form
.hass=${this.hass}
.data=${{ firmware_target: this._firmwareTarget }}
.schema=${[schema]}
@value-changed=${this._firmwareTargetChanged}
></ha-form>
<mwc-button
slot="primaryAction"
@click=${this._beginFirmwareUpdate}
@ -287,8 +266,7 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
await uploadFirmwareAndBeginUpdate(
this.hass,
this.device!.id,
this._firmwareFile!,
this._firmwareTarget
this._firmwareFile!
);
this._updateInProgress = true;
this._uploading = false;
@ -392,10 +370,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
this._subscribedNodeFirmwareUpdate = undefined;
}
private async _firmwareTargetChanged(ev) {
this._firmwareTarget = ev.detail.value.firmware_target;
}
private async _uploadFile(ev) {
this._firmwareFile = ev.detail.files[0];
}

View File

@ -3633,8 +3633,6 @@
"warning": "WARNING: Firmware updates can brick your device if you do not correctly follow the manufacturer's guidance. The Home Assistant and Z-Wave JS teams do not take any responsibility for any damages to your device as a result of the firmware update and will not be able to help you if you brick your device. Would you still like to continue?",
"introduction": "Select the firmware file you would like to use to update {device}.",
"upload_firmware": "Upload Firmware",
"firmware_target_intro": "Select the firmware target (0 for the Z-Wave chip, ≥1 for other chips if they exist) for this update, or uncheck the box to have the driver attempt to figure it out from the firmware file.",
"firmware_target": "Firmware Target (chip)",
"upload_failed": "Upload Failed",
"begin_update": "Begin Firmware Update",
"queued": "The firmware update is ready to be sent to {device} but the device is asleep, wake the device to start the update.",
@ -3660,7 +3658,7 @@
"Error_InvalidHeaderFormat": "Invalid Header Format",
"Error_InsufficientMemory": "Insufficient Memory",
"Error_InvalidHardwareVersion": "Invalid Hardware Version",
"OK_WaitingForActivation": "Waiting for Activiation",
"OK_WaitingForActivation": "Waiting for Activation",
"OK_NoRestart": "No Restart",
"OK_RestartPending": "Restart Pending"
}