Last_changed is different than history

Hi all,

I’ve a binary sensor from my Reolink camera about the last detections (car, person, etc.). Unfortunately the attribute ‘.last_change’ is different than the history/log of this sensor. You can see the difference within the screenshot, where last change is 3h ago but the latest log change is yesterday at 19 (7pm).

Does anyone know how I can get the last log change via Ninja? I’ve tried something like:

{{ 
   relative_time(
      states.binary_sensor.rlc_810a_eingang_bewegung.last_changed
   )
}}

But it’ll give the 3h only.

Thanks!

I have the same issue with the laundry sensor… History shows last change correctly:

Screenshot 2023-12-22 at 10.31.32

But if I try to template it

{% set last_changed_time = states.binary_sensor.plug_laundry_main_cellar.last_changed %}
{{last_changed_time}}

The output is: 2023-12-22 08:31:55.798640+00:00

Which matches with the “1 hour ago” in the history, but NOT with the last state change…

My gut feeling is that .last_changed fetches the last time the sensor sent an update and not, correctly, the time the state changes… I have no clue though if there are further properties one can access beside .last_changed

BTW, checking .last_updated gives back the same value :frowning:

Did you restart HA this “an hour ago” time?

Same question as was asked.
Last-changed do not survive a HA reboot.

Not “last log change”, it is a “last change of an entity’s state”.
Your command is correct.
Jinja, not Ninja.