Skip to content

Commit

Permalink
gateway: Add "enable_telnet" to gateway (rytilahti#734)
Browse files Browse the repository at this point in the history
* Add "enable_telnet" to gateway

Apperently you can enable the telnet service on xiaomi gateways to get root acces into the operating system of the gateway.
Have not tested it myself (do not (yet) want to mess with the operating system).
But everything is discussed in this HomeAssistant community post: https://community.home-assistant.io/t/xiaomi-mijia-smart-multi-mode-gateway-zndmwg03lm-support/159586/61

* catch error on gateway models not supproting enable_telnet

* fix isort
  • Loading branch information
starkillerOG authored and xvlady committed May 9, 2021
1 parent 986c42d commit 62c4b2f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion miio/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from .click_common import EnumType, command, format_output
from .device import Device
from .exceptions import DeviceException
from .exceptions import DeviceError, DeviceException
from .utils import brightness_and_color_to_int, int_to_brightness, int_to_rgb

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -357,6 +357,18 @@ def set_developer_key(self, key):

return self.send("set_lumi_dpf_aes_key", [key])

@command()
def enable_telnet(self):
"""Enable root telnet acces to the operating system, use login "admin" or "app", no password."""
try:
return self.send("enable_telnet_service")
except DeviceError:
_LOGGER.error(
"Gateway model '%s' does not (yet) support enabling the telnet interface",
self.model,
)
return None

@command()
def timezone(self):
"""Get current timezone."""
Expand Down

0 comments on commit 62c4b2f

Please sign in to comment.