Add device registry support for Plex (#31797)

* Add device registry support for Plex

* Fix model

* Use Plex server as sensor device identifier
This commit is contained in:
jjlawren 2020-02-13 18:37:52 -06:00 committed by GitHub
parent f0b2d50e41
commit 408b41ea02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 0 deletions

View file

@ -142,3 +142,17 @@ class PlexSensor(Entity):
now_playing.append((now_playing_user, now_playing_title))
self._state = len(self.sessions)
self._now_playing = now_playing
@property
def device_info(self):
"""Return a device description for device registry."""
if self.unique_id is None:
return None
return {
"identifiers": {(PLEX_DOMAIN, self._server.machine_identifier)},
"manufacturer": "Plex",
"model": "Plex Media Server",
"name": "Activity Sensor",
"sw_version": self._server.version,
}