diff --git a/homeassistant/components/plex/const.py b/homeassistant/components/plex/const.py index c576f1d6a59..d3a3a866361 100644 --- a/homeassistant/components/plex/const.py +++ b/homeassistant/components/plex/const.py @@ -17,9 +17,9 @@ PLEX_CONFIG_FILE = "plex.conf" PLEX_MEDIA_PLAYER_OPTIONS = "plex_mp_options" PLEX_SERVER_CONFIG = "server_config" -PLEX_NEW_MP_SIGNAL = "plex_new_mp_signal" +PLEX_NEW_MP_SIGNAL = "plex_new_mp_signal.{}" PLEX_UPDATE_MEDIA_PLAYER_SIGNAL = "plex_update_mp_signal.{}" -PLEX_UPDATE_SENSOR_SIGNAL = "plex_update_sensor_signal" +PLEX_UPDATE_SENSOR_SIGNAL = "plex_update_sensor_signal.{}" CONF_SERVER = "server" CONF_SERVER_IDENTIFIER = "server_id" diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 4a48950a67c..32bf7b65fff 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -62,7 +62,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): hass, config_entry, async_add_entities, server_id, new_entities ) - unsub = async_dispatcher_connect(hass, PLEX_NEW_MP_SIGNAL, async_new_media_players) + unsub = async_dispatcher_connect( + hass, PLEX_NEW_MP_SIGNAL.format(server_id), async_new_media_players + ) hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub) diff --git a/homeassistant/components/plex/sensor.py b/homeassistant/components/plex/sensor.py index 3cde2adb8f4..287f0edf39a 100644 --- a/homeassistant/components/plex/sensor.py +++ b/homeassistant/components/plex/sensor.py @@ -49,7 +49,9 @@ class PlexSensor(Entity): """Run when about to be added to hass.""" server_id = self._server.machine_identifier unsub = async_dispatcher_connect( - self.hass, PLEX_UPDATE_SENSOR_SIGNAL, self.async_refresh_sensor + self.hass, + PLEX_UPDATE_SENSOR_SIGNAL.format(server_id), + self.async_refresh_sensor, ) self.hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub) diff --git a/homeassistant/components/plex/server.py b/homeassistant/components/plex/server.py index 128bcdd45c6..d7825ae82c3 100644 --- a/homeassistant/components/plex/server.py +++ b/homeassistant/components/plex/server.py @@ -147,9 +147,17 @@ class PlexServer: self.refresh_entity(client_id, None, None) if new_entity_configs: - dispatcher_send(self._hass, PLEX_NEW_MP_SIGNAL, new_entity_configs) + dispatcher_send( + self._hass, + PLEX_NEW_MP_SIGNAL.format(self.machine_identifier), + new_entity_configs, + ) - dispatcher_send(self._hass, PLEX_UPDATE_SENSOR_SIGNAL, sessions) + dispatcher_send( + self._hass, + PLEX_UPDATE_SENSOR_SIGNAL.format(self.machine_identifier), + sessions, + ) @property def friendly_name(self):