Well sorry for sounding stupid but how to I add REST? I thought it was jus to add the - platform: rest… And it should be active?
I have added the platform: rest, and template in to configuration.yaml, also added a Lovelace windows (that don’t show anything ATM).
I tested my tautulli url and I get a reply back so that’s working at least.
Here is the error when I restart HA.
Don’t mind the warnings, they are for Aarlo plugin.
Logger: homeassistant.helpers.template
Source: helpers/template.py:2558
First occurred: 19:17:17 (132 occurrences)
Last logged: 19:17:17
Template variable error: None has no element 1 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].relayed }}{%endif%}'
Template variable error: None has no element 1 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].bandwidth }}{%endif%}'
Template variable error: None has no element 1 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].video_resolution }}{%endif%}'
Template variable error: None has no element 1 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].stream_video_resolution }}{%endif%}'
Template variable error: None has no element 1 when rendering '{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].transcode_decision }}{%endif%}'
Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:201
integration: Template (documentation, issues)
First occurred: 19:17:17 (46 occurrences)
Last logged: 19:17:17
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].relayed }}{%endif%}) renders=4>' for attribute 'relayed' in entity 'sensor.plex_session_2_tautulli'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].bandwidth }}{%endif%}) renders=4>' for attribute 'bandwidth' in entity 'sensor.plex_session_2_tautulli'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].video_resolution }}{%endif%}) renders=4>' for attribute 'video_resolution' in entity 'sensor.plex_session_2_tautulli'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].stream_video_resolution }}{%endif%}) renders=4>' for attribute 'stream_video_resolution' in entity 'sensor.plex_session_2_tautulli'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].transcode_decision }}{%endif%}) renders=4>' for attribute 'transcode_decision' in entity 'sensor.plex_session_2_tautulli'
Logger: homeassistant.helpers.event
Source: helpers/template.py:588
First occurred: 19:17:17 (46 occurrences)
Last logged: 19:17:17
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].relayed }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].bandwidth }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].video_resolution }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].stream_video_resolution }}{%endif%}) renders=2>
Error while processing template: Template<template=({% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].transcode_decision }}{%endif%}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, 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 712, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: object of type 'NoneType' has no len()
Logger: homeassistant.config
Source: config.py:1324
First occurred: 19:17:07 (1 occurrences)
Last logged: 19:17:07
Invalid config for 'sensor' from integration 'rest' at configuration.yaml, line 77: template value should be a string for dictionary value 'headers->json_attributes', got ['stream_count', 'sessions', 'stream_count_direct_play', 'stream_count_direct_stream', 'stream_count_transcode', 'total_bandwidth', 'lan_bandwidth', 'wan_bandwidth'], please check the docs at https://www.home-assistant.io/integrations/rest
And my configuration.yaml file:
# 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
aarlo:
tfa_source: imap
tfa_type: email
tfa_host: imap.gmail.com
tfa_username: !secret gmail_username
tfa_password: !secret gmail_app_password
username: !secret arlo_username
password: !secret arlo_password
backend: sse
camera:
- platform: aarlo
binary_sensor:
- platform: aarlo
monitored_conditions:
- motion
- sound
- ding
- cry
- connectivity
sensor:
- platform: aarlo
monitored_conditions:
- total_cameras
- last_capture
- recent_activity
- captured_today
- battery_level
- signal_strength
- temperature
- humidity
- air_quality
- platform: rest
unique_id: tautulli_activity
name: Tautulli Activity
icon: mdi:plex
scan_interval: 5
force_update: true
resource: !secret tautulli_url_api
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
name: Plex Session 2 (Tautulli)
icon: mdi:plex
state: >
{% if (state_attr('sensor.tautulli_activity','sessions')|length >= 2)%}{{state_attr('sensor.tautulli_activity','sessions')[1].state }}{%else%}off{%endif %}
attributes:
user: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].user }}{%endif%}
progress_percent: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].progress_percent }}{%endif%}
media_type: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].media_type }}{%endif%}
full_title: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].full_title }}{%endif%}
grandparent_thumb: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].grandparent_thumb }}{%endif%}
thumb: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].thumb }}{%endif%}
parent_media_index: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].parent_media_index }}{%endif%}
media_index: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].media_index }}{%endif%}
year: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].year }}{%endif%}
product: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].product }}{%endif%}
player: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].player }}{%endif%}
device: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].device }}{%endif%}
platform: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].platform }}{%endif%}
location: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].location }}{%endif%}
ip_address: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].ip_address }}{%endif%}
ip_address_public: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].ip_address_public }}{%endif%}
local: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].local }}{%endif%}
relayed: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].relayed }}{%endif%}
bandwidth: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].bandwidth }}{%endif%}
video_resolution: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].video_resolution }}{%endif%}
stream_video_resolution: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].stream_video_resolution }}{%endif%}
transcode_decision: >
{% if this.state !='off'%}{{ state_attr('sensor.tautulli_activity','sessions')[1].transcode_decision }}{%endif%}
#- sensor:
# - unique_id: plex_session_3
# ...etc...