Colouring sensors

I have defined in “customize_glob.yaml” the following:

sensor.PIR_*:
  templates:
    icon_color: >
      if (state == 'Normal') return 'green';
      if (state == 'Breach') return 'yellow';
      if (state == 'Alarm') return 'red';
      return 'grey';

The sensor is working fine, however the colour is not changing.

I have set at my card:

state_color: true

Logical, as in the same card I have other sensors with colouring and this is working fine. The only distinction is that this a regular sensor and others are binary_sensor (the last is working fine with the colouring).

In my configuration.yaml I defined:

homeassistant:
  customize_glob: !include customize_glob.yaml
  customize: !include customize.yaml

I have other colouring at “customize_glob.yaml” and this is working correct.

What could be wrong?

If I move the code to “customize.yaml” and don’t use a wildcard it’s working, like:

sensor.PIR_Eetkamer:
  templates:
    icon_color: >
      if (state == 'Normal') return 'primary-color';
      if (state == 'Breach') return 'orange';
      if (state == 'Alarm') return 'red';
      return 'grey';

Could it be the wildcard? The other at global I have defined as sensor.area_*_status. Should the wildcard be in between and not at the end?

By the way, the primary-color is exactly the normal colour of the binary_sensor. How can I get the yellow/orange colour when a binary_sensor is true?