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 ( export const uploadFirmwareAndBeginUpdate = async (
hass: HomeAssistant, hass: HomeAssistant,
device_id: string, device_id: string,
file: File, file: File
target?: number
) => { ) => {
const fd = new FormData(); const fd = new FormData();
fd.append("file", file); fd.append("file", file);
if (target !== undefined) {
fd.append("target", target.toString());
}
const resp = await hass.fetchWithAuth( const resp = await hass.fetchWithAuth(
`/api/zwave_js/firmware/upload/${device_id}`, `/api/zwave_js/firmware/upload/${device_id}`,
{ {

View File

@ -34,7 +34,6 @@ import {
showAlertDialog, showAlertDialog,
showConfirmationDialog, showConfirmationDialog,
} from "../../../../../dialogs/generic/show-dialog-box"; } from "../../../../../dialogs/generic/show-dialog-box";
import { HaFormIntegerSchema } from "../../../../../components/ha-form/types";
@customElement("dialog-zwave_js-update-firmware-node") @customElement("dialog-zwave_js-update-firmware-node")
class DialogZWaveJSUpdateFirmwareNode extends LitElement { class DialogZWaveJSUpdateFirmwareNode extends LitElement {
@ -56,8 +55,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
@state() private _nodeStatus?: ZWaveJSNodeStatus; @state() private _nodeStatus?: ZWaveJSNodeStatus;
@state() private _firmwareTarget? = 0;
private _subscribedNodeStatus?: Promise<UnsubscribeFunc>; private _subscribedNodeStatus?: Promise<UnsubscribeFunc>;
private _subscribedNodeFirmwareUpdate?: Promise<UnsubscribeFunc>; private _subscribedNodeFirmwareUpdate?: Promise<UnsubscribeFunc>;
@ -80,7 +77,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
this._firmwareFile = this._firmwareFile =
this._nodeStatus = this._nodeStatus =
undefined; undefined;
this._firmwareTarget = 0;
this._uploading = this._updateInProgress = false; this._uploading = this._updateInProgress = false;
fireEvent(this, "dialog-closed", { dialog: this.localName }); fireEvent(this, "dialog-closed", { dialog: this.localName });
@ -95,12 +91,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
return html``; return html``;
} }
const schema: HaFormIntegerSchema = {
name: "firmware_target",
type: "integer",
valueMin: 0,
};
const beginFirmwareUpdateHTML = html`<ha-file-upload const beginFirmwareUpdateHTML = html`<ha-file-upload
.hass=${this.hass} .hass=${this.hass}
.uploading=${this._uploading} .uploading=${this._uploading}
@ -111,17 +101,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
)} )}
@file-picked=${this._uploadFile} @file-picked=${this._uploadFile}
></ha-file-upload> ></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 <mwc-button
slot="primaryAction" slot="primaryAction"
@click=${this._beginFirmwareUpdate} @click=${this._beginFirmwareUpdate}
@ -287,8 +266,7 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
await uploadFirmwareAndBeginUpdate( await uploadFirmwareAndBeginUpdate(
this.hass, this.hass,
this.device!.id, this.device!.id,
this._firmwareFile!, this._firmwareFile!
this._firmwareTarget
); );
this._updateInProgress = true; this._updateInProgress = true;
this._uploading = false; this._uploading = false;
@ -392,10 +370,6 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
this._subscribedNodeFirmwareUpdate = undefined; this._subscribedNodeFirmwareUpdate = undefined;
} }
private async _firmwareTargetChanged(ev) {
this._firmwareTarget = ev.detail.value.firmware_target;
}
private async _uploadFile(ev) { private async _uploadFile(ev) {
this._firmwareFile = ev.detail.files[0]; 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?", "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}.", "introduction": "Select the firmware file you would like to use to update {device}.",
"upload_firmware": "Upload Firmware", "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", "upload_failed": "Upload Failed",
"begin_update": "Begin Firmware Update", "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.", "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_InvalidHeaderFormat": "Invalid Header Format",
"Error_InsufficientMemory": "Insufficient Memory", "Error_InsufficientMemory": "Insufficient Memory",
"Error_InvalidHardwareVersion": "Invalid Hardware Version", "Error_InvalidHardwareVersion": "Invalid Hardware Version",
"OK_WaitingForActivation": "Waiting for Activiation", "OK_WaitingForActivation": "Waiting for Activation",
"OK_NoRestart": "No Restart", "OK_NoRestart": "No Restart",
"OK_RestartPending": "Restart Pending" "OK_RestartPending": "Restart Pending"
} }