Tautulli REST End Point and custom-button-card

How do I resolve these errors in my logs ?

Logger: homeassistant.helpers.template
Source: helpers/template.py:2613
First occurred: 11:03:38 (222860 occurrences)
Last logged: 11:31:42

Template variable error: list object has no element 9 when rendering ‘{% if state != ‘off’ %} {{ state_attr(‘sensor.tautulli_activity’,‘sessions’)[9].relayed }} {% endif %}’
Template variable error: list object has no element 9 when rendering ‘{% if state != ‘off’ %} {{ state_attr(‘sensor.tautulli_activity’,‘sessions’)[9].bandwidth }} {% endif %}’
Template variable error: list object has no element 9 when rendering ‘{% if state != ‘off’ %} {{ state_attr(‘sensor.tautulli_activity’,‘sessions’)[9].video_resolution }} {% endif %}’
Template variable error: list object has no element 9 when rendering ‘{% if state != ‘off’ %} {{ state_attr(‘sensor.tautulli_activity’,‘sessions’)[9].stream_video_resolution }} {% endif %}’
Template variable error: list object has no element 9 when rendering ‘{% if state != ‘off’ %} {{ state_attr(‘sensor.tautulli_activity’,‘sessions’)[9].transcode_decision }} {% endif %}’

Hi there. I am completely new to HA and would love to get this going … but I literally have no idea where to start. Is there any guidance you can give me? Thanks.

You need to copy and paste the code for as many streams as you need. I did mine up to 10. But the code samples above only do two.

Is there anyone who run me through how to do this step-by-step? I am new to HA and trying my best but I am completely lost. Any help would be appreciated!

Cant figure out what I am doing wrong. IP + API Key URL pulls up JSON.

Rest sensor works as its showing in developer tools. The card also shows username and currently playing media + progress bar. However, everything else is undefined.

The main issue is the image. I can’t get that to load. I checked the IP. It is an internal IP.

Any help would be appreciated

Hi Guys,
I’m lost…
I installed Tautulli on my plex server, it is running normally and integrated into HA, but every time I add the card, I receive this error… what should I do?

Im recieving errors in my system log and not sure what is causing the issues. Im new to working in home assistant and not sure how to fix this



sensor:
  - platform: rest
    unique_id: tautulli_activity
    name: Tautulli Activity
    icon: mdi:plex
    scan_interval: 5
    force_update: true
    resource: https://mydomain.org/tautulli/api/v2?apikey=myapikey&cmd=get_activity
    method: POST
    headers:
      Content-Type: application/json
    value_template: "{{ value_json.response.result }}"
    json_attributes_path: "$.response.data"
    json_attributes:
      - stream_count
      - sessions
      - stream_count_direct_play
      - stream_count_direct_stream
      - stream_count_transcode
      - total_bandwidth
      - lan_bandwidth
      - wan_bandwidth
template:
  - sensor:
      - unique_id: plex_session_1
        name: Plex Session 1 (Tautulli)
        icon: mdi:plex
        state: >
          {% if (state_attr('sensor.tautulli_activity','sessions')|length >= 1)%}{{ state_attr('sensor.tautulli_activity','sessions')[0].state }}{%else%}off{%endif%}
        attributes:
          user: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].user }}{%endif%}
          progress_percent: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].progress_percent }}{%endif%}
          media_type: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_type }}{%endif%}
          full_title: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].full_title }}{%endif%}
          grandparent_thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].grandparent_thumb }}{%endif%}
          thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].thumb }}{%endif%}
          parent_media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].parent_media_index }}{%endif%}
          media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_index }}{%endif%}
          year: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].year }}{%endif%}
          product: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].product }}{%endif%}
          player: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].player }}{%endif%}
          device: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].device }}{%endif%}
          platform: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].platform }}{%endif%}
          location: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].location }}{%endif%}
          ip_address: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address }}{%endif%}
          ip_address_public: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address_public }}{%endif%}
          local: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].local }}{%endif%}
          relayed: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{%endif%}
          bandwidth: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{%endif%}
          video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{%endif%}
          stream_video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{%endif%}
          transcode_decision: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{%endif%}
  - sensor:
      - unique_id: plex_session_2

I still am getting errors nonstop and cat figure out how to correct it

Been working on this for hours and I cant figure it out. Anytime i put anything in the template area i get errors .

here is my comfiguration.yaml

Here are the errors i am getting

#1
Logger: homeassistant.helpers.template
Source: helpers/template.py:2629
First occurred: 2:34:18 AM (3 occurrences)
Last logged: 2:34:18 AM

Template variable error: None has no element 0 when rendering ‘{% if this.state !=‘off’%}{{state_attr(‘sensor.tautulli_activity’,‘sessions’)[0].user}}{%endif%}’


#2
Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:197
integration: Template (documentation, issues)
First occurred: 2:34:18 AM (2 occurrences)
Last logged: 2:34:18 AM

TemplateError(‘TypeError: object of type ‘NoneType’ has no len()’) while processing template ‘Template<template=({% if (state_attr(‘sensor.tautulli_activity’,‘sessions’)|length >= 1)%}{{state_attr(‘sensor.tautulli_activity’,‘sessions’)[0].state}}{%else%}off{%endif %}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.plex_session_1_tautulli’
TemplateError(‘UndefinedError: None has no element 0’) while processing template ‘Template<template=({% if this.state !=‘off’%}{{state_attr(‘sensor.tautulli_activity’,‘sessions’)[0].user}}{%endif%}) renders=4>’ for attribute ‘user’ in entity ‘sensor.plex_session_1_tautulli’

#3
Logger: homeassistant.helpers.event
Source: helpers/template.py:605
First occurred: 2:34:18 AM (2 occurrences)
Last logged: 2:34:18 AM

Error while processing template: Template<template=({% if (state_attr(‘sensor.tautulli_activity’,‘sessions’)|length >= 1)%}{{state_attr(‘sensor.tautulli_activity’,‘sessions’)[0].state}}{%else%}off{%endif %}) renders=2>
Error while processing template: Template<template=({% if this.state !=‘off’%}{{state_attr(‘sensor.tautulli_activity’,‘sessions’)[0].user}}{%endif%}) renders=2>
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 603, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 2616, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/jinja2/environment.py”, line 1304, in render
self.environment.handle_exception()
File “/usr/local/lib/python3.12/site-packages/jinja2/environment.py”, line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File “”, line 1, in top-level template code
TypeError: object of type ‘NoneType’ has no len()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 715, in async_render_to_info
render_info._result = self.async_render( # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 605, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: object of type ‘NoneType’ has no len()


The more I put in templates the more errors i get. What am I doing wrong? since i cant get passed this i cant even get to making a button.

Ok worked all night and here is where I stand can anyone help

configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: rest
    unique_id: tautulli_activity
    name: Tautulli Activity
    icon: mdi:plex
    scan_interval: 5
    force_update: true
    resource: http://192.168.1.45:6565/api/v2?apikey=XXXXXXXXXXXXXX&cmd=get_activity
    method: POST
    headers:
      Content-Type: application/json
    value_template: "{{ value_json.response.result }}"
    json_attributes_path: "$.response.data"
    json_attributes:
      - stream_count
      - sessions
      - stream_count_direct_play
      - stream_count_direct_stream
      - stream_count_transcode
      - total_bandwidth
      - lan_bandwidth
      - wan_bandwidth

template:
  - sensor:
      - unique_id: plex_session_1
        name: Plex Session 1 (Tautulli)
        icon: mdi:plex
        state: >
          {% if (state_attr('sensor.tautulli_activity','sessions')|length >= 1)%}{{ state_attr('sensor.tautulli_activity','sessions')[0].state }}{%else%}off{%endif%}
        attributes:
          user: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].user }}{%endif%}
          progress_percent: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].progress_percent }}{%endif%}
          media_type: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_type }}{%endif%}
          full_title: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].full_title }}{%endif%}
          grandparent_thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].grandparent_thumb }}{%endif%}
          thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].thumb }}{%endif%}
          parent_media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].parent_media_index }}{%endif%}
          media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_index }}{%endif%}
          year: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].year }}{%endif%}
          product: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].product }}{%endif%}
          player: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].player }}{%endif%}
          device: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].device }}{%endif%}
          platform: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].platform }}{%endif%}
          location: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].location }}{%endif%}
          ip_address: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address }}{%endif%}
          ip_address_public: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address_public }}{%endif%}
          local: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].local }}{%endif%}
          relayed: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{%endif%}
          bandwidth: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{%endif%}
          video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{%endif%}
          stream_video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{%endif%}
          transcode_decision: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{%endif%}
  #- sensor:
    #  - unique_id: plex_session_2

And here are the errors I am now getting

Logger: homeassistant.helpers.template
Source: helpers/template.py:2629
First occurred: 11:11:08 AM (66 occurrences)
Last logged: 11:11:08 AM

Template variable error: None has no element 0 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{%endif%}'
Template variable error: None has no element 0 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{%endif%}'
Template variable error: None has no element 0 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{%endif%}'
Template variable error: None has no element 0 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{%endif%}'
Template variable error: None has no element 0 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{%endif%}'
Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:197
integration: Template (documentation, issues)
First occurred: 11:11:08 AM (23 occurrences)
Last logged: 11:11:08 AM

TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{%endif%}) renders=4>' for attribute 'relayed' in entity 'sensor.plex_session_1_tautulli'
TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{%endif%}) renders=4>' for attribute 'bandwidth' in entity 'sensor.plex_session_1_tautulli'
TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{%endif%}) renders=4>' for attribute 'video_resolution' in entity 'sensor.plex_session_1_tautulli'
TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{%endif%}) renders=4>' for attribute 'stream_video_resolution' in entity 'sensor.plex_session_1_tautulli'
TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{%endif%}) renders=4>' for attribute 'transcode_decision' in entity 'sensor.plex_session_1_tautulli'
Logger: homeassistant.helpers.event
Source: helpers/template.py:605
First occurred: 11:11:08 AM (23 occurrences)
Last logged: 11:11:08 AM

Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{%endif%}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 603, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2616, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
TypeError: object of type 'NoneType' has no len()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 715, in async_render_to_info
    render_info._result = self.async_render(  # noqa: SLF001
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 605, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: object of type 'NoneType' has no len()

What am i missing?

Ok Errors are gone but the card does not populate


entity: this.entity_id
type: custom:button-card
variables:
  entity: this.entity_id
custom_fields:
  picture:
    card:
      type: picture
      image: |
        [[[
          if (states[variables.entity].attributes.grandparent_thumb != ''){
            return "http://XXXXXXXXX:6565/api/v2?apikey=XXXXXXXXXXXXXXXXXX&cmd=pms_image_proxy&img=" + states[variables.entity].attributes.grandparent_thumb + "&amp;width=300&amp;height=450&amp;fallback=poster&amp;refresh=true";
          } else {
            if (states[variables.entity].attributes.thumb != ''){
              return "http://XXXXXXXXXmm.com:6565/api/v2?apikey=XXXXXXXXXXXXXXXX&cmd=pms_image_proxy&img=" + states[variables.entity].attributes.thumb + "&amp;width=300&amp;height=450&amp;fallback=poster&amp;refresh=true"
            } else {
              return states['sensor.' + states[variables.entity].attributes.user + '_session_thumbnail'].state
            }
          }
        ]]]
      card_mod:
        style: |
          ha-card {
          box-shadow: 0;
          border-radius: 0;
          margin: 5px 0 0 -5px;
          }
          ha-card img {
          min-height: 100px;
          min-width: 100px;
          }
  bar:
    card:
      type: custom:bar-card
      entities:
        - entity: this.entity_id
      attribute: progress_percent
      unit_of_measurement: '%'
      positions:
        icon: 'off'
        indicator: 'off'
        name: inside
      height: 19px
      color: '#e49f29'
      name: |
        [[[
          return states[variables.entity].state
        ]]]
      card_mod:
        style: |
          ha-card {
          --ha-card-background: none;
          border: none;
          box-shadow: none;
          }
          ha-card #states {
            padding: 0;
          }
          bar-card-currentbar, bar-card-backgroundbar {
            border-radius: 5px;
            left: 0;
          }
          bar-card-name {
            margin-left: 3%;
            text-shadow: 1px 1px 1px #0003;
          }
          bar-card-value {
            margin-right: 3%;
            text-shadow: 1px 1px 1px #0003;
          }
  user: |
    [[[
      return "<b>" + states[variables.entity].attributes.user + "</b>"
    ]]]
  title: |
    [[[
      if (states[variables.entity].state == 'playing') {
        return "<ha-icon icon='mdi:play' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> " + states[variables.entity].attributes.full_title;
      } else {
        if (states[variables.entity].state == 'paused') {
          return "<ha-icon icon='mdi:pause' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> " + states[variables.entity].attributes.full_title;
        } else {
          return states[variables.entity].attributes.full_title;
        }
      }

    ]]]
  stream_label: <b>Stream</b>
  stream: |
    [[[
      return states[variables.entity].attributes.video_resolution + " > " + states[variables.entity].attributes.transcode_decision + " > " +states[variables.entity].attributes.stream_video_resolution + ""
    ]]]
  product_label: <b>Product</b>
  product: |
    [[[
      return states[variables.entity].attributes.product
    ]]]
  player_label: <b>Player</b>
  player: |
    [[[
      return states[variables.entity].attributes.player
    ]]]
  location_label: <b>Location</b>
  location: |
    [[[
      return states[variables.entity].attributes.location + ": " + states[variables.entity].attributes.ip_address
    ]]]
  media_detail: |
    [[[
      if(states[variables.entity].attributes.media_type == 'movie') {
        return "<ha-icon icon='mdi:filmstrip' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> (" + states[variables.entity].attributes.year + ")";
      } else {
        return "<ha-icon icon='mdi:television-classic' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> S" + states[variables.entity].attributes.parent_media_index + "•E" + states[variables.entity].attributes.media_index;
      }
    ]]]
  bandwidth_label: <b>Bandwidth</b>
  bandwidth: |
    [[[
      var bytes = states[variables.entity].attributes.bandwidth * 1000;
      var sizes = ['Bytes', 'Kbps', 'Mbps', 'Gbps', 'Tbps'];
      if (bytes == 0) return 'n/a';
      var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)));
      if (i == 0) return bytes + ' ' + sizes[i];
      return (bytes / Math.pow(1000, i)).toFixed(1) + ' ' + sizes[i];
    ]]]
card_mod:
  style: |
    ha-card {
    box-shadow: 0;
    padding: 0;
    margin: 0;
    border: 0;
    }
    ha-card #container {
    margin: 5px 0 0 0;
    }
    #name {
    display:none;
    }
styles:
  card:
    - height: 100x
    - padding: 0
  custom_fields:
    bar:
      - text-transform: capitalize
      - font-size: 13px
    user:
      - text-align: end
      - font-size: 15px
    title:
      - text-align: start
      - font-size: 13px
    stream:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    product:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    player:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    location:
      - text-transform: uppercase
      - text-align: start
      - font-size: 13px
    media_detail:
      - text-transform: uppercase
      - text-align: start
      - font-size: 13px
    bandwidth:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    product_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    player_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    stream_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    location_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    bandwidth_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
  grid:
    - grid-template-areas: |
        "picture product_label product"
        "picture player_label player"
        "picture stream_label stream"
        "picture location_label location"
        "picture bandwidth_label bandwidth"
        "picture bar bar"
        "picture title title"
        "picture media_detail user"
    - grid-template-columns: 1fr 60px 3fr
    - grid-gap: 5px 10px

When you’re watching something on plex, head back into your HA and look at Developer Tools > States tab. Search at the top for “sensor.tautulli_activity” - do you see a “sessions:” key in the right most column? Should look something like this…
(also, this cut off at the bottom. didn’t want to post all the details…)

Yes i have this there

Do you see anything under the sensor.plex_session_1_tautulli entity when playing?

the picture i sent was what i see while playing a file

Yes, that is the main activity sensor. Then there should be sensors 1 through 10 that each have an individual “session”.

So if you’re the only one playing something on plex, sensor.plex_session_1_tautulli should have that information.

Then if another user starts playing something else on another device, sensor.plex_session_2_Tautulli should be populated with that information.

i understand, but like in your picture i do not have plex session 1 etc

here is my configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: rest
    unique_id: tautulli_activity
    name: Tautulli Activity
    icon: mdi:plex
    scan_interval: 5
    force_update: true
    resource: XXXXXXXXXXXXX/api/v2?apikey=XXXXXXXXXX&cmd=get_activity
    method: POST
    headers:
      Content-Type: application/json
    value_template: "{{ value_json.response.result }}"
    json_attributes_path: "$.response.data"
    json_attributes:
      - stream_count
      - sessions
      - stream_count_direct_play
      - stream_count_direct_stream
      - stream_count_transcode
      - total_bandwidth
      - lan_bandwidth
      - wan_bandwidth

template:
  - sensor:
      - unique_id: plex_session_1
        name: Plex Session 1 (Tautulli)
        icon: mdi:plex
        state: >
          {% if (state_attr('sensor.tautulli_activity','sessions')|length >= 1)%}{{ state_attr('sensor.tautulli_activity','sessions')[0].state }}{%else%}off{%endif%}
        attributes:
          user: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].user }}{% endif %}
          progress_percent: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].progress_percent }}{% endif %}
          media_type: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_type }}{% endif %}
          full_title: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].full_title }}{% endif %}
          grandparent_thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].grandparent_thumb }}{% endif %}
          thumb: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].thumb }}{% endif %}
          parent_media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].parent_media_index }}{% endif %}
          media_index: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].media_index }}{% endif %}
          year: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].year }}{% endif %}
          product: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].product }}{% endif %}
          player: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].player }}{% endif %}
          device: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].device }}{% endif %}
          platform: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].platform }}{% endif %}
          location: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].location }}{% endif %}
          ip_address: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address }}{% endif %}
          ip_address_public: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].ip_address_public }}{% endif %}
          local: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].local }}{% endif %}
          relayed: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].relayed }}{% endif %}
          bandwidth: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].bandwidth }}{% endif %}
          video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].video_resolution }}{% endif %}
          stream_video_resolution: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].stream_video_resolution }}{% endif %}
          transcode_decision: >
            {% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[0].transcode_decision }}{% endif %}
  #- sensor:
    #  - unique_id: plex_session_2

and my button configuration

entity: this.entity_id
type: custom:button-card
variables:
  entity: this.entity_id
custom_fields:
  picture:
    card:
      type: picture
      image: |
        [[[
          if (states[variables.entity].attributes.grandparent_thumb != ''){
            return "http://XXXXXXXXX:6565/api/v2?apikey=XXXXXXXXXXXXXXXXXX&cmd=pms_image_proxy&img=" + states[variables.entity].attributes.grandparent_thumb + "&amp;width=300&amp;height=450&amp;fallback=poster&amp;refresh=true";
          } else {
            if (states[variables.entity].attributes.thumb != ''){
              return "http://XXXXXXXXXmm.com:6565/api/v2?apikey=XXXXXXXXXXXXXXXX&cmd=pms_image_proxy&img=" + states[variables.entity].attributes.thumb + "&amp;width=300&amp;height=450&amp;fallback=poster&amp;refresh=true"
            } else {
              return states['sensor.' + states[variables.entity].attributes.user + '_session_thumbnail'].state
            }
          }
        ]]]
      card_mod:
        style: |
          ha-card {
          box-shadow: 0;
          border-radius: 0;
          margin: 5px 0 0 -5px;
          }
          ha-card img {
          min-height: 100px;
          min-width: 100px;
          }
  bar:
    card:
      type: custom:bar-card
      entities:
        - entity: this.entity_id
      attribute: progress_percent
      unit_of_measurement: '%'
      positions:
        icon: 'off'
        indicator: 'off'
        name: inside
      height: 19px
      color: '#e49f29'
      name: |
        [[[
          return states[variables.entity].state
        ]]]
      card_mod:
        style: |
          ha-card {
          --ha-card-background: none;
          border: none;
          box-shadow: none;
          }
          ha-card #states {
            padding: 0;
          }
          bar-card-currentbar, bar-card-backgroundbar {
            border-radius: 5px;
            left: 0;
          }
          bar-card-name {
            margin-left: 3%;
            text-shadow: 1px 1px 1px #0003;
          }
          bar-card-value {
            margin-right: 3%;
            text-shadow: 1px 1px 1px #0003;
          }
  user: |
    [[[
      return "<b>" + states[variables.entity].attributes.user + "</b>"
    ]]]
  title: |
    [[[
      if (states[variables.entity].state == 'playing') {
        return "<ha-icon icon='mdi:play' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> " + states[variables.entity].attributes.full_title;
      } else {
        if (states[variables.entity].state == 'paused') {
          return "<ha-icon icon='mdi:pause' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> " + states[variables.entity].attributes.full_title;
        } else {
          return states[variables.entity].attributes.full_title;
        }
      }

    ]]]
  stream_label: <b>Stream</b>
  stream: |
    [[[
      return states[variables.entity].attributes.video_resolution + " > " + states[variables.entity].attributes.transcode_decision + " > " +states[variables.entity].attributes.stream_video_resolution + ""
    ]]]
  product_label: <b>Product</b>
  product: |
    [[[
      return states[variables.entity].attributes.product
    ]]]
  player_label: <b>Player</b>
  player: |
    [[[
      return states[variables.entity].attributes.player
    ]]]
  location_label: <b>Location</b>
  location: |
    [[[
      return states[variables.entity].attributes.location + ": " + states[variables.entity].attributes.ip_address
    ]]]
  media_detail: |
    [[[
      if(states[variables.entity].attributes.media_type == 'movie') {
        return "<ha-icon icon='mdi:filmstrip' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> (" + states[variables.entity].attributes.year + ")";
      } else {
        return "<ha-icon icon='mdi:television-classic' style='width: 15px; height: 15px; position: relative; top: -2px;'></ha-icon> S" + states[variables.entity].attributes.parent_media_index + "•E" + states[variables.entity].attributes.media_index;
      }
    ]]]
  bandwidth_label: <b>Bandwidth</b>
  bandwidth: |
    [[[
      var bytes = states[variables.entity].attributes.bandwidth * 1000;
      var sizes = ['Bytes', 'Kbps', 'Mbps', 'Gbps', 'Tbps'];
      if (bytes == 0) return 'n/a';
      var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)));
      if (i == 0) return bytes + ' ' + sizes[i];
      return (bytes / Math.pow(1000, i)).toFixed(1) + ' ' + sizes[i];
    ]]]
card_mod:
  style: |
    ha-card {
    box-shadow: 0;
    padding: 0;
    margin: 0;
    border: 0;
    }
    ha-card #container {
    margin: 5px 0 0 0;
    }
    #name {
    display:none;
    }
styles:
  card:
    - height: 100x
    - padding: 0
  custom_fields:
    bar:
      - text-transform: capitalize
      - font-size: 13px
    user:
      - text-align: end
      - font-size: 15px
    title:
      - text-align: start
      - font-size: 13px
    stream:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    product:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    player:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    location:
      - text-transform: uppercase
      - text-align: start
      - font-size: 13px
    media_detail:
      - text-transform: uppercase
      - text-align: start
      - font-size: 13px
    bandwidth:
      - text-transform: capitalize
      - text-align: start
      - font-size: 13px
    product_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    player_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    stream_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    location_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
    bandwidth_label:
      - text-transform: uppercase
      - text-align: end
      - font-size: 10px
  grid:
    - grid-template-areas: |
        "picture product_label product"
        "picture player_label player"
        "picture stream_label stream"
        "picture location_label location"
        "picture bandwidth_label bandwidth"
        "picture bar bar"
        "picture title title"
        "picture media_detail user"
    - grid-template-columns: 1fr 60px 3fr
    - grid-gap: 5px 10px

That’s what you’re missing then. Go back to the original post and look for the section

The REST sensor is the first step. That pulls the data into home assistant. But it does this as an array of sessions.

Then you need to create 10 template sensors that take that main session sensor and split it up. So you’re missing all the template sensors.

Once that is created, things should start working.

i used the initial post to start this process. i guess i missed something. can i reach out to you if i get stuck

ok i added 5 copies of it and what i am noticing is that is does not rename the instances to (plex session 1) it just keeps everything as Tautulli activity, even though i have matched your config

One section of code is using the REST integration. This should give you one general “activity”. You need the next section of code that uses the “template”, and you have to repeat it 10 times. Each time you increment the number (such as [0]) in the array reference until you get to [9].

Can you post your config again please?