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.