mirror of
https://github.com/Koenkk/zigbee-OTA.git
synced 2026-06-24 10:58:33 +00:00
Ubisys S1 missing firmware (#717)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -20,7 +20,10 @@ const FIRMWARE_HTML_URL = 'http://fwu.ubisys.de/smarthome/OTA/release/index';
|
||||
|
||||
function groupByImageType(arr: Image[]): GroupedImages {
|
||||
return arr.reduce<GroupedImages>((acc, cur) => {
|
||||
acc[cur.imageType] = [...(acc[cur.imageType] || []), cur];
|
||||
acc[cur.imageType + (cur.hardwareVersionMax ? cur.hardwareVersionMax : '')] = [
|
||||
...(acc[cur.imageType + (cur.hardwareVersionMax ? cur.hardwareVersionMax : '')] || []),
|
||||
cur,
|
||||
];
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
@@ -76,7 +79,6 @@ export async function download(): Promise<void> {
|
||||
|
||||
for (const imageType in imagesByType) {
|
||||
const image = getLatestImage(imagesByType[imageType], sortByFileVersion);
|
||||
|
||||
if (!image) {
|
||||
console.error(`${LOG_PREFIX} No image found for ${imageType}.`);
|
||||
continue;
|
||||
|
||||
@@ -154,6 +154,8 @@ export function findMatchImage(
|
||||
i.manufacturerCode === image.manufacturerCode &&
|
||||
extraMetas.minFileVersion === i.minFileVersion &&
|
||||
extraMetas.maxFileVersion === i.maxFileVersion &&
|
||||
extraMetas.hardwareVersionMin === i.hardwareVersionMin &&
|
||||
extraMetas.hardwareVersionMax === i.hardwareVersionMax &&
|
||||
i.modelId === extraMetas.modelId &&
|
||||
(!(i.manufacturerName && extraMetas.manufacturerName) || primitivesArrayEquals(i.manufacturerName, extraMetas.manufacturerName)),
|
||||
);
|
||||
|
||||
@@ -93,6 +93,14 @@ export const IMAGE_V13_1_METAS = {
|
||||
sha512: '4d7ab47dcb24e478e0abb35e691222b7691e77ed5a56de3f9c82e8682730649b1a154110b7207d4391c32eae53a869e20878e880fc153dbe046690b870be8486',
|
||||
otaHeaderString: 'OM15081-RTR-JN5189-0000000000000',
|
||||
};
|
||||
|
||||
/**
|
||||
* Use when V14 has a hardware constraint set.
|
||||
*/
|
||||
export const IMAGE_V13_1_METAS_MAIN = {
|
||||
...IMAGE_V13_1_METAS,
|
||||
url: `${common.BASE_REPO_URL}${common.REPO_BRANCH}/images/${IMAGES_TEST_DIR}/${IMAGE_V13_1}`,
|
||||
};
|
||||
/**
|
||||
* - otaUpgradeFileIdentifier: <Buffer 1e f1 ee 0b>,
|
||||
* - otaHeaderVersion: 256,
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
IMAGE_V12_1_METAS,
|
||||
IMAGE_V13_1,
|
||||
IMAGE_V13_1_METAS,
|
||||
IMAGE_V13_1_METAS_MAIN,
|
||||
IMAGE_V14_1,
|
||||
IMAGE_V14_1_METAS,
|
||||
IMAGE_V14_2,
|
||||
@@ -553,12 +554,13 @@ Text after end tag`);
|
||||
});
|
||||
|
||||
it('success with multiple files and specific extra metas', async () => {
|
||||
filePaths = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)];
|
||||
filePaths = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1), useImage(IMAGE_V12_1)];
|
||||
const newContext = withBody(`Text before start tag
|
||||
\`\`\`json
|
||||
[
|
||||
{"fileName": "${IMAGE_V14_1}", "manufacturerName": ["lixee"], "hardwareVersionMin": 2},
|
||||
{"fileName": "${IMAGE_V13_1}", "manufacturerName": ["lixee"]}
|
||||
{"fileName": "${IMAGE_V13_1}", "manufacturerName": ["lixee"]},
|
||||
{"fileName": "${IMAGE_V12_1}", "manufacturerName": ["lixee"]}
|
||||
]
|
||||
\`\`\`
|
||||
Text after end tag`);
|
||||
@@ -569,18 +571,19 @@ Text after end tag`);
|
||||
expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME);
|
||||
expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME);
|
||||
expect(addImageToBaseSpy).toHaveBeenCalledTimes(2);
|
||||
expect(addImageToPrevSpy).toHaveBeenCalledTimes(0);
|
||||
expect(addImageToPrevSpy).toHaveBeenCalledTimes(1);
|
||||
expect(writeManifestSpy).toHaveBeenCalledTimes(2);
|
||||
expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [
|
||||
withExtraMetas(IMAGE_V13_1_METAS_MAIN, {manufacturerName: ['lixee']}),
|
||||
withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee'], hardwareVersionMin: 2}),
|
||||
]);
|
||||
expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [
|
||||
withExtraMetas(IMAGE_V13_1_METAS, {manufacturerName: ['lixee']}),
|
||||
withExtraMetas(IMAGE_V12_1_METAS, {manufacturerName: ['lixee']}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('success with multiple files and specific extra metas, ignore without fileName', async () => {
|
||||
filePaths = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)];
|
||||
filePaths = [useImage(IMAGE_V12_1), useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)];
|
||||
const newContext = withBody(`Text before start tag
|
||||
\`\`\`json
|
||||
[
|
||||
@@ -595,12 +598,13 @@ Text after end tag`);
|
||||
|
||||
expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME);
|
||||
expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME);
|
||||
expect(addImageToBaseSpy).toHaveBeenCalledTimes(2);
|
||||
expect(addImageToBaseSpy).toHaveBeenCalledTimes(3);
|
||||
expect(addImageToPrevSpy).toHaveBeenCalledTimes(0);
|
||||
expect(writeManifestSpy).toHaveBeenCalledTimes(2);
|
||||
expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [
|
||||
IMAGE_V13_1_METAS_MAIN,
|
||||
withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee'], hardwareVersionMin: 2}),
|
||||
]);
|
||||
expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]);
|
||||
expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V12_1_METAS]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user