Card person tracker detection problem

I’m creating two person cards with Mushroom. I managed to change the person’s colors when they’re away from home and the flashing red ring around the badge, but I can’t get the badge to change from green to red or the text from “at home” to “away.” Can you help me, please?

PS: I created a binary_sensor.gabriella_presenza_reale. which includes the Wi-Fi, GPS, and person.gabriella trackers. It seems to work, but I don’t understand why the card isn’t updating.
this is the sensor:

# --- SUPER ENTITÀ PRESENZA ---
# Logica a maggioranza: almeno 2 tracker su 3 devono dire "home"
# Tracker usati:
#   1. person.X          → entità persona HA (aggrega più sorgenti)
#   2. device_tracker.iphone_X      → GPS iPhone
#   3. device_tracker.iphoneX       → router Fritz (più reattivo)

      - name: "Ugo Presenza Reale"
        unique_id: ugo_presenza_reale
        device_class: presence
        state: >
          {% set gps    = is_state('device_tracker.iphone_ugo', 'home') %}
          {% set fritz  = is_state('device_tracker.iphoneugo', 'home') %}
          {% set person = is_state('person.ugo', 'home') %}
          {% set count  = (gps | int) + (fritz | int * 2) + (person | int) %}
          {{ count >= 3 }}

      - name: "Gabriella Presenza Reale"
        unique_id: gabriella_presenza_reale
        device_class: presence
        state: >
          {% set gps    = is_state('device_tracker.iphone_gabri', 'home') %}
          {% set fritz  = is_state('device_tracker.iphonegabri', 'home') %}
          {% set person = is_state('person.gabriella', 'home') %}
          {% set count  = (gps | int) + (fritz | int * 2) + (person | int) %}
          {{ count >= 3 }}

and this is the code in the header of the two card persons:

type: grid
columns: 3
square: false
cards:

  # =====================================================
  # SEZIONE 1: PERSONE (33%)
  # Stile centralizzato — aggiungi persone senza duplicare
  # =====================================================
  - type: horizontal-stack
    cards:

      - type: custom:mushroom-person-card
        entity: person.ugo
        icon_type: entity-picture
        card_mod:
          style: &person_style |
            ha-card {
              height: 110px !important;
              border-radius: 15px !important;
              padding: 0px 8px !important;
              display: flex;
              align-items: center;
              overflow: visible !important;
            }
            mushroom-shape-avatar {
              --icon-size: 80px !important;
              border-radius: 18px;
              filter: {{ 'grayscale(0%)' if is_state('binary_sensor.' ~ config.entity.split('.')[1] ~ '_presenza_reale', 'on') else 'grayscale(100%)' }};
            }
            mushroom-badge-icon {
              --badge-size: 22px !important;
              --badge-scale: 1.5 !important;
              width: 22px !important;
              height: 22px !important;
              right: -2px !important;
              bottom: -2px !important;
              border-radius: 50% !important;
              box-sizing: border-box !important;
              --main-badge-color: {{ '#4caf50' if is_state('binary_sensor.' ~ config.entity.split('.')[1] ~ '_presenza_reale', 'on') else '#f44336' }};
              animation: ripple 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
            }
            @keyframes ripple {
              0%   { box-shadow: 0 0 0 0 {{ 'rgba(76,175,80,0.6)' if is_state('binary_sensor.' ~ config.entity.split('.')[1] ~ '_presenza_reale', 'on') else 'rgba(244,67,54,0.6)' }}; }
              70%  { box-shadow: 0 0 0 10px rgba(0,0,0,0); }
              100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
            }

      - type: custom:mushroom-person-card
        entity: person.gabriella
        icon_type: entity-picture
        card_mod:
          style: *person_style

secondary_info: state

add this for state

and you must ensure that the entity person. has the actual state ‘home’ or ‘not_home’ … because the badge changes according to the entity state, not the binary_sensor that you have set.

yes ok thanks John the change of badge status works, but also changing the person tracker from gps to wifi I lost tracking on the map, you can’t have everything

U can, create a device tracker instead of a binary