miio: Device can not be discovered
This issue is here to track issues with device discovery, both via miio.devices()
and the miio
CLI-tool. The network discovery was rewritten in 0.15.0 making it a bit more resilient.
Feel free to add a comment to this issue if you have a device that does not show up when using miio discover
.
This issue covers the following old issues: #31, #40 (partially), #84
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 42 (2 by maintainers)
Indeed, in
lib/network.js
, I hardcoded the address of the right interface into the_socket.bind
call:instead of
which led to a successful discovery of my Xiaomi device (Mijia bedside lamp).
I also tried to hardcode
0.0.0.0
there, didn’t work. This value is default as per the docs, and apparently it’s indeed used, but doesn’t work for some reason. I don’t know much about UDP, so can’t tell what’s going on here. As a workaround, we can probably use something like theinternal-ip
module.My environment:
miio discover
didn’t work: Win 7 x64, node 9.5.0Sorry, I didn’t look hard enough. Now I found the screen. On my phone it was all in English. For anyone else trying to find this, go to the main app screen then:
Does anyone have an update on this? I am unable to discover the xiaomi roborock too, even after a wifi reset. It can be discovered after I set it up in the Mi Home app though.
Hi to everyone, my goal is to control mi air purifier 2 (zhimi-airpurifier-m1) in local network while blocking it by firewall for any outbound connections to xiaomi servers. I have issue with that. When in the WiFi network, there is no internet connection (or outbound tcp:80 is blocked), I am loosing the ability to control and read sensors by mi home app or miio cli commands. I suppose that it is intended bug or feature in the mi airpurifier firmware (1.2.4_60), known as “,” in JSON payload.
When comparing JSON payloads: Internet-on: “mmfree”:25992,“ot”:“ott”,“otu_stat”:[0,0,0,0,0,171] Internet-off: “mmfree”:26576,“otu_stat”:[0,0,0,0,0,171] Device-after-reset: “mmfree”:24896,“otu_stat”:[0,0,0,0,0,0]
, We can see that, in the last two examples ,“ot”:“ott”, filed is empty: “,”.
In the python-miio library this issue was solved: https://github.com/rytilahti/python-miio/blob/master/miio/protocol.py#L167
Is there, a chance, that similar solution could be implemented in the miio library?
I use miio v0.15.6 installed on RPi 3B+ with Raspbian Stretch Lite, node v6.14.2, node-red v0.18.6.
Edit: I found that adding this, in file: safeishJSON.js, have fixed all my issues with miio discover / inspect / configure:
Internet-on:
Internet-off:
Device-after-reset:
@pkol How many active network interfaces does your machine have? For me,
miio discover
works on a pc with only one interface. However, on another laptop, where I have virtual networks for VMs, it doesn’t work. Apparently, itsends requests orlistens to the wrong interface.When using the debug command (for reference, on Windows it’s set DEBUG=* & miio discover) I’m getting different results but was eventually able to track it down.
I deleted the miio directory under my profile folder which holds the tokens.xml. It was added when manually updating the token on 0.14.1 for a device that is not able to auto-discover the token. After deleting
miio discover
does find my robot. Not able to control it yet but that’s a different issue. Discovery for the vacuum cleaner is working here again.you saved me man. thanks. I searched for this token 4 hours.