I am trying to parse a todo shopping list, where various members of the family can enter items they want to add to the list.
I found that someone for example added "Lemons " with a trailing space. Using this simple code.
action: todo.get_items
data: {}
target:
entity_id: todo.google_keep_shopping
but no matter how I try to parse the list to get the name of the item instead of returning "Lemons " i get “Lemons” without the trailing space
Hence I want to remove that space from the todo list but it wont let me update it as in my code it is always looking for “Lemons”
So my question is as I can also parse the UID how do I modify the summary/name of the item using the UID as a reference.
or alternatively
how do I parse the list, to retrieve the name with the space intact.
As an alternative that may or may not be helpful to you, Node Red will preserve the space at the end, allowing you to parse and edit with code.
In the end, I found an answer, you can use the UID and use that as the name of the item and then rename to clean off trailing spaces, appears to be working well. I can now say to google add shopping or a chore to a list and it syncs with HA. Next stop Alexa. lol
Very similar to another recent thread, read it and you’ll get several solutions:
It’s impossible to complete a task in todo list using a jinja template, when the name of the task ends with a space.
For example let’s say that I have a todo list, and its tasks are stored in a list (I have an entity that has that list as an attribute), such as
[take your pill ,brush your teeth,training]
then updating the task to complete it by using this as the item
{{ list[1] }}
will work. But this will not work:
{{ list[0] }}
as the jinja removes the space at the end and then there is …