This commit is contained in:
Koen Kanters committed 2020-02-28 23:52:30 +01:00
1 parent a40ad0c52f
commit dd3678f84b
2 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -43,8 +43,8 @@ class OTAUpdate extends BaseExtension {
// Respond to the OTA request:
// - In case we don't support OTA: respond with NO_IMAGE_AVAILABLE (0x98) (so the client stops requesting OTAs)
// - In case we do support OTA: respond with ABORT (0x95) as we don't want to update now.
const endpoint = data.device.endpoints.find((e) => e.supportsOutputCluster('genOta'));
await endpoint.commandResponse('genOta', 'queryNextImageResponse', {status: supportsOTA ? 0x95 : 0x98});
// const endpoint = data.device.endpoints.find((e) => e.supportsOutputCluster('genOta'));
// await endpoint.commandResponse('genOta', 'queryNextImageResponse', {status: supportsOTA ? 0x95 : 0x98});
}
async readSoftwareBuildIDAndDateCode(device, update) {
+4 -4
View File
@@ -175,8 +175,8 @@ describe('OTA update', () => {
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledWith(device, logger, {"imageType": 12382});
expect(logger.info).toHaveBeenCalledWith(`Update available for 'bulb'`);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x95});
// expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
// expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 0x95});
// Should not request again when device asks again after a short time
await zigbeeHerdsman.events.message(payload);
@@ -198,7 +198,7 @@ describe('OTA update', () => {
const payload = {data, cluster: 'genOta', device, endpoint: device.getEndpoint(1), type: 'commandQueryNextImageRequest', linkquality: 10};
await zigbeeHerdsman.events.message(payload);
await flushPromises();
expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 152});
// expect(device.endpoints[0].commandResponse).toHaveBeenCalledTimes(1);
// expect(device.endpoints[0].commandResponse).toHaveBeenCalledWith("genOta", "queryNextImageResponse", {"status": 152});
});
});