Check for entity name == entity content

for example how can i check
sensor.ecs_cell_12_v (my Sensor Name) == sensor.ecs_volt_max (sensor.ecs_cell_12_v out of the max group)

Template Editor:

{{ states('sensor.ecs_cell_12_v') }}
{{ states.sensor.ecs_volt_max.attributes.max_entity_id }}
{{ states.sensor.ecs_cell_12_v }}

3.252
sensor.ecs_cell_12_v
<template TemplateState(<state sensor.ecs_cell_12_v=3.252; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=ecs_cell_12_v @ 2024-01-27T20:48:49.763365+01:00>)>

This template listens for the following state changed events:

Entity: sensor.ecs_cell_12_v
Entity: sensor.ecs_volt_max

{% if state_attr('sensor.ecs_volt_max','max_entity_id') == "sensor.ecs_cell_12_v" %}
  my code here
{% else %}
  other code
{% endif %}

thank you
to easy - i have to learn some basics :wink:

1 Like