Fix IndexError for home stats
This commit is contained in:
parent
79a9c1af9e
commit
f8218b5e01
1 changed files with 4 additions and 4 deletions
|
@ -19,7 +19,7 @@ import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
REQUIREMENTS = ['pytautulli==0.4.0']
|
REQUIREMENTS = ['pytautulli==0.4.1']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@ class TautulliSensor(Entity):
|
||||||
await self.tautulli.async_update()
|
await self.tautulli.async_update()
|
||||||
self.home = self.tautulli.api.home_data
|
self.home = self.tautulli.api.home_data
|
||||||
self.sessions = self.tautulli.api.session_data
|
self.sessions = self.tautulli.api.session_data
|
||||||
self._attributes['Top Movie'] = self.home[0]['rows'][0]['title']
|
self._attributes['Top Movie'] = self.home['movie']
|
||||||
self._attributes['Top TV Show'] = self.home[3]['rows'][0]['title']
|
self._attributes['Top TV Show'] = self.home['tv']
|
||||||
self._attributes['Top User'] = self.home[7]['rows'][0]['user']
|
self._attributes['Top User'] = self.home['user']
|
||||||
for key in self.sessions:
|
for key in self.sessions:
|
||||||
if 'sessions' not in key:
|
if 'sessions' not in key:
|
||||||
self._attributes[key] = self.sessions[key]
|
self._attributes[key] = self.sessions[key]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue