@@ -40,10 +40,10 @@ def __init__(
40
40
self ,
41
41
debug : int = 0 ,
42
42
output : str = 'json' ,
43
- region : Region = Region . EU ):
43
+ country : str = 'GB' ):
44
44
self .debug = debug
45
45
self .output = output
46
- self .region = region
46
+ self .country = country
47
47
48
48
def print (self , result ):
49
49
data_variable = getattr (result , 'data' , None )
@@ -64,21 +64,20 @@ def print(self, result):
64
64
default = 'json' ,
65
65
help = 'Output format. Default: "json"' )
66
66
@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"' )
72
71
@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 ):
74
73
"""Tool for connectiong and getting information from Kärcher Home Robots."""
75
74
level = logging .INFO
76
75
if debug > 0 :
77
76
level = logging .DEBUG
78
77
79
78
logging .basicConfig (level = level )
80
79
81
- ctx .obj = GlobalContextObject (debug = debug , output = output , region = region )
80
+ ctx .obj = GlobalContextObject (debug = debug , output = output , country = country . upper () )
82
81
83
82
84
83
def safe_cli ():
@@ -96,9 +95,9 @@ def safe_cli():
96
95
@click .pass_context
97
96
@coro
98
97
async def urls (ctx : click .Context ):
99
- """Get region information."""
98
+ """Get URL information."""
100
99
101
- kh = await KarcherHome .create (region = ctx .obj .region )
100
+ kh = await KarcherHome .create (country = ctx .obj .country )
102
101
d = await kh .get_urls ()
103
102
104
103
ctx .obj .print (d )
@@ -112,7 +111,7 @@ async def urls(ctx: click.Context):
112
111
async def login (ctx : click .Context , username : str , password : str ):
113
112
"""Get user session tokens."""
114
113
115
- kh = await KarcherHome .create (region = ctx .obj .region )
114
+ kh = await KarcherHome .create (country = ctx .obj .country )
116
115
ctx .obj .print (kh .login (username , password ))
117
116
118
117
@@ -125,7 +124,7 @@ async def login(ctx: click.Context, username: str, password: str):
125
124
async def devices (ctx : click .Context , username : str , password : str , auth_token : str ):
126
125
"""List all devices."""
127
126
128
- kh = await KarcherHome .create (region = ctx .obj .region )
127
+ kh = await KarcherHome .create (country = ctx .obj .country )
129
128
if auth_token is not None :
130
129
kh .login_token (auth_token , '' )
131
130
elif username is not None and password is not None :
@@ -160,7 +159,7 @@ async def device_properties(
160
159
device_id : str ):
161
160
"""Get device properties."""
162
161
163
- kh = await KarcherHome .create (region = ctx .obj .region )
162
+ kh = await KarcherHome .create (country = ctx .obj .country )
164
163
if auth_token is not None :
165
164
kh .login_token (auth_token , mqtt_token )
166
165
elif username is not None and password is not None :
0 commit comments