Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add climate_start/stop services to CLI #710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions bimmer_connected/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ def main_parser() -> argparse.ArgumentParser:
"-a", "--address", nargs="+", help="Address (e.g. 'Street 17, city, zip, country')"
)
sendpoi_from_address_parser.set_defaults(func=send_poi_from_address)

climate_start_parser = subparsers.add_parser("climate_start", description="Climate Control Start")
_add_default_arguments(climate_start_parser)
climate_start_parser.add_argument("vin", help=TEXT_VIN)
climate_start_parser.set_defaults(func=climate_start)

climate_stop_parser = subparsers.add_parser("climate_stop", description="Climate Control Stop")
_add_default_arguments(climate_stop_parser)
climate_stop_parser.add_argument("vin", help=TEXT_VIN)
climate_stop_parser.set_defaults(func=climate_stop)



return parser

Expand Down Expand Up @@ -306,6 +318,22 @@ async def send_poi_from_address(account: MyBMWAccount, args) -> None:
await vehicle.remote_services.trigger_send_poi(poi_data)


async def climate_start(account: MyBMWAccount, args) -> None:
"""Turn On Climate Control."""
await account.get_vehicles()
vehicle = get_vehicle_or_return(account, args.vin)
status = await vehicle.remote_services.trigger_remote_air_conditioning()
print(status.state)

async def climate_stop(account: MyBMWAccount, args) -> None:
"""Turn Off Climate Control."""
await account.get_vehicles()
vehicle = get_vehicle_or_return(account, args.vin)
status = await vehicle.remote_services.trigger_remote_air_conditioning_stop()
print(status.state)



def _add_default_arguments(parser: argparse.ArgumentParser):
"""Add the default arguments username, password, region to the parser."""
parser.add_argument("username", help="Connected Drive username")
Expand Down
Loading