diff --git a/plexpy/common.py b/plexpy/common.py index 8b4ca333..f897e584 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -551,6 +551,18 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Indexes', 'type': 'int', 'value': 'indexes', 'description': 'If the media has video preview thumbnails.', 'example': '0 or 1'}, ] }, + { + 'category': 'Plex Remote Access', + 'parameters': [ + {'name': 'Remote Access Mapping State', 'type': 'str', 'value': 'remote_access_mapping_state', 'description': 'The mapping state of the Plex remote access port.'}, + {'name': 'Remote Access Mapping Error', 'type': 'str', 'value': 'remote_access_mapping_error', 'description': 'The mapping error of the Plex remote access port.'}, + {'name': 'Remote Access Public IP Address', 'type': 'str', 'value': 'remote_access_public_address', 'description': 'The Plex remote access public IP address.'}, + {'name': 'Remote Access Public Port', 'type': 'str', 'value': 'remote_access_public_port', 'description': 'The Plex remote access public port.'}, + {'name': 'Remote Access Private IP Address', 'type': 'str', 'value': 'remote_access_private_address', 'description': 'The Plex remote access private IP address.'}, + {'name': 'Remote Access Private Port', 'type': 'str', 'value': 'remote_access_private_port', 'description': 'The Plex remote access private port.'}, + {'name': 'Remote Access Failure Reason', 'type': 'str', 'value': 'remote_access_reason', 'description': 'The failure reason for Plex remote access going down.'}, + ] + }, { 'category': 'Plex Update Available', 'parameters': [ diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index b66072f7..6b929d48 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1041,6 +1041,7 @@ def build_server_notify_params(notify_action=None, **kwargs): pms_download_info = defaultdict(str, kwargs.pop('pms_download_info', {})) plexpy_download_info = defaultdict(str, kwargs.pop('plexpy_download_info', {})) + remote_access_info = defaultdict(str, kwargs.pop('remote_access_info', {})) now = arrow.now() now_iso = now.isocalendar() @@ -1072,6 +1073,14 @@ def build_server_notify_params(notify_action=None, **kwargs): 'timestamp': now.format(time_format), 'unixtime': int(time.time()), 'utctime': helpers.utc_now_iso(), + # Plex remote access parameters + 'remote_access_mapping_state': remote_access_info['mapping_state'], + 'remote_access_mapping_error': remote_access_info['mapping_error'], + 'remote_access_public_address': remote_access_info['public_address'], + 'remote_access_public_port': remote_access_info['public_port'], + 'remote_access_private_address': remote_access_info['private_address'], + 'remote_access_private_port': remote_access_info['private_port'], + 'remote_access_reason': remote_access_info['reason'], # Plex Media Server update parameters 'update_version': pms_download_info['version'], 'update_url': pms_download_info['download_url'], diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 4aa1fe19..b6a7bf4c 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -370,7 +370,7 @@ def available_notification_actions(agent_id=None): 'name': 'on_extdown', 'description': 'Trigger a notification when the Plex Media Server cannot be reached externally.', 'subject': 'Tautulli ({server_name})', - 'body': 'The Plex Media Server remote access is down.', + 'body': 'The Plex Media Server remote access is down. ({remote_access_reason})', 'icon': 'fa-server', 'media_types': ('server',) },