Binarysensors not created in template.yaml

Hello everyone,
I am facing issues with creating some binary sensors inside the template.yaml. All other sensors are created inside it with the exception for the ones that check internet connectivity. No matter how I formatted inside the template.yaml, they dont get created. Here they are:

# Internet connectivity
      - platform: ping
        host: 8.8.8.8
        name: 'Internet Connectivity Google'
        count: 10

      - platform: ping
        host: 1.1.1.1
        name: 'Internet Connectivity Cloudflare'
        count: 10

I am including the whole template.yaml to clarify what is on it. Yes, I did include it in the configuration.yaml:



  - binary_sensor:

    - unique_id: freezer_running_monitor_bst
      name: Freezer Running Monitor (BST)
      icon: mdi:power
      state: "{{states('sensor.zooz_zen15_power_cord_freezer_electric_consumption_v')|float > 50}}"
      
 
 
    - unique_id: joe_home_wifi_tracker
      name: "joe home wifi tracker"
      state: >
        {% if (states('sensor.joes_iphone_ssid') == "Manson") %} or ((states('sensor.joes_iphone_ssid') == "Jeu")) %}
          home
        {% else %}
          not_home
        {% endif %}

    - unique_id: zak_home_wifi_tracker
      name: "joe home wifi tracker"
      state: >
        {% if (states('sensor.zak_ssid') == "Manson") %} or ((states('sensor.zak_ssid') == "Jeu")) %}
          home
        {% else %}
          not_home
        {% endif %}
        
# Set People Home to "Home" if anyone is home
    - unique_id: people_home
      name: "people home"
      state: >
        {{ is_state('person.joe', 'home')
         or is_state('person.marie', 'home')
         or is_state('person.jacob', 'home')
         or is_state('person.zak', 'home') }}
          
  - sensor:
      - name: "Destination address"
        state: >-
          {%- if is_state("input_select.destination", "Home")  -%}
            13th Street. 47 W 13th St, New York, NY 10011, USA
          {%- elif is_state("input_select.destination", "Work")  -%}
            2835 OCEAN AVE BROOKLYN NY 11235-3140 USA
          {%- elif is_state("input_select.destination", "marie")  -%}
            267 LINCOLN PL BROOKLYN NY 11238-5707 USA
          {%- else -%}
            Unknown
          {%- endif %}


# AC filter days since replaced
      - name: "AC Filter Days Since Replaced"
        unique_id: ac_filter_days_since_replacement
        state: "{{ ((as_timestamp(now()) - state_attr('input_datetime.ac_filter_last_replaced','timestamp')) | int / 86400)  | round(0) -1 }}"
        icon: mdi:clock-end
        unit_of_measurement: "Days"

# AC filter days remaining to change the filter
      - unique_id: ac_filter_days_remaining
        name: AC Filter Days remaining
        icon: mdi:clock-end
        state: "{{  states('input_number.ac_filter_threshold') | int - (now() - states('input_datetime.ac_filter_last_replaced') | as_datetime | as_local ).days }}"
        unit_of_measurement: "Days"    
     

# Internet connectivity
      - platform: ping
        host: 8.8.8.8
        unique_id: google_ping
        name: 'Internet Connectivity Google'
        count: 10

      - platform: ping
        host: 1.1.1.1
        unique_id: cloudfare_ping
        name: 'Internet Connectivity Cloudflare'
        count: 10 
        
      - unique_id: distance_from_home_marie
        name: Distance from Home Marie
        state: >
          {{ distance('person.marie','zone.home') | round(1) }}    
        
        
      - unique_id: distance_from_home_joe
        name: Distance from Home Joe
        state: >
          {{ distance('person.joe','zone.home') | round(1) }}  
          
          
          
      - unique_id: time_arrived_home_marie
        name: Time Arrived Home Marie
        icon: "mdi-home-clock"
        state: >
           {% set last_changed = states.person.marie.last_changed | as_local %}
           {% if last_changed < today_at() - timedelta(days=1) %}
              {{ last_changed.strftime('%A at %-I:%M %p') }}
           {% elif last_changed < today_at() %}
              {{ last_changed.strftime('yesterday %-I:%M %p') }}
           {% else %}
              {{ last_changed.strftime('at %-I:%M %p') }}
           {% endif %}
           
      - unique_id: time_arrived_home_joe
        name: Time Arrived Home Joe
        icon: "mdi-home-clock"
        state: >
          {% set last_changed = states.person.joe.last_changed | as_local %}
          {% if last_changed < today_at() - timedelta(days=1) %}
            {{ last_changed.strftime('%A at %-I:%M %p') }}
          {% elif last_changed < today_at() %}
            {{ last_changed.strftime('yesterday %-I:%M %p') }}
          {% else %}
            {{ last_changed.strftime('at %-I:%M %p') }}
          {% endif %}
 
      - unique_id: time_left_home_marie
        name: Time Left Home Marie
        icon: "mdi-home-clock"
        state: >
          {% set last_changed = states.person.marie.last_changed | as_local %}
          {% if last_changed < today_at() - timedelta(days=1) %}
            {{ last_changed.strftime('%-I:%M %p on %A') }}
          {% elif last_changed < today_at() %}
            {{ last_changed.strftime('%-I:%M %p yesterday') }}
          {% else %}
            {{ last_changed.strftime('%-I:%M %p') }}
          {% endif %} 
 
      - unique_id: time_left_home_joe
        name: Time Left Home Joe
        icon: "mdi-home-clock"
        state: >
          {% set last_changed = states.person.joe.last_changed | as_local %}
          {% if last_changed < today_at() - timedelta(days=1) %}
            {{ last_changed.strftime('%-I:%M %p on %A') }}
          {% elif last_changed < today_at() %}
            {{ last_changed.strftime('%-I:%M %p yesterday') }}
          {% else %}
            {{ last_changed.strftime('%-I:%M %p') }}
          {% endif %}
 
 
      - unique_id: status_joe
        name: Status Joe
        picture: /local/joe.png
        state: >
          {% if is_state('input_select.joe', 'Just Left') 
            or is_state('input_select.joe', 'Just Arrived')
            or is_state('input_select.joe', 'Home') %}
            {{ states('input_select.joe') }}
          {% elif is_state('person.joe','Away') or is_state('person.joe','not_home') %}
            {{ state_attr('sensor.joe_geocoded_location', 'Locality') }}
          {% else %}
            {{ states('person.joe') }}
          {% endif %}  


      - unique_id: status_marie
        name: Status marie
        picture: /local/marie.png
        state: >
          {% if is_state('input_select.marie', 'Just Left') 
            or is_state('input_select.marie', 'Just Arrived')
            or is_state('input_select.marie', 'Home') %}
            {{ states('input_select.marie') }}
          {% elif is_state('person.marie','Away') or is_state('person.marie','not_home') %}
            {{ state_attr('sensor.marie_geocoded_location', 'Locality') }}
          {% else %}
            {{ states('person.marie') }}
          {% endif %}  




  - trigger:
      - platform: state
        entity_id: person.marie
        to: 'home'   
        
      - platform: state
        entity_id: person.joe
        to: 'home'
        
      - platform: state
        entity_id: person.marie
        from: 'home'
        
      - platform: state
        entity_id: person.joe
        from: 'home'  


Thank you in advance.

templates.yaml is only for entities created under the template integration. Entity configurations that use platforms need to be set up under the sensor or binary sensor integration keys. This can be done in configuration.yaml or in other files as long as they are properly included (See Splitting the Configuration).

TLDR: If the configuration includes platform:, it doesn’t belong in templates.yaml