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

Please help with XIAOMI O'WS Temperature Electric Towel Rack MJ120

Open Kirmas opened this issue 3 years ago • 9 comments

Device information:

  • Name(s) of the device: XIAOMI O'WS Temperature Electric Towel Rack MJ120
  • Link: https://www.aliexpress.com/i/1005001463369274.html - Is it ok? I have no idea how to find something more official

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

  • Model: ows.towel_w.mj1x0
  • Hardware version: esp8266
  • Firmware version: 2.0.7

Additional context https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:towel-rack:0000A09A:ows-mj1x0:1 - but all trying to send miot command returns {'code': -9999, 'message': 'user ack timeout'} error Command that works for me:

command value info
set_mode "0-3" 0: 'dry', 1: 'warn', 2: 'antifreeze', 3: 'programming';
set_power "0-1" 0: off, 1: on
set_tempdry "80-120" x/2 - if I send 80 my device set 40 degrees of celsius i have no idea why.
set_tempheat "40-60" x/2

set_tempdry and set_tempheat work only if mi home app is closed.

And now main problem all mi trying to get any property from device is failed.

miiocli device --ip <ip address> --token <token> test_properties mode power tempdry tempheat
Running command test_properties
Testing properties ('mode', 'power', 'tempdry', 'tempheat') for ows.towel_w.mj1x0
Testing mode       WARNING:miio.device:Unable to request mode: {'code': -9999, 'message': 'user ack timeout'}
Testing power      WARNING:miio.device:Unable to request power: {'code': -9999, 'message': 'user ack timeout'}
Testing tempdry    WARNING:miio.device:Unable to request tempdry: {'code': -9999, 'message': 'user ack timeout'}
Testing tempheat   WARNING:miio.device:Unable to request tempheat: {'code': -9999, 'message': 'user ack timeout'}
Found 0 valid properties, testing max_properties..

Please copy the results below to your report
### Results ###
Model: ows.towel_w.mj1x0
Total responsives: 0
Total non-empty: 0
All non-empty properties:
{}
Max properties: -1
Done

I found integration for node js https://github.com/maxinminax/node-mihome/blob/master/lib/devices/ows.towel_w.mj1x0.js but it failing on get property too.

Maybe someone have some idea what I can to do to get this information from the device.

One more strange sing: I was trying to sniff the traffic and have a lot of data sent from :54321 to the 120.92.65.253:8053 this data is 160 or 192 length. But I cannot decode it using my token, maybe some one know how xiaomi encode data for cloud.

Kirmas avatar Jun 06 '21 08:06 Kirmas

not miotspec device, so spec is useless here (unless you want to send cmds via cloud). use get_props (not get_prop) method, no params. it returns something like in this list

"prop.power_set", "prop.mode_set", "prop.tempdry_set", "prop.tempheat_set", "prop.temprog_set", "prop.drytime_set", "prop.percent_get", "prop.tempind_get", "prop.tempsurf_get"

device <> cloud is encoded same way, but with cloud key rather than token. in short, you can't dump it.

rezmus avatar Jun 06 '21 18:06 rezmus

not miotspec device, so spec is useless here (unless you want to send cmds via cloud). use get_props (not get_prop) method, no params. it returns something like in this list

"prop.power_set", "prop.mode_set", "prop.tempdry_set", "prop.tempheat_set", "prop.temprog_set", "prop.drytime_set", "prop.percent_get", "prop.tempind_get", "prop.tempsurf_get"

device <> cloud is encoded same way, but with cloud key rather than token. in short, you can't dump it.

get_props is working. A lot of thanks.

Kirmas avatar Jun 06 '21 23:06 Kirmas

More for future me or some one else who will add this device. ( In this time I want to finished with Yeelight lamps, and only after this start to add something else.)

command value info
set_mode "0-3" 0: 'dry', 1: 'warn', 2: 'antifreeze', 3: 'programming';
set_power "0-1" 0: off, 1: on
set_tempdry "80-120" x/2
set_tempheat "40-60" x/2
set_drytime "1-24" -
get_props [1, 3, 120, 44, 24, 49164, 63, 58, 0, 0] [0]=power; [1]=mode; [2]=tempdry * 2; [3]=tempheat * 2; [4]=drytime; [5]=Setting hours (a[i+1] = a[I] * 2); [6]=tempsurf * 2; [7]=temperature * 2; [8]=power % 0-100; [9]=0;

I still don't know what is last zero property [9]. And how to set property number 5(In app this is dry hour for programming mode), as for me this is not very important, but would be cool know all :)

Kirmas avatar Jun 07 '21 09:06 Kirmas

hass-xiaomi-miot support it in commit: https://github.com/al-one/hass-xiaomi-miot/commit/9cabe103929a9946ea4f2493f7d17eb5eccfb7b2

al-one avatar Sep 11 '21 07:09 al-one

Hi everyone! I'm trying to connect to my towel rack get_props and set_power "0" work perfectly, but set_power "1" doesn't switch on my rack I can hear signal with miiocli device --ip IP --token TOKEN raw_command set_power "1", but rack is still switched off Probably it needs more parameters to start working? @al-one @Kirmas @rezmus probably could someone please say why ?

pavlovalexey92 avatar Nov 05 '21 18:11 pavlovalexey92

Hi everyone! I'm trying to connect to my towel rack get_props and set_power "0" work perfectly, but set_power "1" doesn't switch on my rack I can hear signal with miiocli device --ip IP --token TOKEN raw_command set_power "1", but rack is still switched off Probably it needs more parameters to start working? @al-one @Kirmas @rezmus probably could someone please say why ?

Is your mi home app was closed when you tried? When i tried it was important. Because app switch device back

Kirmas avatar Nov 05 '21 19:11 Kirmas

Hi everyone! I'm trying to connect to my towel rack get_props and set_power "0" work perfectly, but set_power "1" doesn't switch on my rack I can hear signal with miiocli device --ip IP --token TOKEN raw_command set_power "1", but rack is still switched off Probably it needs more parameters to start working? @al-one @Kirmas @rezmus probably could someone please say why ?

Is your mi home app was closed when you tried? When i tried it was important. Because app switch device back

Yes, I turned off internet at all Probably I have another firmware version

INFO:miio.cli:Debug mode active
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\x0e\x8b\xd5\x0f\x00t\x9dL' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('0e8bd50f')
            ts = 1970-03-30 10:54:04
        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 0e8bd50f with ts: 1970-03-30 10:54:04, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.1.160:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:192.168.1.160:54321 (ts: 1970-03-30 10:54:04, id: 1) << {'id': 1, 'result': {'life': 7642444, 'uid': 1596027149, 'model': 'ows.towel_w.mj1x0', 'token': '', 'ipflag': 1, 'fw_ver': '2.0.7', 'mcu_fw_ver': '0004', 'miio_ver': '0.0.8', 'hw_ver': 'esp8266', 'mmfree': 19880, 'mac': '64:90:C1:B9:03:8F', 'wifi_fw_ver': '2709610', 'ap': {'ssid': 'Xiaomi', 'bssid': '50:64:2B:4C:E6:76', 'rssi': -42, 'primary': 11}, 'netif': {'localIp': '192.168.1.160', 'mask': '255.255.255.0', 'gw': '192.168.1.1'}}, 'exe_time': 34}
Model: ows.towel_w.mj1x0
Hardware version: esp8266
Firmware version: 2.0.7

I don't know how to make it work =(

pavlovalexey92 avatar Nov 06 '21 11:11 pavlovalexey92

Okay, I managed to sniff this

<-  192.168.1.160 data= N/A
<-  192.168.1.160 data= N/A
->  192.168.1.186 data= N/A
<-  192.168.1.160 data= N/A
->  192.168.1.186 data= {"id":3350,"method":"get_props","params":[]}
<-  192.168.1.160 data= {"id":3350,"result":[1,0,90,40,1,16777215,56,52,100,0],"exe_time":254}
->  192.168.1.186 data= {"id":3351,"method":"get_props","params":[]}
<-  192.168.1.160 data= {"id":3351,"result":[1,0,90,40,1,16777215,57,52,100,0],"exe_time":214}
->  192.168.1.186 data= N/A
<-  192.168.1.160 data= N/A
->  192.168.1.186 data= {"id":3353,"method":"set_power","params":[0]}
<-  192.168.1.160 data= {"id":3353,"result":[0],"exe_time":244}
->  192.168.1.186 data= {"id":3354,"method":"set_power","params":[1]}
<-  192.168.1.160 data= {"id":3354,"result":[1],"exe_time":84}

Strange that miiocli device --ip 192.168.1.160 --token token raw_command set_power 1 doesn't work for me @rezmus any ideas?

pavlovalexey92 avatar Nov 06 '21 13:11 pavlovalexey92

Thanks all I had to send set_power [1] Space between command and parameter makes sense Thanks a lot @Kirmas

pavlovalexey92 avatar Nov 06 '21 21:11 pavlovalexey92