'Update device state.'

def update(self):

    from twitch.api import v3 as twitch
    stream = twitch.streams.by_channel(self._channel).get('stream')
    if stream:
        self._game = stream.get('channel').get('game')
        self._title = stream.get('channel').get('status')
        self._preview = stream.get('preview').get('small')
        self._state = STATE_STREAMING
    else:
        self._preview = None
        self._state = STATE_OFFLINE
