-
-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with water purifier #48
Comments
Your provided commands are doing different things. The first one (miio) sends the command "get_prop" to the device. The second command (via mirobo) sends the command "miIO.info". It looks like your device doesn't support the command. Could you try the same via miio?
Do you get a response? |
@syssi thanks for the quick response :) Yes, it has resp.
|
Cool. This response is good! I'm a bit confused now. ;-) I will read the code again. |
Got it. The CLI tool calls vac.info(). Before DeviceInfo(self.send("miIO.info", [])) can be processed we must discover the device. The discovery fails because the device doesn't respond to the helobytes on port 54321 oddly enough. Hmm.. the discover method of miio and mirobo is equal. |
It looks like a timeout. This is the method call which returns None and raises the Exception: https://github.com/rytilahti/python-mirobo/blob/master/mirobo/device.py#L58 The called method L77 should output additional debug messages most of the time. There is just one code path which doesn't produce additional outputs: If "is_broadcast" is false and we hit the except block for a socket.timeout. The method will return None now. Could you execute
a few times? You can also increase the timeout at L79. |
hmm, tried both, but still failed P.S. miio exec time about 5s, increased device.py's timeout to 15. |
I'm out of ideas. Do you have some Teemu? @rytilahti |
Alas not really. @nutinshell are you controlling the device with some other library/device at the same time you are trying to access it with mirobo, maybeb there is a problem with multiple concurrent connections? You could also use -d multiple times (or just do -dd) to get a bit more debug output. |
@rytilahti tried many times, no one worked. -dd like:
It's not the concurrent connection issue, just want to make a hass custom sensor by using mirobo, but no luck, hass report the same error like mirobo cli. I found an interesting phenomenon, the hass custom script works one time only this afternoon, and then never works... |
Could you try the same from another host/system? Just for fun. ;-) |
@syssi yes, tried on mac, same :) miio worked, mirobo failed :( |
@syssi I had a look at https://github.com/aholstenson/miio/, seems quite different with mirobo (I am not very familiar with js or py) |
The question is: Why is miio working for you and mirobo is not? The executed code is the same. |
@syssi hmm, no idea, mirobo works with my air purifier but not water purifier, maybe some diffs in handle other devices like water purifier's data. Also, doesn't find mimo send helobytes, am I right? |
How about this: https://github.com/SchumyHao/python-miio/blob/master/miio/miio.py#L58 ;-) |
No, it's https://github.com/aholstenson/miio/ of course :D |
@nutinshell you could try to capture the network traffic caused by miio(js) and see how it compares to python-mirobo. As far as I know miio also uses handshakes (and those are required for some devices like the vacuum to function, as it is the way to gain the timestamp of the device for further requests). |
Good suggestion. I would evalute the capture if you can provide one. Wireshark/tcpdump should be used. |
I compared the javascript implemention of the discovery. It's very similar. The important parts: https://github.com/aholstenson/miio/blob/master/lib/discovery.js#L97-L108 There is just one funny thing: The helobytes are a bit different: Mirobo: 21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
Hmmm, interesting. Now I'm curious what the official app does. That difference there could be explained by some sort of a flag, which used to work / works in some cases but not in others, iirc I extracted the handshake from the communication of my vacuum.. @nutinshell could you try changing the hello bytes to see if that helps? If yes, maybe we need to adjust that procedure. |
sure, should I email you directly? :) |
Yes! basti at linkt.de |
change hello bytes not help, in wireshark, it seems miio seeds same hello bytes 21310020 |
Sent :D |
@nutinshell could you try to run |
OK here is the result:
|
The request was something like this:
Could you give it a try? |
@syssi OK
|
A pity. It doesn't help. |
@syssi @rytilahti I finally found the problem, change https://github.com/rytilahti/python-mirobo/blob/adfa737579f75fb09446a99a6e43775bca293358/mirobo/device.py#L140 To work with water purifier: 1, send a broadcast first; 2, then the IP of request machine free to send any raw command(I still don't know is it forever) P.S. Another issue, when I send raw_command like |
Do you know which properties are supported? |
known currently: ["press","temperature","uv_state","filter_state","elecval_state","uv_life","mode"] |
@nutinshell awesome! So, a broadcast is necessary (and the default "handshake" only on that device is not enoguh) even after you modified the flooding of those requests, if I understood it correctly? IIRC there was no specific reason why I decided to make it send three packets, only "just to be sure they will go through". Maybe this also causes the problem some people are having with the vacuum not answering to discoveries always.. As a side note, different manufacturers have different kind of implementations. E.g. the vacuum cleaner does not advertise over mDNS if the device has no connectivity to the internet. @syssi I recall philips ones did not either, are yours connected to the internet? |
My philips light has internet access. It doesn't advertise over mDNS nevertheless. |
It appears so, have to do |
I will try to write some proof of concept code tomorrow. |
@nutinshell Sorry I need to ask again: Are you sure about the need of |
No, only need to do it one time for the new machine. |
Got it: If you "reboot" your water purifier and call |
@syssi after reboot, it still works. I did lot of successful tests after a sleep :) |
Is this still an issue? If not, please close this. |
@rytilahti latest mirobo cli still failed, compare to JS miio working fine. |
Cp. #284. We should request all properties by |
hello, it's working with miio command like:
miio --control 10.0.1.8 --token a3d7f95***3 --method get_prop
, has working data output, but usingmirobo --ip 10.0.1.8 --token a3d7f95***3 -d info
failed with error:Any idea to get water purifier working? Thanks.
The text was updated successfully, but these errors were encountered: