WTH - There's no lovelace built -in way of knowing the current user

A couple days ago I tried to show some cards only if the current user in a certain zone. That way, when I’m at my local supermarket the shopping list card could be at a very prominent spot in my dashboard.
However, if it’s me who is in the supermarket, the sopping list should not show up for my wife who’s at home or at work.

There are community built cards like GitHub - thomasloven/lovelace-state-switch: 🔹Dynamically replace lovelace cards depending on occasion that provide some solution for this problem, but it fells a bit WTH that one can’t just know who the current logged user is inside lovelace through something more baked in that doesn’t require reaching for packages in HACS.

FWIW, this is how my dashboard looks when I’m home

And this is how it looks when Home Assistant detects that I’m at or very near my usual supermarket

At least for me location-and-user contextual widgets are a very important quality of life thing.

Cheers

Because there can be more than 1 user logged in at a time, and a single user can be logged in more than once as well. For example, I’m logged into HA at all times via 3 deices, my wife is logged in at all times via 2 devices.

What would the sensor’s state be? Me? My wife?

It depends on the device. In my phone, the current logged user would be me. In my wife’s phone it would be my wife. On my laptop it would also be me, just like in my phone.

This is not like browser_mod in the sense that I don’t care about the device or browser itself, but about the logged user.

Maybe sensor is not the right abstraction as sensors are “backend” properties (probably not the right terminology, sorry), but perhaps a “UI property” signalling the current user/person would be a better name.

A sensor cannot have 2 different states at the exact same time.

You can get this information in the backend by looking at the context object of information that’s passed to automations and scripts.

Can you access what the current user is from the UI to use it in cards? That’s where I think this would be more valuable.

No, but views can be changed to display based on the user.

However, correct me if I’m wrong, if I have a fairly complex dashboard, I’d have to completely duplicate a yaml with well over a thousand lines just to add one different user-conditional card for each user, and then worry about keeping both views in sync moving on as I continue to make improvements.

Or just create a single view…

I’m not sure I got that last comment. If you have a single view for everyone you can’t have cards only visible to certain users (and/or under certain conditions), can you?

Yes you can? You just build the logic.

Either way, it sounds like your WTH really should be “I’d like a user based condition for conditional cards”.

Essentially, yes. I’ll reword my initial post.

Earlier this year I was looking for a solution for this exact same issue. The conditional card is not a great card. Can’t have it pass/fail by user, no OR conditions, etc. Long Story short, I found the state-switch card in HACS can show different cards by user, but I still think the conditional card should support this.

That the card I’m also using. It working well, but if felt weird not having some built in way of achieving that.