It should be possible to determine the current user from a HomeyScript, either through an API call or by accessing a variable or tag.
An example use case is to send a confirmation message during a Flow. If you use the following script, it always sends the confirmation to the Homey owner, not the user who is running the Flow:
const response = await Homey.flow.runFlowCardCondition({
uri: 'homey:manager:mobile',
id: 'homey:manager:mobile:push_confirm',
args: {
user: await Homey.users.getUserMe(),
text: args[0]
},
});
return response.result;
Also, the HomeyAPIV3Local exposed to scripts is currently authenticating as the Homey owner, not the current user (is there any reason for that?). It should either authenticate as the current user, or else have an ability to pass the real current user through the API ("impersonation"). Otherwise, a second HomeyAPIV3Local instance, logged in as the current user, should be exposed to scripts.
Also see athombv/homey-web-api-issues#67 for why this is important.
It should be possible to determine the current user from a HomeyScript, either through an API call or by accessing a variable or tag.
An example use case is to send a confirmation message during a Flow. If you use the following script, it always sends the confirmation to the Homey owner, not the user who is running the Flow:
Also, the HomeyAPIV3Local exposed to scripts is currently authenticating as the Homey owner, not the current user (is there any reason for that?). It should either authenticate as the current user, or else have an ability to pass the real current user through the API ("impersonation"). Otherwise, a second HomeyAPIV3Local instance, logged in as the current user, should be exposed to scripts.
Also see athombv/homey-web-api-issues#67 for why this is important.