Sending Tautulli notifications to Signal Messenger Groups, using HA & MQTT

I have been working on finding a solution for sending Tautulli updates into a signal group and I finally figured out how to utilize Home Assistant to send information to my signal group chat. While I have used Discord and telegram in the past, my friends were reluctant to use them so this seems to be the best approach for my use case. I figured someone else may be interested so I would pass it along.

** I am sure there are much more elegant ways to accomplish this, so I am more than open to feedback about how to make it work better!

There are a couple prerequisites which I imagine you have in place if you are reading this thread.

First, I set up the Signal Rest API add on and the integration using the instructions on the integration page here: Signal Messenger - Home Assistant

Once I had that set up and working, I created the signal groups an ensured I was able to send messages using the relevant Notification Service Calls in Home Assistant. Below is what mine looks like in my config

- name: signal_XXXXXXX_alerts
  platform: signal_messenger
  url: "http://127.0.0.1:8080" # the URL where the Signal Messenger REST API is listening
  number: "+XXXXXXXXXXX" # the sender number
  recipients: # one or more recipients
    - "group.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX="

Then I had to go into Tautulli to setup 2 different MQTT notifications. The first includes the Title of the Recently added item and the second creates a notification utilizing the {poster_url}.

After I had these running, I checked that they were being received by the MQTT Broker and I was ready to setup the MQTT sensors in home assistant. Under the mqtt config I added the following 2 sensors

sensor:
  - name: RecentlyAddedPlex
    state_topic: tautulli/recentlyadded
    value_template: "{{ value_json.body }}"
    unique_id: XXXXXXXXXXXXXXXXXXXXXX
  - name: RecentlyAddedPlexImagae
    state_topic: tautulli/recentlyadded/image
    value_template: "{{ value_json.body }}"
    unique_id: XXXXXXXXXXXXXXXXXXXXXXX

Lastly, I setup an automation to send the notifications. The trigger is a message being published to the broker and the action is sending the data from each sensor in the Signal Notification

alias: Tautulli Recently Added Notification
description: ""
trigger:
  - platform: mqtt
    topic: tautulli/recentlyadded
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - service: notify.signal_XXXXXXX_alerts
    data:
      message: "{{ states('sensor.recentlyaddedplex') }}"
      data:
        urls:
          - "{{ states('sensor.recentlyaddedplex_2') }}"
mode: single

I added the 15 second delay as I wanted to make sure that the sensors would both be updated from Tautulli before the message was sent…so far this has been working great! I would love if I was able to make it a bit cleaner, but this was as far as I could go with my own skills.

Hope this helps someone else looking to go down the same path. My next steps are to add server up/down notifications, another automatio/sensor which will send teh newsletter out to the group once per week and create a private group for myself which sends other information I would like to see.

2 Likes

Thanks so much for this. I’ve been trying to do exactly the same thing.

I have it functioning with “RecentlyAddedPlex” sensor, but not the "
RecentlyAddedPlexImage" sensor.

Tautulli doesn’t send any data from my second MQTT notification with the {poster_url} text.

I’ve even tried including it with my the other MQTT notification e.g. “{title} ({year}) was recently added to Plex. {poster_url}” but all that is recieved in home assistant is "{title} ({year}) was recently added to Plex. " giving me the impression that tautulli isn’t sending the poster url.

Did you have a similar issue?

1 Like

Could you show me the tautulli side of the setup? I’ve tried setting up MQTT, but can’t seem to get it to work

Since there has been a typo (RecentlyAddedPlexImagae and sensor.recentlyaddedplex_2) and some of the people here might struggle with the setup, I created a step-by-step guide (based on your great work @jsdphilly):

Tautulli-side:



Make sure to set “Retain message” - otherwise your MQTT sensor in Home Assistant will switch to unavailalbe (e.g., after a reboot).

image


If you like the above as a starting point, please find this as text below.


I changed the sensor a bit, as the state is limited to 255 and it will change to “unknown” as soon as the MQTT message is longer. I would use {{ value_json.subject }} for the value_template in case you only want to use the title for some other purposes:

mqtt:
  sensor:
  - name: RecentlyAddedPlex
    state_topic: tautulli/recentlyadded
    value_template: {{ value_json.subject }}
    json_attributes_topic: tautulli/recentlyadded
    unique_id: aisndAOsnsdnfosApsms
  - name: RecentlyAddedPlexImage
    state_topic: tautulli/recentlyadded/image
    value_template: "{{ value_json.body }}"
    unique_id: kiAOsnsdnfksALosdfnifASdf

The syntax for the signal integration changed a bit, so it should be as follows - also, as “state” is not used anymore and the attribute doesn’t support html, you need to replace some html elements:

  alias: Tautulli Recently Added Notification
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - sensor.recentlyaddedplex
    to:
  conditions: []
  actions:
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - action: notify.signal_plex
    data:
      message: '{{ state_attr(''sensor.recentlyaddedplex'', ''body'') | replace(''<br>'',
        ''

        '') | replace(''<br />'', ''

        '') | replace(''1080'', ''1080p'') }}'
      data:
        urls:
        - '{{ states(''sensor.recentlyaddedpleximage'') }}'

You also need to make sure that the following setting in Home Assistant’s configuration.yaml is set (otherwise, Signal will not be able to fetch the image from the cloudinary server):

homeassistant:
  allowlist_external_urls: 
    -  "https://res.cloudinary.com"

You shouldn’t waste any time with the imgur setup - this will not work as the API will not provide a jpg anymore. Instead, it will forward you to a HTML-file which includes the jpg - therefore, this doesn’t work with Signal (as it expects a jpg) and the message will fail with an error. Cloudinary works perfectly fine.

If you’re already using Signal to notify you about things and you want to use another channel for the plex news, please note that the Signal integration does not allow multiple groups under “recipients”. You need to define a new notify in the configuration.yaml.

I hope I saved some of you some time with this!

Tautulli notification text (the stream_audio_channel_layout and _channels doesn’t work for me though):

<movie>Neuer Film: {title} ({year}) {video_resolution} {stream_audio_channel_layout} {stream_audio_channels} {stream_audio_codec} IMDB: {audience_rating}

{summary}

IMDB: {imdb_url}

Jetzt anschauen: {plex_url}</movie><show>Neue Serie: {show_name}

{summary}

{imdb_url}</show><season>Neue Staffel: {show_name} ({year}) - S{season_num00}

Jetzt anschauen: {plex_url}</season>
<episode>Neue Folge: {show_name} {year} - S{season_num00}E{episode_num00} - {episode_name} {video_resolution} {stream_audio_channel_layout} {stream_audio_channels} {stream_audio_codec}

Jetzt anschauen: {plex_url}</episode>

1 Like