Subtract two dates, problem with format

Copy-paste the following template into the Template Editor and confirm it produces the desired result (it reports the number of days).

{{ (now().date() - (states('sensor.rockrobo_vacuum_v1_last_clean_end') | as_datetime | as_local).date()).days }}

EDIT

Correction. Misplaced parenthesis.

3 Likes