@@ -40,10 +40,10 @@ def __init__(
4040 self ,
4141 debug : int = 0 ,
4242 output : str = 'json' ,
43- region : Region = Region . EU ):
43+ country : str = 'GB' ):
4444 self .debug = debug
4545 self .output = output
46- self .region = region
46+ self .country = country
4747
4848 def print (self , result ):
4949 data_variable = getattr (result , 'data' , None )
@@ -64,21 +64,20 @@ def print(self, result):
6464 default = 'json' ,
6565 help = 'Output format. Default: "json"' )
6666@click .option (
67- '-r' ,
68- '--region' ,
69- type = click .Choice ([Region .EU , Region .US , Region .CN ]),
70- default = Region .EU ,
71- help = 'Region of the server to query. Default: "eu"' )
67+ '-c' ,
68+ '--country' ,
69+ default = 'GB' ,
70+ help = 'Country of the server to query. Default: "GB"' )
7271@click .pass_context
73- def cli (ctx : click .Context , debug : int , output : str , region : Region ):
72+ def cli (ctx : click .Context , debug : int , output : str , country : str ):
7473 """Tool for connectiong and getting information from Kärcher Home Robots."""
7574 level = logging .INFO
7675 if debug > 0 :
7776 level = logging .DEBUG
7877
7978 logging .basicConfig (level = level )
8079
81- ctx .obj = GlobalContextObject (debug = debug , output = output , region = region )
80+ ctx .obj = GlobalContextObject (debug = debug , output = output , country = country . upper () )
8281
8382
8483def safe_cli ():
@@ -96,9 +95,9 @@ def safe_cli():
9695@click .pass_context
9796@coro
9897async def urls (ctx : click .Context ):
99- """Get region information."""
98+ """Get URL information."""
10099
101- kh = await KarcherHome .create (region = ctx .obj .region )
100+ kh = await KarcherHome .create (country = ctx .obj .country )
102101 d = await kh .get_urls ()
103102
104103 ctx .obj .print (d )
@@ -112,7 +111,7 @@ async def urls(ctx: click.Context):
112111async def login (ctx : click .Context , username : str , password : str ):
113112 """Get user session tokens."""
114113
115- kh = await KarcherHome .create (region = ctx .obj .region )
114+ kh = await KarcherHome .create (country = ctx .obj .country )
116115 ctx .obj .print (kh .login (username , password ))
117116
118117
@@ -125,7 +124,7 @@ async def login(ctx: click.Context, username: str, password: str):
125124async def devices (ctx : click .Context , username : str , password : str , auth_token : str ):
126125 """List all devices."""
127126
128- kh = await KarcherHome .create (region = ctx .obj .region )
127+ kh = await KarcherHome .create (country = ctx .obj .country )
129128 if auth_token is not None :
130129 kh .login_token (auth_token , '' )
131130 elif username is not None and password is not None :
@@ -160,7 +159,7 @@ async def device_properties(
160159 device_id : str ):
161160 """Get device properties."""
162161
163- kh = await KarcherHome .create (region = ctx .obj .region )
162+ kh = await KarcherHome .create (country = ctx .obj .country )
164163 if auth_token is not None :
165164 kh .login_token (auth_token , mqtt_token )
166165 elif username is not None and password is not None :
0 commit comments