'Update state of device.'

def update(self):

    self._in_standby = self._device.IsInStandby()
    self._transport_state = self._device.TransportState()
    self._track_information = self._device.TrackInfo()
    self._volume_level = self._device.VolumeLevel()
    self._volume_muted = self._device.IsMuted()
    self._source = self._device.Source()
    self._name = self._device.Room().decode('utf-8')
    self._supported_features = SUPPORT_OPENHOME
    source_index = {}
    source_names = list()
    for source in self._device.Sources():
        source_names.append(source['name'])
        source_index[source['name']] = source['index']
    self._source_index = source_index
    self._source_names = source_names
    if (self._source['type'] == 'Radio'):
        self._supported_features |= (SUPPORT_STOP | SUPPORT_PLAY)
    if (self._source['type'] in ('Playlist', 'Cloud')):
        self._supported_features |= (((SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK) | SUPPORT_PAUSE) | SUPPORT_PLAY)
    if self._in_standby:
        self._state = STATE_OFF
    elif (self._transport_state == 'Paused'):
        self._state = STATE_PAUSED
    elif (self._transport_state in ('Playing', 'Buffering')):
        self._state = STATE_PLAYING
    elif (self._transport_state == 'Stopped'):
        self._state = STATE_IDLE
    else:
        self._state = STATE_PLAYING
