diff --git a/songpal/device.py b/songpal/device.py index c375e1f..cdd8a9b 100644 --- a/songpal/device.py +++ b/songpal/device.py @@ -184,17 +184,17 @@ async def set_power_settings(self, target: str, value: str) -> None: params = {"settings": [{"target": target, "value": value}]} return await self.services["system"]["setPowerSettings"](params) - async def get_wutang(self) -> List[Setting]: + async def get_googlecast_settings(self) -> List[Setting]: """Get Googlecast settings.""" return [ Setting.make(**x) for x in await self.services["system"]["getWuTangInfo"]({}) ] - async def set_wutang(self, target: str, value: str): + async def set_googlecast_settings(self, target: str, value: str): """Set Googlecast settings.""" params = {"settings": [{"target": target, "value": value}]} - return await self.services["system"]["setWuTangSettings"](params) + return await self.services["system"]["setWuTangInfo"](params) async def request_settings_tree(self): """Get raw settings tree JSON. diff --git a/songpal/main.py b/songpal/main.py index 46c3a70..99c50d6 100644 --- a/songpal/main.py +++ b/songpal/main.py @@ -253,11 +253,16 @@ async def input(dev: Device, input): @cli.command() +@click.argument("target", required=False) +@click.argument("value", required=False) @pass_dev @coro -async def googlecast(dev: Device): +async def googlecast(dev: Device, target, value): """Return Googlecast settings.""" - print_settings(await dev.get_wutang()) + if target and value: + click.echo("Setting %s = %s" % (target, value)) + await dev.set_googlecast_settings(target, value) + print_settings(await dev.get_googlecast_settings()) @cli.command()