Open martijnpoppen opened 9 months ago
My code:
async getApiData() {
this.log(`[getApiData] Setting API_DATA`);
await this._api.flow.connect();
await this._api.flowtoken.connect();
await sleep(2000);
// Fill all caches
this.API_DATA.FLOWTOKENS = Object.values(await this._api.flowtoken.getFlowTokens().catch(e => { console.log(e); return {}}));
this.API_DATA.FLOWS = Object.values(await this._api.flow.getFlows().catch(e => { console.log(e); return {}}));
this.API_DATA.ADVANCED_FLOWS = Object.values(await this._api.flow.getAdvancedFlows().catch(e => { console.log(e); return {}}));
this.API_DATA.FOLDERS = Object.values(await this._api.flow.getFlowFolders().catch(e => { console.log(e); return {}}));
this.API_DATA.SCREENSAVERS = this.appSettings.HOMEY_VERSION === 'Homey2023' ? [] : await this._api.ledring.getScreensavers().catch(e => { console.log(e); return []});
this.API_DATA.APPS = Object.values(await this._api.apps.getApps().catch(e => { console.log(e); return {}}));
this.API_DATA.VARIABLES = Object.values(await this._api.logic.getVariables().catch(e => { console.log(e); return {}}));
this.log(`[getApiData] Setting API_DATA - data length:`, Object.keys(this.API_DATA).length);
}
async findBrokenFlows() {
const flowsArray = [...this.API_DATA.FLOWS, ...this.API_DATA.ADVANCED_FLOWS];
try {
// Add promises to array
for (let i = 0; i < flowsArray.length; i++) {
if (await flowsArray[i].isBroken().catch(e => { this.log(`[findFlows] ${key} - isBroken Error: `, e); return false })) {
console.log(`[findFlows] ${key} - isBroken: `, flowsArray[i].name);
flows.push(flowsArray[i]);
}
}
} catch (error) {
this.log(`[findFlows] ${key} - Error: `, error);
}
}
Hi, Bumping this again. The isBroken() promise for flows in webApi v3 still doesn't work properly. If the call fails it will mark a flow as isBroken while it actually is not.
In flowchecker i'm using this call and it actually gives a lot of false positives. I got these flows from people which were marked as broken:
Some flows which are marked as broken while they are not broken: