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.'
}
I don’t understand why the Homey Web API would block this. A mood exposes less functionality than devices, yet with "homey:manager:api" permission I can control all devices.
The funny thing is… I can read the properties (the configuration) of the mood and I can control the capabilities of the devices. That means I can actually set a mood by applying (for each device in the mood) each property in the mood to the capability in the device. So why don’t they save me the trouble and just allow setting moods when you have "homey:manager:api" permission? They could also add a new permission "homey:manager:moods" that explicitly allows setting moods.
For my setup at home, I can easily solve this by creating a HomeyScript “Set mood by ID”, but I would have loved to have this card in my app and offer it to the rest of the community too.
Thanks for responding… not the answer I was hoping for, but much appreciated.
you’ll have to ask Athom to add your app to the web api’s scope list of moods
How do I proceed? Can you point me in the right direction?
↳ Do I open a support ticket for this?
↳ Is there a topic for feature requests?
↳ Is there a mailbox I can write to?
Support ticket is your only way.
There are several things behind the scope wall, devices is one of the few that isn’t.
still waiting for dashboard scope support for HomeyScript (yes even HomeyScript doesn’t have all scopes)