Skip to content
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

Send multiple params broken result #73

Closed
nutinshell opened this issue Sep 11, 2017 · 13 comments
Closed

Send multiple params broken result #73

nutinshell opened this issue Sep 11, 2017 · 13 comments
Labels

Comments

@nutinshell
Copy link

Send multiple params to water purifier like raw_command get_prop '["press","mode"]', the result always broken like [300, 'error'], only first one is right, no matter how much params sent.

https://github.com/aholstenson/miio/ cli works well.

Capture shows very different behavior with mirobo, below is a single command --method get_prop --params '["press","temperature"]' :

 ->  10.0.1.9 data= {"id":1,"method":"miIO.info","params":[]}
 <-  10.0.1.8 data= {"result":{"life":30300,"token":"a3d7f9****683","mac":"28***:03","fw_ver":"1.2.8","hw_ver":"ESP8266","model":"yunmi.waterpuri.v2","mcu_fw_ver":"0019","wifi_fw_ver":"1.4.0(30e0bd0)","ap":{"rssi":-58,"ssid":"Deep Space Voyager","bssid":"00***:A1"},"netif":{"localIp":"10.0.1.8","mask":"255.255.0.0","gw":"10.0.0.15"},"mmfree":10256},"id":1}
 ->  10.0.1.9 data= N/A
 <-  10.0.1.8 data= N/A
 ->  10.0.1.9 data= {"id":1,"method":"get_prop","params":["press","temperature"]}
 <-  10.0.1.8 data= {"result":{"life":30300,"token":"a3d7f9****683","mac":"28***:03","fw_ver":"1.2.8","hw_ver":"ESP8266","model":"yunmi.waterpuri.v2","mcu_fw_ver":"0019","wifi_fw_ver":"1.4.0(30e0bd0)","ap":{"rssi":-58,"ssid":"Deep Space Voyager","bssid":"00***:A1"},"netif":{"localIp":"10.0.1.8","mask":"255.255.0.0","gw":"10.0.0.15"},"mmfree":10256},"id":1}
 ->  10.0.1.9 data= {"id":1,"method":"get_prop","params":["press","temperature"]}
 <-  10.0.1.8 data= {"result":[300,29],"id":1}

any idea?

@rytilahti
Copy link
Owner

Could you please post also the same mirobo command with -d and check out if the JSON payloads differ?

@nutinshell
Copy link
Author

Could you please post also the same mirobo command with -d and check out if the JSON payloads differ?

hi @rytilahti it's like:

INFO:mirobo.vacuum_cli:Debug mode active
DEBUG:mirobo.vacuum_cli:Read stored sequence ids: {'seq': 3, 'manual_seq': 0}
DEBUG:mirobo.vacuum_cli:Connecting to 10.0.1.8 with token a3d7****3
Sending cmd get_prop with params ['press', 'mode']
DEBUG:mirobo.protocol:Unable to decrypt, returning raw bytes.
DEBUG:mirobo.device:Got a response: Container: 
    data = Container: 
        data =  (total 0)
        value =  (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = !1\x00 \x00\x00\x00\x00\x02\xf6Y\x18\x00\x01l1 (total 16)
        value = Container: 
            length = 32
            unknown = 0
            devtype = 758
            serial = 22808
            ts = 1970-01-02 01:53:53
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = \xa3\xd7\xf9W\xb6\x83\xbe\xe6\xe7\x89\xf17\xb7c\xe6\x83 (total 16)
DEBUG:mirobo.device:Discovered 758 22808 with ts: 1970-01-02 01:53:53, token: b'a3d7****3'
DEBUG:mirobo.device:10.0.1.8:54321 >>: {'id': 4, 'method': 'get_prop', 'params': ['press', 'mode']}
DEBUG:mirobo.device:10.0.1.8:54321 (ts: 1970-01-02 01:53:53, id: 4) << {'result': [410, 'error'], 'id': 4}
[410, 'error']
DEBUG:mirobo.vacuum_cli:Writing {'seq': 4, 'manual_seq': 0} to /tmp/python-mirobo.seq

@rytilahti
Copy link
Owner

The first one requests 'press' and 'temperature' whereas the mirobo one does it for 'press' and 'mode'. Could you please check if it works with 'press' and 'temperature', maybe the error is coming from an unknown property?

Another thing to try out is to make that info query before invoking the request (maybe the device uses that as a sort of a handshake?).

@nutinshell
Copy link
Author

The first one requests 'press' and 'temperature' whereas the mirobo one does it for 'press' and 'mode'. Could you please check if it works with 'press' and 'temperature', maybe the error is coming from an unknown property?

I said it in very first, JSmiio works fine, all properties known.

Another thing to try out is to make that info query before invoking the request (maybe the device uses that as a sort of a handshake?).

Tested, no luck.

@rytilahti
Copy link
Owner

Ok, so it must be something else then. Could it be related to the flood protection (if we are sending the commands too fast after that completed handshake?), or that id is not being incremented for the js miio?

It is a bit odd that in the js output the get_prop is called twice, first return value being the output of device info and just after that the real result.

@syssi syssi added the bug label Sep 14, 2017
@syssi
Copy link
Collaborator

syssi commented Sep 14, 2017

Could you provide a traffic capture (miioJs vs. mirobo) again? It's easier to verify.

@nutinshell
Copy link
Author

@syssi let me email you :)

@syssi
Copy link
Collaborator

syssi commented Sep 16, 2017

I must admin I lost your mail if you sent one.

@nutinshell
Copy link
Author

@syssi hi, I just resent it again :)

@lukezzz
Copy link

lukezzz commented Nov 7, 2018

Had the bug fixed? I got the same issue:
k.raw_command('get_prop', ['tds','time'])
[11, 'error']

@syssi
Copy link
Collaborator

syssi commented Nov 7, 2018

Does it work if you request "time" only?

@lukezzz
Copy link

lukezzz commented Nov 7, 2018

@syssi,

Tried with Python-miio:

k.raw_command('get_prop', ['tds','time'])
 [32, 'error']

 k.raw_command('get_prop', ['tds'])
 [32]

 k.raw_command('get_prop', ['time'])
 [1541583582]

If I use the js miio tools, I can get the result without error:

root@raspberrypi:/home/pi# miio protocol call 192.168.98.105 get_prop '["tds","time"]'
 INFO  Attempting to call get_prop on 192.168.98.105

 INFO  Device found, making call

 INFO  Got result:
[
  32,
  1541583712
]

syssi added a commit to syssi/python-miio that referenced this issue Nov 7, 2018
@syssi syssi closed this as completed in 1a71485 Nov 7, 2018
@lukezzz
Copy link

lukezzz commented Nov 7, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants