Skip to content

Commit 7f43138

Browse files
committed
Update pairing process in select options
1 parent 253c3d3 commit 7f43138

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

custom_components/xiaomi_gateway3/select.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def async_set_state(self, data: dict):
170170

171171
async def async_select_option(self, option: str) -> None:
172172
"""Can process user step, done by user from this select"""
173-
coro = getattr(self, f"step_user_{self.step_id}")
173+
coro = getattr(self, f"step_user_{self.step_id}", None)
174174
if coro:
175175
await coro(option)
176176

@@ -186,7 +186,6 @@ def step_event_pair(self, value: bool):
186186
# change select.command
187187
self.device.update({"command": "pair"})
188188
else:
189-
self.set_options(OPT_STOP_JOIN)
190189
# clear select.command
191190
self.device.update({"command": None})
192191

@@ -199,10 +198,12 @@ def step_event_discovered_mac(self, value: str):
199198

200199
def step_event_pair_command(self, value: dict):
201200
secure = value["install_code"]
202-
self.set_options(OPT_KEY_SECURE if secure else OPT_KEY_LEGACY)
201+
option = OPT_KEY_SECURE if secure else OPT_KEY_LEGACY
202+
self.set_options(option, self.options + [option])
203203

204204
def step_event_added_device(self, value: dict):
205-
self.set_end(f"Paired: {value['mac']} ({value['model']})")
205+
option = f"Paired: {value['model']}"
206+
self.set_options(option, self.options + [option])
206207

207208
def step_event_remove_did(self, value: str):
208209
device = self.gw.devices.get(value)

0 commit comments

Comments
 (0)