Homey.users.getUserMe() Returns Incorrect User Information in Homey Script

Hi everyone,

I encountered an issue with the Homey.users.getUserMe() function when using it in Homey Script.

  • Expected Behavior:
    When I run Homey.users.getUserMe() on the Homey Developer platform, it correctly returns my information (e.g., my role, name, etc.), as expected.

  • Actual Behavior:
    However, when I execute the exact same command (Homey.users.getUserMe()) in Homey Script, it always returns the information of the owner of the Homey box (the primary account), instead of my own user information.

This seems to be inconsistent, as the function works as expected in the Developer platform but not in Homey Script.

Is this the intended behavior? If so, is there another way to retrieve the user information of the person triggering the flow or running the script?

Any help or clarification would be greatly appreciated!

Thanks in advance.

The way I see it you found a bug.

I’ve tried the same, same results (Pro 2019)

Conclusion the script always runs in the context of the owner.

And that is logical imho as who should be the user when something happens like a door opend…

At least you can’t expect Homey to asume it is someone else.

Best case it should run then in system or some other low priv user context
System would be a even bigger security issue.

I understand your logic, but I don’t think it’s intentional, because it means that someone who can create a flow will execute it as the owner.
I find that user rights at homey are very poorly managed, not only can you not create restrictions for certain guest users, but you can’t do it even via a script.
I think this is more a side-effect of the fact that homey script is run as a proprietary application than a deliberate choice during development…
In any case, it makes this command completely useless in my opinion (except perhaps for application developers).
So there’s no way of knowing who’s launching a flow or its status, which is a shame!

Almost Correct,
it could even be a trigger
As said fe a door contact. You can see that from the device insights.

In fact, here’s my real problem.
I have a regular guest (my brother-in-law) who comes to my house very often and sometimes to watch the dog.
So naturally I created a guest account for him to open the gate, the front door and the alarm.
But he has access to everything and it’s quite annoying: the lights, the presence, the cameras…
So I’d like to manage his rights, but it’s not advanced enough, so I’m looking for ways to divert him via scripts, and I’m also logging door openings with the person who opened it, for example.
If anyone has a solution other than third-party software, I’d love to hear from you.

These Device Capabilities app cards do work, they provide different user and client info:

1 Like

Hello,

Thanks for your reply, I already know this trick but it doesn’t really interest me because it implies that the user must perform an action on an object and not on a feed.
The thing is that on android you can’t put shortcuts (widgets) on objects but only on flows.
My intention behind this post is to explore the possibilities via homey script and another application that could allow you to do this in a flow.

What other application?

Sorry, it’s not “and” but “or”.
I’m looking for another application that might help me in my search, such as homey script or advanced device capabilities.

Ok. In that case you now know the restrictions from Homey and almost sure the only other option is the Device Capabilities app as mentioned by @Peter_Kawa

It doesn’t work either, several posts in the device capabilities topic were talking about it just yesterday.
I understand that you don’t have the solution to my problem but that doesn’t make it go away, thanks for taking the time to read.
Anyway, if one day someone comes up with a clue, I’d love to hear from you!

Please define “doesn’t work”.

I only want to let you know, the tests and resulting log I showed were created right before I posted it the other day.

But, a possible difference might be: I own Pro 2019’s, and you probably own a Pro 2023 (you didn’t mention it)?

I hope Device Capabilities developer Arie finds a fix if “it doesn’t work” on a Pro 23.

Yes exactly, if I’ve understood the posts correctly there’s trouble with hp23 you can’t spot the capabilities.

Is there any solution to retrieve the user who triggered a flow (be it from the dashboard, from the iOS widget, from Shortcuts, etc.)? My use case is that I want to send a “push confirmation” to the user who triggered the flow so that they can respond to a question before continuing the flow. The built-in “And” card requires that you specify a fixed recipient of the notification, so instead I’m using a HomeyScript to send the notification to “await Homey.users.getUserMe()”, and currently this sends the notification to the owner of the Homey Pro so it’s pretty useless…

Honestly, I don’t understand why the current user cannot be retrieved when you run a Flow explicitly (by clicking on it).

Athom, anyone reason this?

NO.

Don’t expected Athom to answer here… this is a community forum. Pls contact Athom by creating a support ticked using the support system.

I’ve created a support ticket, but so far there’s been no response…
You can also create one to support the request

Possibilities increase when you use these tools by Device Capabilities app, see screenshot 2 & 3.

In case a flow turns on a light, you can determine who started a flow with what.
Next, you can retrieve the flowname in the light’s history:

Device Capabilities app cards: