mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Change state() to try/except to catch KeyError (#19935)
* Change state() to try/except to catch KeyError When Tautulli is up but Plex is down, the API doesn't return a 'stream_count' key. This causes calls to state() to raise KeyError exceptions. The new code includes a try/except to catch the KeyError and return -1 signifying that the Tautulli API cannot talk to Plex * Update tautulli.py
This commit is contained in:
parent
31d92683f7
commit
c3e9bd1444
@ -119,7 +119,7 @@ class TautulliSensor(Entity):
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self.sessions['stream_count']
|
||||
return self.sessions.get('stream_count')
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user