Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit ca0c8bb

Browse files
peterfeltsppathan
authored andcommitted
Remove duplicate firmware-update related status keys in twin (#209)
* Updating the key name of the reported device firmware update property, so that we won't have two reported properties: 'FirmwareUpdateStatus' and 'DeviceMethodStatus', one of which is always null. * PR feedback. * PR feedback.
1 parent 2d2a92d commit ca0c8bb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Services/data/devicemodels/scripts/FirmwareUpdate-method.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var state = {
1616
// Default device properties
1717
var properties = {
1818
Firmware: "1.0.0",
19-
DeviceMethodStatus: "Updating Firmware"
19+
FirmwareUpdateStatus: "Updating Firmware"
2020
};
2121

2222
/**
@@ -58,33 +58,33 @@ function main(context, previousState, previousProperties) {
5858
// Reboot - devices goes offline and comes online after 20 seconds
5959
log("Executing 'FirmwareUpdate' JavaScript method; Firmware version passed:" + context.Firmware);
6060

61-
var DeviceMethodStatusKey = "DeviceMethodStatus";
61+
var DevicePropertyKey = "FirmwareUpdateStatus";
6262
var FirmwareKey = "Firmware";
6363

6464
// update the status to offline & firmware updating
6565
state.online = false;
6666
state.CalculateRandomizedTelemetry = false;
6767
var status = "Command received, updating firmware version to ";
6868
status = status.concat(context.Firmware);
69-
updateProperty(DeviceMethodStatusKey, status);
69+
updateProperty(DevicePropertyKey, status);
7070
sleep(5000);
7171

7272
log("Image Downloading...");
7373
status = "Image Downloading...";
74-
updateProperty(DeviceMethodStatusKey, status);
74+
updateProperty(DevicePropertyKey, status);
7575
sleep(7500);
7676

7777
log("Executing firmware update simulation function, firmware version passed:" + context.Firmware);
7878
status = "Downloaded, applying firmware...";
79-
updateProperty(DeviceMethodStatusKey, status);
79+
updateProperty(DevicePropertyKey, status);
8080
sleep(5000);
8181

8282
status = "Rebooting...";
83-
updateProperty(DeviceMethodStatusKey, status);
83+
updateProperty(DevicePropertyKey, status);
8484
sleep(5000);
8585

8686
status = "Firmware Updated.";
87-
updateProperty(DeviceMethodStatusKey, status);
87+
updateProperty(DevicePropertyKey, status);
8888
properties.Firmware = context.Firmware;
8989
updateProperty(FirmwareKey, context.Firmware);
9090
sleep(7500);

0 commit comments

Comments
 (0)