I understand how to make sensors that get the attribute of another entity. But is it possible to get the attribute name? If it changes…example the tautulli sensor creates an entity with an attribute of each a time user. So say 3 people are watching it would look like …
Attr attr value
John Batman
Joe. Why him
Jake. Deadpool
Thanks for helpin out. I have read those docs many times lol, its the when the attribute name is changing really throws me off i dont understand it quite well enough just yet. I appreciate your help though, that got me actually the value of the atrribute. I wanted to get the name of it, but I can at least just create the automations I wanted now with if statements. its going to be ugly, I didnt want to have to plug each user manually.
For some context…
I have a few remote plex users, when they are watching a movie the tautuli sensors grabs some info and brings it in ha.
Tautuille creates an entity “sensor.tautulli_total”. The state is always a number. the number of people watching.
the attributes when no one is watching:
and when someone is watching. when a second person joins it just adds another user right under Dustin
- platform: template
sensors:
watching_plex:
friendly_name: "Watching Plex"
value_template: >
{% if not states.sensor.plex.state == '0' %}
{%- for attr in states.sensor.plex.attributes %}
{%- if not attr=="friendly_name" and not attr=="unit_of_measurement"
and not attr=="custom_ui_state_card"
and not attr=="icon"
and not attr=="supported_features"
and not attr=="entity_picture" %}
{{attr}} is watching {{states.sensor.plex.attributes[attr]}}
{%- endif %}
{%- endfor %}
{% else %} Watching Plex: {{states.sensor.plex.state}}
{% endif %}