I managed to integrate alexa’s shopping list in home assistant, which is already pretty dope.
I want to take this to the next level and display the shopping list in a prominent place in the dashboard for users that are in the supermarket (I’ve defined my usual supermarket as a zone in home assistant).
However, I couldn’t find any information on how to find out who the current logged user. If i want shopping and my wife stayed at home, I want the shopping list to show for me but not for her, and the other way around.
If I only was able to know who the current logged user is, I could use a conditional card to display the shopping list.
I believe that this could be done with browser_mod, but I don’t care as much for the specific device as i do for the user, and HA clearly knows who the current user is, so this seems like something that should be possible without third party packages.
Thanks! That worked for me quite well. It is odd however that you have to resort to a card like this instead of having some sort of UI property or sensor named “current user”. Maybe it could go in the WTF initiative of this month.
There are a lot of things that people want to do with Home Assistant that the core does not do, (and possibly never will). Fortunately we have a very active community of third party developers and Home Assistant has allowed a method of inclusion for these third party tools.
I wish alexa exposed webwooks directly instead of having to use todoist as a middle man, which inevitably adds some extra delay, but i’ve found it perfectly usable.
Edit: Solution updated with better templates suggested by KairuByte.
type: custom:state-switch
entity: template
template: >-
{{ user|lower }}_{{ 'home' if is_state('person.' ~ user, 'home') else
'not_home' }}
default: unknown
states:
julien_not_home:
type: markdown
content: You're Julien and you are not at home.
morgane_not_home:
type: markdown
content: You're Morgane and you are not at home.
julien_home:
type: markdown
content: You're Julien and you are at home.
morgane_home:
type: markdown
content: You're Morgane and you are at home.
unknown:
type: markdown
content: I don't know who you are.