From 5962903d751d92b580ecf2013fbd9a264b7db043 Mon Sep 17 00:00:00 2001 From: Dominique Barton Date: Sun, 20 Jan 2019 02:24:43 +0100 Subject: [PATCH] Add troubleshooting guide for cross-subnet communications This troubleshooting guide is the result of the outcome of issue #422. Please have a look at the issue for more insights: https://github.com/rytilahti/python-miio/issues/422 --- docs/index.rst | 1 + docs/troubleshooting.rst | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docs/troubleshooting.rst diff --git a/docs/index.rst b/docs/index.rst index 2beafaec7..982e54195 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -33,3 +33,4 @@ who have helped to extend this to cover not only the vacuum cleaner. ceil eyecare API + troubleshooting diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst new file mode 100644 index 000000000..8a9ca9cc5 --- /dev/null +++ b/docs/troubleshooting.rst @@ -0,0 +1,36 @@ +Troubleshooting +=============== + +Discover devices across subnets +------------------------------- + +Discovering across different subnets may fail for some devices with the following exception: + +.. code-block:: text + + miio.exceptions.DeviceException: Unable to discover the device x.x.x.x + +This behaviour has been experienced on the following device types: + +- Xiaomi Zhimi Humidifier (aka ``zhimi.humidifier.v1``) +- Xiaomi Smartmi Evaporative Humidifier 2 (aka ``zhimi.humidifier.ca1``) + +It's currently unclear if this is a bug or a security feature of the Xiaomi device. + +.. note:: + + The root cause is the source address in the UDP packet. The device won't react/respond to the miIO request, in case the source address of the UDP packet doesn't belong to the subnet of the device itself. This behaviour was experienced and described in `this github issue `_. + +Fortunately there are some workarounds to get the communication working. + +The most obvious one would be placing the miIO client & MI device in the same subnet. You can also dual-home your client and put it in multiple subnets. This can be achieved either physically (e.g. multiple ethernet cables) or virtually (multiple VLAN's). + +.. hint:: + + You might have had your reasons for multiple subnets and they're probably security-related. If so, remember to configure a local firewall on your client so that incoming connections from untrusted subnets are restricted. + +If you're in control of the router in between, then you have one more chance to get the communication up & running. You can configure IP masquearding on the outgoing routing interface for the subnet where the MI device resides. IP masquerading (NAT) basically changes the source address in the UDP packet to the IP address of the outbound routing interface. + +.. note:: + + Read more about `Network address translation on Wikipedia `_.