Binary_sensor became "unknown" - why?

Consider this binary_sensor:

      - name: alert_iphone
        device_class: problem
        state: >-
          {% set DEVICE_TRACKER = "device_tracker.iphone" -%}
          {%- if state_attr(DEVICE_TRACKER,"status") is none -%}
            on
          {%- elif not state_attr(DEVICE_TRACKER,"status") is match("online",ignorecase=true) -%}
            on
          {%- else -%}
            off
          {%- endif %}
        availability: >-
          {% set DEVICE_TRACKER = "device_tracker.iphone" -%}
          {{ not states(DEVICE_TRACKER) in ["unavailable","unknown"] }}

The sensor is supposed to set dependently on some “status” attribute of some “device_tracker”.
This attribute could be:
– “online” - means OK,
– smth else - means BAD;
– or it may not exist.

Here are graphs for these 2 entities:

изображение

The current state of the “device_tracker” is

изображение

i.e. it is faulty, no “latitude/longitude” & “status” is not present.
The question is not about why the tracker became faulty.
It is about - how a binary_sensor may become “unknown”?

Can anyone suggest any possibly versions?

The “device_tracker.iphone”:

  1. May be “unknown” - if this entity does not exist.
  2. May not have the “status” attribute. This is probably supposed to be processed by “state_attr(DEVICE_TRACKER,“status”) is none” condition.
  3. May have the “status” attribute’s value = “offline” or smth else.

In all these cases the target “binary_sensor.alert_iphone” may be “unavailable” or “on/off”.
See no reason for the “binary_sensor” become “unknown”.