Why won't this icon_template show up

have this template binary_sensor:

  - platform: template
    sensors:
      family_home:
        friendly_name: 'Family home'
        value_template: >
          {{ is_state('group.family', 'home') }}
        icon_template: >
          {% if is_state('sensor.family_home','0') %} mdi:account-off
          {% elif is_state('sensor.family_home','1') %} mdi:account
          {% elif is_state('sensor.family_home','2') %} mdi:account-multiple
          {% elif is_state('sensor.family_home','3') %} mdi:account-multiple-check
          {% else %} mdi:account-group
          {% endif %}

All is well, except the icon doesn’t show at all. I know the template is fine, and all entities exist etc, because in the dev-template this is the result:

we’re 4 at home now, so for testing purposes I changed the first elif to be set a 4:

should work…
still a no show in the frontend:

43

have a further customization set on the sensor, hence the ‘Occupied’ and icon_color (now invisible…):

binary_sensor.family_home:
  show_last_changed: true
  templates:
    icon_color: >
      if (state === 'on') return 'rgb(251, 210, 41)';
      return 'rgb(54, 95, 140)';
    _stateDisplay: >
      if (state === 'on') return 'Occupied';
      return 'Home alone';

some other sensors and groups:

05

tab/view:
09

so, if anyone had a eagle’s eye, id be glad to hear from you…
thx

rebuilt it in the customize section: bingo:

09

binary_sensor.family_home:
  show_last_changed: true
  templates:
    icon: >
      if (entities['sensor.family_home'].state === '0') return 'mdi:account-off';
      if (entities['sensor.family_home'].state === '1') return 'mdi:account';
      if (entities['sensor.family_home'].state === '2') return 'mdi:account-multiple';
      if (entities['sensor.family_home'].state === '3') return 'mdi:account-multiple-check';
      return 'mdi:account-group';
    icon_color: >
      if (state === 'on') return 'rgb(251, 210, 41)';
      return 'rgb(54, 95, 140)';
    _stateDisplay: >
      if (state === 'on') return 'Occupied';
      return 'Home alone';

which is rather counter-intuitive. I always use the icon_template section in template sensors, and customize regular sensors in the custom-ui style.

Why in this case things are turned around is beyond me for now… still, Ive got it working.