Skip to content

Bug: LoggedUserSensor sensor shows wrong value if logged in as another user #38

Closed

Description

@bverkron

If HASS.Agent is installed under user account A which is signed-in in the background but user B is currently logged in and has an active desktop session the LoggedUserSensor reports the name of user A, not user B.

Based on that behaviour I believe that LoggedUserSensor would only ever show the name of the user HASS.Agent is installed under.

I assume this is a side effect of HASS.Agent currently being installed under / tied to a specific user. This will likely be solvable once the 'satellite service' is implemented.

Activity

  1. changed the title [-]LoggedUserSensor sensor shows wrong value if another user is logged in.[/-] [+]LoggedUserSensor sensor shows wrong value if logged in as another user[/+] on Mar 9, 2022
  2. LAB02-Admin commented on Mar 9, 2022

    @LAB02-Admin
    Member

    You're right, that can be fixed with the satellite service. Thanks for posting this though, otherwise I hadn't known :)

    hassagent-3

  3. self-assigned this
    on Mar 9, 2022
  4. changed the title [-]LoggedUserSensor sensor shows wrong value if logged in as another user[/-] [+]Bug: LoggedUserSensor sensor shows wrong value if logged in as another user[/+] on Mar 9, 2022
  5. bverkron commented on Mar 12, 2022

    @bverkron
    Author

    Related but slightly different issue with this sensor is that the value of the sensor remains set to the username even when the PC is locked. It's debatable whether this should be the case or not because technically the user is still "logged in" but the intent of this sensor IMO is to show which user has an active desktop session (i.e. is logged into the desktop session and is actively using the PC).

    Thinking about the future where we have a "satellite service" and multiple users are supported and multiple users are logged in what should this value be? For example when more than one user is logged in but the PC is locked should it show the username of the last user to have an active desktop session? Should it show something like "system" or "locked"? Hmmmm 🤔

  6. LAB02-Admin commented on Mar 13, 2022

    @LAB02-Admin
    Member

    Hey @bverkron,

    I've been thinking about this as well, and this is what I've come up with so far:

    I'm going to make the LoggedUsersSensor more strict: only users with an active session will be listed. Locked means not active, so not listed.

    The LoggedUserSensor will be based on the same code, but will always just show one user: if more are logged, it'll take the first.

    It's up to the user to decide what they need, I don't think Windows 10/11 even support multiple active (remote desktop) users out of the box, so usually the LoggedUserSensor will do.

    The SessionStateSensor can be used to show whether a specific user's session is locked or not.

    Let me know what you think!

  7. LAB02-Admin commented on Jun 26, 2022

    @LAB02-Admin
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions