Restore the state of a device to that which was previously saved.

        For coordinator devices restore everything. For slave devices
        only restore volume etc., not transport info (transport info
        comes from the slave's coordinator).

        Args:
            fade (bool): Whether volume should be faded up on restore.

def restore(self, fade=False):
        """Restore the state of a device to that which was previously saved.

        For coordinator devices restore everything. For slave devices
        only restore volume etc., not transport info (transport info
        comes from the slave's coordinator).

        Args:
            fade (bool): Whether volume should be faded up on restore.
        """

        if self.is_coordinator:
            # Start by ensuring that the speaker is paused as we don't want
            # things all rolling back when we are changing them, as this could
            # include things like audio
            transport_info = self.device.get_current_transport_info()
            if transport_info is not None:
                if transport_info['current_transport_state'] == 'PLAYING':
                    self.device.pause()

            # Check if the queue should be restored
            self._restore_queue()

            # Reinstate what was playing

            if self.is_playing_queue and self.playlist_position > 0:
                # was playing from playlist

                if self.playlist_position is not None:
                    # The position in the playlist returned by
                    # get_current_track_info starts at 1, but when
                    # playing from playlist, the index starts at 0
                    # if position > 0:
                    self.playlist_position -= 1
                    self.device.play_from_queue(self.playlist_position, False)

                if self.track_position is not None:
                    if self.track_position != "":
                        self.device.seek(self.track_position)

                # reinstate track, position, play mode, cross fade
                # Need to make sure there is a proper track selected first
                self.device.play_mode = self.play_mode
                self.device.cross_fade = self.cross_fade

            elif self.is_playing_cloud_queue:
                # was playing a cloud queue started by Alexa
                # No way yet to re-start this so prevent it throwing an error!
                pass

            else:
                # was playing a stream (radio station, file, or nothing)
                # reinstate uri and meta data
                if self.media_uri != "":
                    self.device.play_uri(
                        self.media_uri, self.media_metadata, start=False)

        # For all devices:
        # Reinstate all the properties that are pretty easy to do
        self.device.mute = self.mute
        self.device.bass = self.bass
        self.device.treble = self.treble
        self.device.loudness = self.loudness

        # Reinstate volume
        # Can only change volume on device with fixed volume set to False
        # otherwise get uPnP error, so check first. Before issuing a network
        # command to check, fixed volume always has volume set to 100.
        # So only checked fixed volume if volume is 100.
        if self.volume == 100:
            fixed_vol = self.device.renderingControl.GetOutputFixed(
                [('InstanceID', 0)])['CurrentFixed']
        else:
            fixed_vol = False

        # now set volume if not fixed
        if not fixed_vol:
            if fade:
                # if fade requested in restore
                # set volume to 0 then fade up to saved volume (non blocking)
                self.device.volume = 0
                self.device.ramp_to_volume(self.volume)
            else:
                # set volume
                self.device.volume = self.volume

        # Now everything is set, see if we need to be playing, stopped
        # or paused ( only for coordinators)
        if self.is_coordinator:
            if self.transport_state == 'PLAYING':
                self.device.play()
            elif self.transport_state == 'STOPPED':
                self.device.stop()