Skip to content

Current user should be available from HomeyScript #60

@dfischer0

Description

@dfischer0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions