Skip to content

Commit

Permalink
Update gateways commands list
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Mar 29, 2024
1 parent b6c89b8 commit 58a15dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
24 changes: 17 additions & 7 deletions custom_components/xiaomi_gateway3/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def async_select_option(self, option: str):
CMD_PARENT_SCAN = "parent_scan"
CMD_FLASH_EZSP = "flash_ezsp"
CMD_FW_LOCK = "firmware_lock"
CMD_OPENMIIO_RELOAD = "openmiio_reload"
CMD_OPENMIIO_RESTART = "openmiio_restart"
CMD_RUN_FTP = "run_ftp"
CMD_REBOOT = "reboot"
# ZIGBEE
Expand All @@ -65,17 +65,27 @@ def on_init(self):
if self.device.type == GATEWAY:
self._attr_options += [
CMD_UPDATE,
CMD_PAIR,
CMD_FORCE_PAIR,
CMD_PARENT_SCAN,
CMD_RUN_FTP,
CMD_REBOOT,
CMD_OPENMIIO_RELOAD,
CMD_DISABLE,
CMD_ENABLE,
]
if self.device.model == "lumi.gateway.mgl03":
self._attr_options += [CMD_FLASH_EZSP, CMD_FW_LOCK]
self._attr_options += [
CMD_FW_LOCK,
CMD_OPENMIIO_RESTART,
CMD_PAIR,
CMD_FORCE_PAIR,
CMD_PARENT_SCAN,
CMD_FLASH_EZSP,
]
else:
self._attr_options += [
CMD_OPENMIIO_RESTART,
CMD_PAIR,
CMD_FORCE_PAIR,
CMD_PARENT_SCAN,
]
elif self.device.type == ZIGBEE:
if self.device.has_controls():
self._attr_options.append(CMD_UPDATE)
Expand Down Expand Up @@ -116,7 +126,7 @@ async def async_select_option(self, option: str) -> None:
await self.gw.stop()
elif option == CMD_ENABLE:
self.gw.start()
elif option in (CMD_RUN_FTP, CMD_REBOOT, CMD_OPENMIIO_RELOAD):
elif option in (CMD_RUN_FTP, CMD_REBOOT, CMD_OPENMIIO_RESTART):
ok = await self.gw.telnet_command(option)
self.device.dispatch({"data": OPT_OK if ok else OPT_ERROR})
elif option == CMD_FW_LOCK:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"reboot": "Gateway reboot",
"run_ftp": "Gateway run FTP",
"flash_ezsp": "Zigbee flash EZSP",
"openmiio_reload": "OpenmiIO reload",
"openmiio_restart": "OpenmiIO restart",
"disable": "Gateway disable",
"enable": "Gateway enable",
"rejoin": "Zigbee rejoin",
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"reboot": "Перезагрузка шлюза",
"run_ftp": "Запуск FTP на шлюзе",
"flash_ezsp": "Прошивка EZSP Zigbee",
"openmiio_reload": "Перезагрузка OpenmiIO",
"openmiio_restart": "Перезагрузка OpenmiIO",
"disable": "Отключение шлюза",
"enable": "Включение шлюза",
"rejoin": "Повторное подключение Zigbee",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"reboot": "网关重启",
"ftp": "网关运行FTP",
"flashzb": "Zigbee刷写EZSP",
"openmiio_reload": "重载OpenmiIO"
"openmiio_restart": "重载OpenmiIO"
}
},
"data": {
Expand Down

0 comments on commit 58a15dd

Please sign in to comment.