async def _get_volume_information_upnp(self): await self._get_upnp_services() rendering_control_service = self._upnp_renderer.service( next(s for s in self._upnp_renderer.services if "RenderingControl" in s)) volume_result = await rendering_control_service.action( "GetVolume").async_call(InstanceID=0, Channel="Master") mute_result = await rendering_control_service.action( "GetMute").async_call(InstanceID=0, Channel="Master") min_volume = rendering_control_service.state_variables[ "Volume"].min_value max_volume = rendering_control_service.state_variables[ "Volume"].max_value return [ Volume.make( volume=volume_result["CurrentVolume"], mute=mute_result["CurrentMute"], minVolume=min_volume, maxVolume=max_volume, step=1, renderingControl=rendering_control_service, ) ]
async def get_volume_information(self) -> List[Volume]: """Get the volume information.""" res = await self.services["audio"]["getVolumeInformation"]({}) volume_info = [Volume.make(services=self.services, **x) for x in res] if len(volume_info) < 1: logging.warning("Unable to get volume information") elif len(volume_info) > 1: logging.debug("The device seems to have more than one volume setting.") return volume_info