I am trying to use a HomeyScript in an advanced flow, but I do not even get a first simple script running. The documentation is far from clear, so I looking for some help, hopefully some very simple things that I overlook.
When at https://my.homey.app I select the </> button on the left, and here I have several example script that are marked as classic (i.e. using the deprecated API version). I have created a new script, which is not marked as such, so that is great. However, when I try to call a simple Homey.flow.runFlowCardCondition or Homey.flow.runFlowCardAction I get errors all the time.
For instance, when using
let result = await this.Homey.flow.runFlowCardCondition({
uri: 'homey:manager:cron',
id: 'day_equals',
args: {
day: 6, // for Saturday
},
});
log(result);
gives, when running the script, a script error, and no log. What am I doing wrong?
When I remove the await, I get a
Promise { <pending> }
in the log, which is also unwanted, and the result is undefined.
try {
let result = riskyOperation();
return result;
} catch (error) {
// Handle the error and include it in the result
return { success: false, message: error.message };
}
Thanks for the - indeed simple - solution!
I read the text you refer to, but did not understand that it required me to add the uri to the id; I simply removed the uri argument, but that did not work.
(I wonât be able to say that Athom doesnât care about maintaining documentation, at the risk of this post being removed because itâs âtoo negativeâ, so I will refrain from saying so)
Just rephrase it: âapparently somehow it slipped past Athomâs test team, which has to approve the documentationâ
But donât tell me posts (can) get removed when you show and explain whatâs wrong?
And imho itâs not helping thereâs no
timestamps / versioning / author initials, and last but not least no ordinairy âcommentsâ section, to have the improvement ideas right where the issue is.
Iâve had posts removed when I pointed out that it felt like Athom seemed perhaps somewhat less motivated to improve certain parts of Homey that are known, and have been known for a long time, to be um âproblematicâ
The various Github repositories that are used to âtrackâ issues with the SDK or Web API are filled with comments that point out incorrect and/or insufficient documentation.