I have a sensor named “sensor.day_time_openweather_custom” which result a combined string of two sensors (ex: day_clear, night_rain, …)
I use a markdown card, with the following details:
type: markdown
content: '{{ states.sensor.day_time_openweather_custom.state.split("_")[1] | title }}'
Which will split the string and show me only what is after “_” character (ex: (ex: Clear, Rain, …)
Now, all good, it is working, but the thing which is annoying me is that the log of home assistant is showing me too many lines of this:
2021-11-25 13:29:16 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: list object has no element 1 when rendering '{{ states.sensor.day_time_openweather_custom.state.split("_")[1] | title }}'
Well… I thing it should be always with values in both items…
First item is written by me, manually, in the sensor, and the second item is extracted from weather state, which should be everytime.
That warning is shown only after restarting home assistant, which means that the value of the second item, is loading slower than home assistant, I don’t understand
If is so, I will make a template to verify if there is any value first, then show it… I hope it will solve it. Thank you!