Need some help.
I currently have an action that assigns the name of a user into a Helper entity (triggered by the opening of a door using the keypad).
service: input_text.set_value
target:
entity_id: input_text.side_door_lock_last_user
data:
value: >-
{% set mapper = { 0:'Master', 1:'Neil', 2:'Carole', 3:'Julia',
4:'Benjamin', 5:'Cleaning', 6:'Bryan'} %} {% set selection =
trigger.event.data['parameters']['userId'] %} {{ mapper[selection] if
selection in mapper else 'Error' }}
I currently have another action where it’s announced using Google Home.
service: tts.google_translate_say
data:
entity_id: media_player.kitchen_2
message: 'Welcome {{ states(''input_text.side_door_lock_last_user'') }}'
I would like this to be smarter where instead of always announcing I would do this when the person arrived home. I have a Person Entity defined for each person (ex person.neil) which tracks if the person is Home or Away. So my thought is to simply check to see if they have been home for at least 5 mins and if so I would not announce anything.
I am trying to figure out how I can template the Entity Id of the person based on the value of “input_text.side_door_lock_last_user”. So in effect I am concatenating a variable that needs to be made lowercase and a fixed string (person.) that I then want to use to look up another value which I will use in a condition.