I’ve been trying to find a solution to this with no avail. I need to remove the decimal from the seconds in this string:
2023-01-04 19:04:30.997145
Basically I need this value template to work and it seems the decimal throws it off:
{% if (now().today() - strptime(value, '%Y-%m-%d %H:%M:%S')) < timedelta(
seconds = 3 ) %}
on
{% else %}
off
{% endif %}
The format (the stuff starting '%Y-') has to match the string format you have given, and %S doesn’t include stuff after the decimal point. This however seems to work: