Convert value of an entity to a string

Hi all,
Sorry for this very very very beginer question, I want to create a card that instead of returning the value of an entity, it would return a texts vased on the value .

Today I have :slight_smile: type: entities
entities:

  • entity: person.user1
  • entity: sensor.user1_iphone_geocoded_location
    name: Geocoded Location
  • entity: sensor.user1_iphone_last_update_trigger
    secondary_info: last-updated
    name: Last Update Trigger
  • entity: sensor.user1_iphone_battery_level
    name: Battery Level
  • entity: sensor.user1_iphone_bssid
    name: Wireless AP

What I would like is to have intead of

  • entity: sensor.user1_iphone_bssid
    name: Wireless AP

something like

  • entity: {{AP}}
    name: Wireless AP
    variables:
    AP:
    {%- if {{ sensor.user1_iphone_bssid }} == “11:22:33:44:55:11” -%}
    “AP Cave”
    {%- elif {{ sensor.user1_iphone_bssid }} == “11:22:33:44:55:66” -%}
    “AP 1º Piso”
    {%- elif {{ sensor.user1_iphone_bssid }} == “11:22:33:44:55:77” -%}
    “AP R/C”
    {%- elif {{ sensor.user1_iphone_bssid }} == “11:22:33:44:55:88” -%}
    “AP 2º Piso”
    {%- elif {{ sensor.user1_iphone_bssid }} == “11:22:33:44:55:99” -%}
    “AP Cobertura”
    {% endif %}

Is this possible ?

Thank you in advance,
Paulo

You can create a template sensor.
Also have a look at the templating documentation.

Use Open your Home Assistant instance and show your template developer tools. for debugging your templates.

The snippet below should get you started.

template:
  - sensor:
      - name: "Wireless AP"
        state: >
          {% if states('sensor.user1_iphone_bssid') == "11:22:33:44:55:11" %}
          AP Cave
          {% elif states('sensor.user1_iphone_bssid') == "11:22:33:44:55:66" %}
          AP 1º Piso
          {% endif %}

thank you very much