Template Sensor isn't updating in logbook

Hello, I have a Zwave door sensor - it’s a binary sensor that automatically populates with “on/off” in the frontend. But since it’s connected to a door, I made a template sensor that lets me see its status in the frontend as “Open/Closed” (it’s just friendlier that way…)

But when I check the logbook for activity from this template sensor, the logbook only ever records the “Closed” event, not the “Open” event.

I thought at first it’s because the door never stayed open long enough for the template sensor to register the change. But when I let the door stand open for 5 minutes, it still didn’t record “Open”. So I think perhaps I’ve set up my template sensor wrong?

      lr_status_door:
        friendly_name: 'Front Door'
        value_template: >-
            {%- if is_state("binary_sensor.lr_door_sensor", "off") -%}
                Closed
            {%- else -%}
                Open
            {%- endif -%}

I also tried

            {%- if is_state("binary_sensor.lr_door_sensor", "off") -%}
                Closed
            {%- elif is_state("binary_sensor.lr_door_sensor", "on") -%}
                Open
            {%- else -%}
                Unknown
            {%- endif -%}

Thanks in advance for any help anyone’s able to provide!

If you’re on 0.82, check the release notes and your logs as there are changes in 0.81(?) that may mean you need to define the entity in the template.

Thanks, I had been reading about these breaking changes. I’m still on 0.81 for now, and this problem has persisted through many version upgrades - I just never bothered with troubleshooting until now.

There are other breaking changes in 0.82 I want to avoid for now so I can’t upgrade just yet.

edit: to clarify, this hasn’t solved my problem!

Just change the device class of the binary sensor to door in the customize section. Also add a friendly name. Then remove the broken sensor.

homeassistant:
  customize:
    binary_sensor.lr_door_sensor:
      device_class: door
      friendly_name: Front Door

Is the sensor state actually changing from “Closed” to “Open” on the frontend? Is it just the logbook that isn’t recording properly?

If that’s the case then I’ve seen that with a bunch of different things in my logbook over the last year. There are many events that don’t get recorded there in mine. It’s never really concerned me too much but there are times I would like to use the logbook for a troubleshooting assistance tool and it disappoints me when what I want to look for isn’t there.