From the app it doesn’t work, seem to be a permission thing. I am however able to get all flows.
Error i receive:
missing_scopes: Je hebt geen toegang om dit te doen.
at /node_modules/athom-api/dist/index.js:1:1242141
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 403,
cause: t {
__athom_api_type: ‘HomeyAPI.ManagerFlow.Error’,
code: 403,
error: ‘missing_scopes’,
error_description: ‘Je hebt geen toegang om dit te doen.’,
‘$stack’: undefined
}
Does anyone have a clue what I could do to fix this?
The API permission ("homey:manager:api" ) allows an app to access the Homey Web API. This web api can be used to control all of Homey (devices, Flows, etc) even if they are not part of the App that requested the permission.
'use strict';
const Homey = require('homey');
const { HomeyAPI } = require('homey-api');
class MyApp extends Homey.App {
/**
* onInit is called when the app is initialized.
*/
async onInit() {
this.homeyApi = await HomeyAPI.createAppAPI({
homey: this.homey,
});
this.homeyApi.flow.triggerFlow({ id: "c4330edf-8131-4a37-9729-c83872fed6ff" }).catch((e) => {
console.warn(e);
});
this.log('MyApp has been initialized');
}
}
module.exports = MyApp;
Log:
─────────────── Logging stdout & stderr ───────────────
[log] 2023-05-22 09:18:50 [MyApp] MyApp has been initialized
[HomeyAPIError: Je hebt geen toegang om dit te doen.] {
statusCode: 403,
description: 'Je hebt geen toegang om dit te doen.'
}