forked from rytilahti/python-miio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add troubleshooting guide for cross-subnet communications
This troubleshooting guide is the result of the outcome of issue rytilahti#422. Please have a look at the issue for more insights: rytilahti#422
- Loading branch information
1 parent
07102a8
commit 4d33ef2
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ who have helped to extend this to cover not only the vacuum cleaner. | |
ceil | ||
eyecare | ||
API <miio> | ||
troubleshooting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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``) | ||
- Xiaomi IR Remote (aka ``chuangmi_ir``) | ||
|
||
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 <https://github.com/rytilahti/python-miio/issues/422>`_. | ||
|
||
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 <https://en.wikipedia.org/wiki/Network_address_translation>`_. |