OK - Updated template sensor logic can be found here.
@Tmatz - let me know if this solves your errors in your log?
OK - Updated template sensor logic can be found here.
@Tmatz - let me know if this solves your errors in your log?
I will test it out and let you know! Thank you for the help itās an amazing card!
that link worked and I changed to HTTP and that seem to work.
Anyway to show our appreciation?
Nope, all good! But thanks for the thanks!
Sorry it took me so long to get back to you all. Dad duty takes priority, so I have to work on these things when I have time.
So used the template sensor logic you provided but still recieving errors. But its not affecting the card. Its strange it the log it only shows the last sensor in the template so now its showing sensor 10 not the ones before it.
I made an edit to the template and Im not seeing the errors anymore. Not sure if it would help any one else.
template:
- sensor:
- unique_id: plex_session_1
name: Plex Session 1 (Tautulli)
icon: mdi:plex
state: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 %}
{{ sessions[0].state }}
{% else %}
off
{% endif %}
attributes:
user: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].user }}
{% endif %}
progress_percent: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].progress_percent }}
{% endif %}
media_type: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].media_type }}
{% endif %}
full_title: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].full_title }}
{% endif %}
grandparent_thumb: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].grandparent_thumb }}
{% endif %}
thumb: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].thumb }}
{% endif %}
parent_media_index: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].parent_media_index }}
{% endif %}
media_index: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].media_index }}
{% endif %}
year: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].year }}
{% endif %}
product: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].product }}
{% endif %}
player: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].player }}
{% endif %}
device: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].device }}
{% endif %}
platform: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].platform }}
{% endif %}
location: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].location }}
{% endif %}
ip_address: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].ip_address }}
{% endif %}
ip_address_public: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].ip_address_public }}
{% endif %}
local: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].local }}
{% endif %}
relayed: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].relayed }}
{% endif %}
bandwidth: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].bandwidth }}
{% endif %}
video_resolution: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].video_resolution }}
{% endif %}
stream_video_resolution: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].stream_video_resolution }}
{% endif %}
transcode_decision: >
{% set sessions = state_attr('sensor.tautulli_activity', 'sessions') %}
{% if sessions is not none and sessions | length >= 1 and this.state != 'off' %}
{{ sessions[0].transcode_decision }}
{% endif %}
Setup wasnāt bad at all. Does anyone have any idea on how to get this working with Live TV (Plex) and xTeve? It errors when it detects a Live TV session is going onā¦ See below for the error, which following the error shows the codeā¦
ButtonCardJSTemplateError: TypeError: undefined is not an object (evaluating āstates[āsensor.ā + states[variables.entity].attributes.user + ā_session_thumbnailā].stateā) in āif (states[variables.entity].attributes.grandparent_thumb != āā){ return "https://tautulli.rmeā¦ā
My guess is Tautulli isnāt able to identify the Live TV stream, so itās throwing an undefined
error. Hereās a screenshot of whatās playing on Live TV. Not sure if itāll help pinpoint something that could be added.
Tautulli is able to identify the stream, but itās likely pulling something that has to be added here. I have no coding experience, so itās hard to say what it may beā¦ Let me know if and how I can help.
Edit: So it canāt find a thumbnail for the user, but there isnāt much of a thumbnail, just the live tv graphicā¦
Disregard the error. It was xTeve not playing well. Threadfin plays perfectly fine!
I cant seem to get this to work. I added all the codes in their locations and changed the IP and API keys. When i put it in a card nothing shows up. no errors or anything. The logs dont push any errors either.
Everything thatās in your plex_sessions.yaml, I actually put in my configuration.yaml below the sensor bit of coding.
I moved that code directly into the configuration.yaml and it worked. Thank you very much. Now I can troubleshoot why the poster isnt showing. But at least everything else is.
Thank you again.
Yes, what @ronmramsayii is saying is correct. You could place it in a file like this, if the file is found under a āpackagesā directory, and you reference it in your configuration.yaml file. But I donāt think placing it at the root like this will pick it up. Iād try copying the code into your configuration.yaml file first to confirm that is the issue.
I noticed some updates, when I add everything, I get 10 cards, same account/video/series in all 10. Donāt know what Iām doing wrongā¦ Any guidance would ve appreciated
My guess would be that either all of your tautulli rest sensors are only looking at the first stream.
Have you tried copy/pasting in the rest sensors from this gist? Iāve updated the original post with this link because it seemed to be the common issue that tripped some people up.
Yes i have copied the new REST and Auto-Entities, if I have my old Auto-Entities it shows only one but the new one auto extend it.
When you play something, can you search for
*plex*session*
under Developer Tools > State?
Do you see only the first session populated?
When you say ānewā vs āoldā auto entities, what do you mean by that? As in the code in the first post? Or was there a new auto entities release or something?
No I mean with the first edition that you did, sorry for not being clearer.
I have used this button card before, but now I noticed that you have added some text to the button card
Old:
entity: this.entity_id
type: custom:button-card
variables:
entity: this.entity_id
custom_fields:
bar:
card:
type: custom:bar-card
entities:
- entity: this.entity_id
attribute: progress_percent
unit_of_measurement: "%"
positions:
icon: "off"
indicator: "off"
name: inside
New:
type: custom:auto-entities
filter:
exclude:
- state: unknown
- state: unavailable
- state: "off"
include:
- entity_id: "*plex*session*"
options:
entity: this.entity_id
type: custom:button-card
variables:
entity: this.entity_id
custom_fields:
bar:
card:
type: custom:bar-card
entities:
- entity: this.entity_id
attribute: progress_percent
unit_of_measurement: "%"
positions:
icon: "off"
indicator: "off"
name: inside
And the old one worlds as it should, but with the newer version that you did, it should state āallā active streams automatically? I think before I had to add a new card deoesnign on how many streams I wanted to be able to see? 1 cars for one stream and 2 cars for two streams etcā¦ or am I misstanken?
Anywho, the old version of the button card works for atleast one stream, but the newer shows all 10 but for just one stream.