If I need to request the value of a script attribute in the script itself, e.g. its friendly_name, can I simply point to the current script in such a request {{state_attr(‘script.vanna’, ‘friendly_name’)}} or can I request it differently?
I would like to get a universal friendly_name query for all scripts to output error messages, which is the same in many of my scripts and only the script name changes
I don’t use telegram. So, I can’t test what you have. But can you test the persistent notification I provided to see if it is working for you?
If it is then you need to figure out the difference between the two. If not working then we can work on that.
Oh. I think I know what is happening. You may be losing ‘this’ due to the loop you have in there. You need to do a search on the scope of variables. Might need to setup a namespace outside the loop and set a variable inside there to hold ‘this’.
I might be able to test this and reply late this coming week if someone does not help in the mean time.
I could not replicate your example, I put the alert at the very top of the script on top of all loops same error
I changed the notification method using just a push to my smartphone, the error is still there
what kind of notification method is working for you ?
That definitely should not be what is happening. In neither HASS nor Jinja should there be any issues with accessing variables inside a loop that were defined outside of it.
What you are talking about (namespaces) is the reverse, how to make results from inside of a loop accessible on the outside, in Jinja. (The closest analog for HASS itself would be using helpers).