History_stats: how "count" value is defined for template binary_sensor?

Let’s see how a "count" value is defined for "history_stats" sensor:

Case 1:
There is a ping device tracker for some PC:

device_tracker:
  - platform: ping
    hosts:
      pc_ping_device_tracker: !secret pc_ip
    count: 2
    consider_home: 60

Now I want to check how many times this PC was unavailable a day:

sensor:
  - platform: history_stats
    name: "PC unavailable today (tracker)"
    entity_id: device_tracker.pc_ping_device_tracker
    state: "not_home"
    type: count
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

If the PC is ON during a day, the sensor’s value is supposed to be 0.
And it is a 0 - so the "count"value is defined properly.

Case 2:
There is a ping binary sensor for the same PC:

binary_sensor:
  - platform: ping
    host: !secret pc_ip
    count: 2
    scan_interval: 60
    name: pc_ping_availability_status

And the "history_stats" sensor:

  - platform: history_stats
    name: "PC unavailable today (binary)"
    entity_id: binary_sensor.pc_ping_availability_status
    state: "off"
    type: count
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

If the PC is ON during a day, the sensor’s value is supposed to be 0.
And it is a 0 - so the "count"value is defined properly.

Case 3:
There is a "binary_sensor" of "connectivity" device class which is defined based on the "device_tracker.pc_ping_device_tracker" defined above:

binary_sensor:
  - platform: template
    sensors:
      pc_ping_availability_status_2:
        value_template: "{% if is_state('device_tracker.pc_ping_device_tracker','home') -%}
                         {{ 'on' }}
                         {%- else -%}
                         {{ 'off' }}
                         {%- endif %}"
        device_class: connectivity

And the "history_stats" sensor:

  - platform: history_stats
    name: "iiyama-1 unavailable today (test)"
    entity_id: binary_sensor.iiyama_1_ping_availability_status_test
    state: "off"
    type: count
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

And just after HA restart this sensor is = 1.
Why?
Does this mean that the template sensor is zero during HA startup since it is not initialized yet?

Update:
That is my fault - I forgot that all my template binary_sensors are OFF during startup - this is seen in History.
Does it mean that I should not use template binary_sensor as a basis for the "history_stats" sensor?

Since 2022.2 template binary sensors are unknown on HA startup.