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.

danke für eure hilfe
mfg
markus