diff --git a/src/devices/lixee.ts b/src/devices/lixee.ts index 80c6105cc5dc0..b499efab25681 100644 --- a/src/devices/lixee.ts +++ b/src/devices/lixee.ts @@ -1860,7 +1860,7 @@ const definitions: DefinitionWithExtend[] = [ throw e.reason; }); }, - ota: ota.lixee, + ota: ota.zigbeeOTA, onEvent: async (type, data, device, options) => { const endpoint = device.getEndpoint(1); if (type === 'start') { diff --git a/src/lib/ota/index.ts b/src/lib/ota/index.ts index 45d1ae0bbc3ca..d34616afaffc5 100644 --- a/src/lib/ota/index.ts +++ b/src/lib/ota/index.ts @@ -4,7 +4,6 @@ import * as gmmts from './gmmts'; import * as inovelli from './inovelli'; import * as jethome from './jethome'; import * as ledvance from './ledvance'; -import * as lixee from './lixee'; import * as salus from './salus'; import * as securifi from './securifi'; import * as tradfri from './tradfri'; @@ -13,6 +12,6 @@ import * as zigbeeOTA from './zigbeeOTA'; const {setDataDir} = common; -export {inovelli, ledvance, salus, lixee, securifi, tradfri, ubisys, zigbeeOTA, jethome, gmmts, setDataDir}; +export {inovelli, ledvance, salus, securifi, tradfri, ubisys, zigbeeOTA, jethome, gmmts, setDataDir}; export type ImageInfo = Ota.ImageInfo; diff --git a/src/lib/ota/lixee.ts b/src/lib/ota/lixee.ts deleted file mode 100644 index cb3ed9a6a1560..0000000000000 --- a/src/lib/ota/lixee.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {logger} from '../logger'; -import {KeyValueAny, Ota, Zh} from '../types'; -import * as common from './common'; - -const firmwareOrigin = 'https://api.github.com/repos/fairecasoimeme/Zlinky_TIC/releases'; - -const NS = 'zhc:ota:lixee'; -const axios = common.getAxios(); - -/** - * Helper functions - */ - -export async function getImageMeta(current: Ota.ImageInfo, device: Zh.Device): Promise { - logger.debug(`Call getImageMeta for ${device.modelID}`, NS); - const {data: releases} = await axios.get(firmwareOrigin); - - if (!releases?.length) { - throw new Error(`LixeeOTA: Error getting firmware page at ${firmwareOrigin}`); - } - - let firmURL; - - // Find the most recent OTA file available - for (const e of releases.sort((a: KeyValueAny, b: KeyValueAny) => a.published_at - a.published_at)) { - if (e.assets) { - const targetObj = e.assets.find((a: KeyValueAny) => a.name.endsWith('.ota')); - if (targetObj && targetObj.browser_download_url) { - firmURL = targetObj; - break; - } - } - } - - if (!firmURL) { - return null; - } - - logger.info(`Using firmware file ` + firmURL.name, NS); - const image = common.parseImage((await common.getAxios().get(firmURL.browser_download_url, {responseType: 'arraybuffer'})).data); - - return { - fileVersion: image.header.fileVersion, - fileSize: firmURL.size, - url: firmURL.browser_download_url, - }; -} - -/** - * Interface implementation - */ - -export async function isUpdateAvailable(device: Zh.Device, requestPayload: Ota.ImageInfo = null) { - return await common.isUpdateAvailable(device, requestPayload, common.isNewImageAvailable, getImageMeta); -} - -export async function updateToLatest(device: Zh.Device, onProgress: Ota.OnProgress) { - return await common.updateToLatest(device, onProgress, common.getNewImage, getImageMeta); -} - -exports.isUpdateAvailable = isUpdateAvailable; -exports.updateToLatest = updateToLatest;