I am looking on how to extract a certain value from a state.attribute. I always need the time after dlt: returned to be used in a sensor template, in this case ‘19:47’
This would probably be easier with regex but off the top of my head I don’t know the regex syntax in Jinja2, so this is a generic Python workaround. Substitute the value of str for your attribute value:
Many thanks for your reply! I am really sorry, I was to unprecise I think.
Below the corrected state.attribute. value of “status:” can be different, could be as well ‘Ausfall’ or something else. So it’s not always the same amount of characters before dlt.
So I would need to search for “dlt: '” and then return the next 5 characters. I don’t need to do calculations with this value, so even just text format would be fine, as well the date does not matter.