I have a simple notification script where I would like to replace the according static code part by a variable, which would make it possible to notify dynamically the according script-calling device.
So instead of this: notify.mobile_app_myPhone
Something like this: "notify.mobile_app_{{myPhone}}"
Would that be possible? If so, what would the variable {{myPhone}} look like?
Thank you!
The idea behind this is I would like the script to send the according message to the device that has called the script originally.
So if I call the script with my device, the notification message should appear on my device.
If my wife calls the script with ther device, the notification message should appear on her device.
If one of my kids calls the script with its device, the notification message should appear on its device.
If im understanding you correctly then youd like your script to automatically pick the correct mobile device based on who called the script?
If so you can use context to do what you want.
You will have to convert the context.user_id to the correct action as i dont think the user_id is the same as the action. As others have said that would also depend how the script is been called.
Ok, I was not aware that the answer is dependent on how the script is being called, apologies.
The script is being called by double tapping an according card as follows:
ok, then it’s not a variable, which is why most of us are confused. In order to make a proper template, we need to see your actual mobile id because you have to link user to person to assigned device tracker, then extrapolate the device tracker object_id for use in the notify service.
Right I can see the point of it not being a variable when I do not pass any values to the script, lesson learnt on how to be more precise, thanks for the hint!
Well currently I have the following three mobile IDs (assuming you mean the device names in HA):