Problems with color on state change

Hi,
i’m pretty new in Hass.io.
I tried to follow this instructions to change the icon and font color on state-change: click.

It works to change the icon on state, to create to choose the theme but it doesn’t work to change the theme when the battery is low.

Did i something wrong when i was installing custom_ui?

Regards,
justcasper

This is my configuration.yaml:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 51.282
  longitude: 7.0382
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Berlin
  # Customization file
  customize: !include customize.yaml

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Show the introduction message on startup.
introduction:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Discover some devices automatically
discovery:

# Sensors
sensor: !include sensor.yaml
      
      
# Text to speech
tts:
  - platform: google

#custom ui
customizer:
  custom_ui: local

frontend:
  themes:
    alert_yellow:
      primary-text-color: '#FFC000'
      paper-item-icon-color: '#FFC000'
    alert_red:
      primary-text-color: '#FF0000'
      paper-item-icon-color: '#FF0000'

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

This is my customize.yaml:

  sensor.monstera_battery_level:
    custom_ui_state_card: state-card-custom-ui
    friendly_name: "Door Sensor Battery Level"
    templates:
      theme: >
        if (state < 20) {
          return 'alert_red';
        } else if (state < 40) {
          return 'alert_yellow';
        }

And this is my sensor.yaml

  - platform: template
    sensors:
      solar_angle:
        friendly_name: "Sun angle"
        unit_of_measurement: 'degrees'
        value_template: "{{ state_attr('sun.sun', 'elevation') }}"

      sunrise:
        value_template: "{{ state_attr('sun.sun', 'next_rising') }}"  # Weather prediction
  - platform: yr
  #Mi Flora
  - platform: miflora
    mac: 'xxx'
    name: monstera
    friendly_name: Monstera Deiliciosa 
    force_update: false
    median: 3
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

  - platform: template
    sensors:
      monstera_battery_level:
        unit_of_measurement: '%'
        value_template: '{{ 1|int }}'
        icon_template: >
          {% set battery_level = states.sensor.monstera_battery_level.state|default(0)|int %}
          {% set battery_round = (battery_level / 10) |int * 10 %}
          {% if battery_round >= 100 %}
            mdi:battery
          {% elif battery_round > 0 %}
            mdi:battery-{{ battery_round }}
          {% else %}
            mdi:battery-alert
          {% endif %}