I don’t understand your “split[‘link’])” and what you expect from it ?
But the split method is on string object, if the output is as you cite, this is a structure by itself, so you’ll have to extract the attribute first to get a string.
Or you can try to cast to a string and see if you can manage from this : > {{ (states.sensor.engineering_feed.attributes["RouterOS 6.43.2 [Stable]"] | string).split ('<separator>') [0] }}
That error is because you are trying to access the dictionary object and use split on it. Split is a string operation, not dictionary operation. You shouldn’t even need this based on what I wrote above.
That’s strange that you get an empty string when you cast the answer as a string. I tried to put the output you provided as my source and I can make it work.
If the list you have is always ordered, then this would work : states.sensor.engineering_feed.attributes| string).split('[Stable]')[0].split("'")[-1]
If it needs sorting, this should work for latest stable :
1 - The structure itself ain’t but I supposed the source ordered the items. See that the latest in each category comes first (Stable, Testing, long term…). Anyway, the sorted version should work though I don’t use sort in my configuration.
2 - What do you mean ?
This : {'RouterOS 6.43.2 [Stable]': {} }
It will work as [Stable] gets removed, the [0] item is still what’s on the left side and there’s still the ’ to get the string.
Of course, if there is no “[Stable]” item in the list, it will fail, displaying a ] ! But I found this quite unlikely in that case.
That’s my point. Your solution doesn’t cover all cases, which is why you need to search for [Stable] in the name, filter the list, and choose the highest revision. Doing a simple split in this case with your method would result in:
As long as you have at least 1 Stable version, it works. In your example I have this result. I splitted in several actions so that you see how it cuts and selects the parts.