Template sensor, name oder friendly_name dynamisch vergeben lassen?

hi an alle,

kann man einen template sensor namen oder friendly_name dynamisch vergeben lassen?

z.b. so?

friendly_name: "{{ states('input_text.wlanthermo_channel_1_name') }}"


oder so
friendly_name: "{{ '#1 ' ~ state_attr('sensor.wlanthermo_channel_1_all', 'name') }}"

das wäre der ganze sensor:
> template:
  - sensor:
      - name: wlanthermo_channel_1_all
        unique_id: wlanthermo_channel_1_all
        unit_of_measurement: "°C"
        state_class: measurement
        device_class: temperature
        availability: >
          {{ not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) and state_attr('sensor.wlanthermo', 'channel')[0]['temp'] < 999 }}
        attributes:
          alarm: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {{ state_attr('sensor.wlanthermo', 'channel')[0]['alarm'] }}
            {% else %}
            0
            {% endif %}
          name: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {{ state_attr('sensor.wlanthermo', 'channel')[0]['name'] }}
            {% else %}
            0
            {% endif %}
          friendly_name: "{{ '#1 ' ~ state_attr('sensor.wlanthermo_channel_1_all', 'name') }}"
          color: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {{ state_attr('sensor.wlanthermo', 'channel')[0]['color'] }}
            {% else %}
            0
            {% endif %}
          max: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {{ state_attr('sensor.wlanthermo', 'channel')[0]['max'] }}
            {% else %}
            0
            {% endif %}
          min: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {{ state_attr('sensor.wlanthermo', 'channel')[0]['min'] }}
            {% else %}
            0
            {% endif %}
          inRange: >
            {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
            {% set temp = state_attr('sensor.wlanthermo', 'channel')[0]['temp'] %}
            {% if temp > state_attr('sensor.wlanthermo', 'channel')[0]['max'] %}
            1
            {% else %}
            {% if temp < state_attr('sensor.wlanthermo', 'channel')[0]['min'] %}
            -1
            {% else %}
            0
            {% endif %}
            {% endif %}
            {% else %}
            0
            {% endif %}
        state: >
          {% if not is_state('sensor.wlanthermo', 'unavailable') and (not is_state('sensor.wlanthermo', 'unknown')) %}
          {{ state_attr('sensor.wlanthermo', 'channel')[0]['temp'] }}
          {% else %}
          0
          {% endif %}
        icon: >
          {% set inRange = state_attr('sensor.wlanthermo_channel_1_all', 'inRange') | int(0) %}
          {% if inRange > 0 %}
          mdi:fire-alert
          {% else %}
          {% if inRange < 0 %}
          mdi:snowflake-alert
          {% else %}
          mdi:thermometer
          {% endif %}
          {% endif %}

momentan wird er nur so erstellt:

state_class: measurement
friendly_name: wlanthermo_channel_1_all
unit_of_measurement: °C
device_class: temperature
icon: mdi:snowflake-alert
alarm: 3
name: Garraum Gr
color: #FFFF00
max: 120
min: 100
inRange: -1

es geht mir darum das der name “Garraum Gr” auch ganz oben erscheint anstatt “wlanthermo_channel_1_all” und auch sich mit ändert wenn ich den name ändere.
Bildschirmfoto 2023-04-19 um 19.35.43

danke für eure hilfe
mfg
markus

Ich hätte ja gesagt es geht mit einem python script denn ein friendly_name ist ja letztendlich ein Attribute.
Es gibt da mehrere meines Wissens.
Ein set_state.py und noch ein ähnliches in HACS.
Geht dann irgendwie so (oder so ähnlich) nutze es gerade nicht.

Schau mal hier: How to manually set state/value of sensor? - #37 by anthonygillet - Configuration - Home Assistant Community
Du kannst damit zumindest mal den state und weitere attribute setzen, ich würde vermuten das somit auch der friendly_name möglich ist. Probiert hab ich’s allerdings noch nicht.

danke für den hinweis, werd es mal testen.