python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

Support for viomi.vacuum.v18 (Viomi Robot Vacuum S9)

Open jonasbark opened this issue 3 years ago • 10 comments

Describe the solution you'd like Support for the mentioned vacuum device

Device information: If the enhancement is device-specific, please include also the following information.

  • Name(s) of the device: Viomi Robot Vacuum S9

Use miiocli device --ip <ip address> --token <token>.

Model: viomi.vacuum.v18 Hardware version: Linux Firmware version: 1.2.0_2192

Additional context I'm always receiving timeouts when using e.g. miiocli viomivacuum --ip 192.168.0.145 --token *** info I increased the timeout but no luck. None of the requests work - I tried 4 different WIFIs without any change.

Interestingly a similar response happens with the Xiaomi Cloud API (using OpenHAB) - all the requests will result in e.g.

{"code":-3,"error":{"code":-3,"message":"timeout"},"id":5,"message":"timeout","otlocalts":1611060756356848}

or

{"code":-9999,"error":{"code":-9999,"message":"user ack timeout"},"id":8,"message":"user ack timeout","otlocalts":1611060790397708}

responses.

The Xiaomi Home app works however using local network or remotely - I'm still puzzled how.

INFO:miio.cli:Debug mode active
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x13\xa2\x8c\x08`\x074\x11' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('13a28c08')
            ts = 2021-01-19 19:33:37
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocol:Discovered 13a28c08 with ts: 2021-01-19 19:33:37, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.0.145:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:192.168.0.145:54321 (ts: 2021-01-19 19:33:37, id: 1) << {'partner_id': '', 'id': 1, 'code': 0, 'message': 'ok', 'result': {'hw_ver': 'Linux', 'fw_ver': '1.2.0_2192', 'ap': {'ssid': 'Turmbraeu', 'bssid': 'd4:3f:cb:88:5c:28', 'freq': '2412', 'rssi': '-58'}, 'sn': '10109000001349', 'netif': {'localIp': '192.168.0.145', 'mask': '255.255.255.0', 'gw': '192.168.0.1'}, 'miio_ver': 'miio-client 3.5.5', 'model': 'viomi.vacuum.v18', 'mac': '64:90:c1:6f:6e:1b', 'token': '776b6e3548635069325737444533326d', 'life': 30154}}

jonasbark avatar Jan 19 '21 18:01 jonasbark

/miotspec/* cloud api, however it should work with local miio api (using miot cmds) same as other viomi robots.

rezmus avatar Jan 20 '21 07:01 rezmus

I still had no luck locally - https://github.com/openhab/openhab-addons/pull/9878 hinted me that it might be a cloud only device.

jonasbark avatar Jan 20 '21 08:01 jonasbark

while many new devices force cloud way to talk to device, they should still work fine via local api. i remember many viomi models had issues with local api. ppl made some workarounds to resend command multiple times or something with cmd id generation. try to dig into old issues. i'm pretty sure i talked to v18 via remote rpc api when my friend had one.

rezmus avatar Jan 20 '21 08:01 rezmus

> {"method":"miIO.info","params":[],"id":4254}
< {"code":0,"id":4254,"message":"ok","partner_id":"","result":{"ap":{"bssid":"28:d1:27:xx:xx:xx","freq":"2412","rssi":"-51","ssid":"T-Mobile-B528-XXXX"},"fw_ver":"1.2.0_2192","hw_ver":"Linux","life":791124,"mac":"64:90:c1:xx:xx:xx","miio_ver":"miio-client 3.5.5","model":"viomi.vacuum.v18","netif":{"gw":"192.168.31.1","localIp":"192.168.31.xx","mask":"255.255.255.0"},"sn":"101603000xxxxx","token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}

> {"method":"get_properties","params":[{"did":"X","siid":8,"piid":4}],"id":4258}
< {"code":0,"id":4258,"result":[{"code":0,"did":"X","piid":4,"siid":8,"value":"girl_zh"}]}

rezmus avatar Jan 20 '21 10:01 rezmus

You're right indeed. I'm getting responses. I'll dig in deeper.

jonasbark avatar Jan 20 '21 10:01 jonasbark

Hi everyone and @jonasbark Did you get anywhere with Viomi S9?

fokcuk avatar Jun 24 '21 13:06 fokcuk

I got mine to work locally but after some time it stops responding and give the 9999 error. After a factory reset and repair it'll work locally again, but only for a while

blakadder avatar Jul 04 '21 22:07 blakadder

I gave up on local control and just using cloud one. 9999 error usually means cloud only command. I can do basic controls as local but zone cleaning is cloud only it seems

fokcuk avatar Jul 04 '21 23:07 fokcuk

@fokcuk how are you using it with the cloud? Is it integratable with Hass?

r3pek avatar Dec 29 '21 08:12 r3pek

https://github.com/ha0y/xiaomi_miot_raw/issues/169

blakadder avatar Dec 29 '21 08:12 blakadder