Why does the sensor template display different statuses in the history and event log?

Why this sensor template in the history displayed the beginning of the movement, but in the event log is not, in the log are two entries in a row to turn off that is the cessation of movement, how could this happen where is the error ?

It happened once, it was fine before that, but I would like to fix the template so it doesn’t happen again

template:
- trigger:
    - trigger: state
      entity_id: binary_sensor.dvizhenie_spalnia
      not_to:
        - unknown
        - unavailable
  binary_sensor:
    - name: Movement_knx_spalnia_templ
      unique_id: move_knx_bedroom
      state: '{{ trigger.to_state.state }}'