…but I’m not yet familiar with Jinja, I’m failing at a few things, e.g. it seems I cannot do something like `
{{ list_of_values | sort(reverse=True) | [:4] }}
…and also I’ve not found the Jinja equivalent to #compact that removes nils from an array/list.
Oh, if anyone can point me to something like “A beginners guide to Jinja for people who know Ruby” I’d appreciate it. Also if there’s a better place to ask for Jinja advice than here in the “Configuration” forum of HA.
Best to combine them, first only select the numeric values, then map them to float. Otherwise the non-numeric values will be treated as 0.
Unless you want null to be treated as 0, which would make sense. It will become more complicated then if there are other non numeric values like unavailable
Thanks, @123, @Didgeridrew and @TheFes. I don’t want to map the values to a default value, so I’ll use select('is_number') or reject('eq', none). They are temperature values from various indoor sensors, I’m calculating the offset between target temperature and current temperature to see how much heating power is currently needed.
As for Jinja, I’ve seen the documentation. It’s just hard to find something if you don’t know how it is called in a specific language, e.g. the [:4]. I think I’ve seen a website comparing many coding languages with many different examples, hopefully I can find it again and it includes Jinja, that would allow me to compare Ruby code and Jinja next to each other.