Closed uzlonewolf closed 1 year ago
Ugh, I now want to do some packet captures with non-gateway devices to try and figure out that protocol thing before going forward with this. Marking as 'draft' again.
Okay, I created a new 'tools' directory and uploaded my pcap parser to it. It still needs a bunch of documentation and probably won't work with v3.1 devices, but v3.3 and v3.4 devices work great. Call with python pcap_parse.py -h
to get the argument list.
I was debating stripping the "version protocol" header out but ultimately decided to leave it in, and it's a good thing I did! Turns out, the protocol: N
is only added to the payload when the "version protocol" header is included. Eyeballing the data in that header, protocol:4 appears to match up with what v3.3 devices send while protocol:5 seems to be new.
Results from a pcap of the Smart Life app talking to various devices:
python3 pcap_parse.py -d ../devices.json -z -s lw-2.pcap | sort | while read line; do echo "${line:0:4}######${line:20}" ; done
eb0b######kn 0010 0000 172.20.10.155:6668_172.20.10.64:54018
eb0b######kn 0010 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb0b######kn 0010 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb0b######kn 0010 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb0b######kn 0010 0004 to cmd: 16 (10) v3.4 len(16) {}
eb0b######kn 0010 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb0b######kn 0010 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":true,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb0d######ms 0013 0000 172.20.10.79:6668_172.20.10.64:57566
eb0d######ms 0013 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb0d######ms 0013 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb0d######ms 0013 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb0d######ms 0013 0004 to cmd: 16 (10) v3.4 len(16) {}
eb0d######ms 0013 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb0d######ms 0013 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":true,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb19######hm 0007 0000 172.20.10.117:6668_172.20.10.64:51734
eb19######hm 0007 0001 to cmd: 16 (10) v3.3 len(16) {}
eb19######hm 0007 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb19######hm 0007 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":100,"23":991,"24":"002103af0071","25":"000e0d0000000000000000c80000","26":0}}
eb2a######lv 0019 0000 172.20.10.164:6668_172.20.10.64:50526
eb2a######lv 0019 0001 to cmd: 16 (10) v3.3 len(16) {}
eb2a######lv 0019 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb2a######lv 0019 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":750,"23":278,"24":"00f003e803e8","25":"08000000001e0320012c00000000","26":0}}
eb2a######lv 0019 0016 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x04x00rxfek{"dps":{"20":true}}'
eb2a######lv 0019 0017 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00x9cxb0x00x00x00x01{"dps":{"20":true},"t":1679490133}'
eb2a######lv 0019 0019 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x05x00rxfek{"dps":{"20":false}}'
eb2a######lv 0019 0020 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00x9cxb1x00x00x00x01{"dps":{"20":false},"t":1679490135}'
eb34######ni 0012 0000 172.20.10.88:6668_172.20.10.64:52540
eb34######ni 0012 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb34######ni 0012 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb34######ni 0012 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb34######ni 0012 0004 to cmd: 16 (10) v3.4 len(16) {}
eb34######ni 0012 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb34######ni 0012 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb51######py 0024 0000 172.20.10.150:6668_172.20.10.64:38534
eb51######py 0024 0001 to cmd: 16 (10) v3.3 len(16) {}
eb51######py 0024 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb51######py 0024 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":750,"23":278,"24":"00f003e803e8","25":"000e0d0000000000000000c80000","26":0}}
eb52######k7 0011 0000 172.20.10.52:6668_172.20.10.64:59626
eb52######k7 0011 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb52######k7 0011 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb52######k7 0011 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb52######k7 0011 0004 to cmd: 16 (10) v3.4 len(16) {}
eb52######k7 0011 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb52######k7 0011 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb52######k7 0011 0025 to cmd: 18 (12) v3.4 len(32) {"dpId":[9,10,11,12]}
eb52######k7 0011 0026 to cmd: 18 (12) v3.4 len(32) {"dpId":[9,10,11,12]}
eb52######k7 0011 0030 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x06x00x06x15xff{"data":{"dps":{"2":true}},"protocol":5,"t":1679490168}'
eb52######k7 0011 0032 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxb9x00x00x00x01{"protocol":4,"t":1679490169,"data":{"dps":{"2":true}}}'
eb52######k7 0011 0033 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x06x15xff{"data":{"dps":{"2":false}},"protocol":5,"t":1679490169}'
eb52######k7 0011 0034 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x06x15xff{"data":{"dps":{"2":false}},"protocol":5,"t":1679490169}'
eb52######k7 0011 0036 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbax00x00x00x01{"protocol":4,"t":1679490170,"data":{"dps":{"2":false}}}'
eb52######k7 0011 0037 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00x08x00x06x15xff{"data":{"dps":{"1":true,"2":true,"3":true,"4":true}},"protocol":5,"t":1679490173}'
eb52######k7 0011 0039 from cmd: 8 (08) v3.4 len(96) b'3.4x00x00x00x00x00x00xefxbbx00x00x00x01{"protocol":4,"t":1679490174,"data":{"dps":{"2":true,"3":true,"4":true}}}'
eb52######k7 0011 0040 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbcx00x00x00x01{"protocol":4,"t":1679490174,"data":{"dps":{"1":true}}}'
eb52######k7 0011 0041 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00tx00x06x15xff{"data":{"dps":{"1":false,"2":false,"3":false,"4":false}},"protocol":5,"t":1679490174}'
eb52######k7 0011 0043 from cmd: 8 (08) v3.4 len(112) b'3.4x00x00x00x00x00x00xefxbdx00x00x00x01{"protocol":4,"t":1679490175,"data":{"dps":{"1":false,"2":false,"3":false,"4":false}}}'
eb66######7x 0017 0000 172.20.10.145:6668_172.20.10.64:36106
eb66######7x 0017 0001 to cmd: 16 (10) v3.3 len(16) {}
eb66######7x 0017 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb66######7x 0017 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":750,"23":278,"24":"00f003e803e8","25":"000e0d0000000000000000c80000","26":0}}
eb66######7x 0017 0014 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x04x00x07T"{"dps":{"20":true}}'
eb66######7x 0017 0015 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00xd5xf3x00x00x00x01{"dps":{"20":true},"t":1679490125}'
eb66######7x 0017 0019 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x05x00x07T"{"dps":{"20":false}}'
eb66######7x 0017 0020 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00xd5xf4x00x00x00x01{"dps":{"20":false},"t":1679490128}'
eb67######jn 0020 0000 172.20.10.57:6668_172.20.10.64:48036
eb67######jn 0020 0001 to cmd: 16 (10) v3.3 len(16) {}
eb67######jn 0020 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb67######jn 0020 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":750,"23":278,"24":"00f003e803e8","25":"000e0d0000000000000000c80000","26":0}}
eb67######jn 0020 0012 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x04x00x08x87,{"dps":{"20":true}}'
eb67######jn 0020 0013 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x008xe9x00x00x00x01{"dps":{"20":true},"t":1679490109}'
eb67######jn 0020 0017 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x05x00x08x87,{"dps":{"20":false}}'
eb67######jn 0020 0018 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x008xeax00x00x00x01{"dps":{"20":false},"t":1679490120}'
eb6e######ct 0004 0000 172.20.10.102:6668_172.20.10.64:41352
eb6e######ct 0004 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb6e######ct 0004 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb6e######ct 0004 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb6e######ct 0004 0004 to cmd: 16 (10) v3.4 len(16) {}
eb6e######ct 0004 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb6e######ct 0004 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb73######nr 0009 0000 172.20.10.125:6668_172.20.10.64:35974
eb73######nr 0009 0001 to cmd: 16 (10) v3.3 len(16) {}
eb73######nr 0009 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb73######nr 0009 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":1000,"23":0,"24":"015c004b000a","25":"000e0d0000000000000000c80000","26":0}}
eb7e######rx 0002 0000 172.20.10.149:6668_172.20.10.64:39044
eb7e######rx 0002 0001 to cmd: 16 (10) v3.3 len(16) {}
eb7e######rx 0002 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb7e######rx 0002 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":170,"23":182,"24":"0025036e009b","25":"000e0d0000000000000000c80000","26":0}}
eb82######it 0006 0000 172.20.10.61:6668_172.20.10.64:57044
eb82######it 0006 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
eb82######it 0006 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
eb82######it 0006 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
eb82######it 0006 0004 to cmd: 16 (10) v3.4 len(16) {}
eb82######it 0006 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb82######it 0006 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
eb82######it 0006 0023 to cmd: 18 (12) v3.4 len(32) {"dpId":[9,10,11,12]}
eb82######it 0006 0025 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x06x00x04x18x9c{"data":{"dps":{"1":true}},"protocol":5,"t":1679490149}'
eb82######it 0006 0027 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbex00x00x00x01{"protocol":4,"t":1679490149,"data":{"dps":{"1":true}}}'
eb82######it 0006 0028 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x04x18x9c{"data":{"dps":{"1":false}},"protocol":5,"t":1679490150}'
eb82######it 0006 0030 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbfx00x00x00x01{"protocol":4,"t":1679490150,"data":{"dps":{"1":false}}}'
eb82######it 0006 0031 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x08x00x04x18x9c{"data":{"dps":{"2":true}},"protocol":5,"t":1679490150}'
eb82######it 0006 0033 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc0x00x00x00x01{"protocol":4,"t":1679490151,"data":{"dps":{"2":true}}}'
eb82######it 0006 0034 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00tx00x04x18x9c{"data":{"dps":{"2":false}},"protocol":5,"t":1679490151}'
eb82######it 0006 0036 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc1x00x00x00x01{"protocol":4,"t":1679490152,"data":{"dps":{"2":false}}}'
eb82######it 0006 0037 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00nx00x04x18x9c{"data":{"dps":{"3":true}},"protocol":5,"t":1679490152}'
eb82######it 0006 0039 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc2x00x00x00x01{"protocol":4,"t":1679490153,"data":{"dps":{"3":true}}}'
eb82######it 0006 0040 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0bx00x04x18x9c{"data":{"dps":{"4":true}},"protocol":5,"t":1679490152}'
eb82######it 0006 0042 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc3x00x00x00x01{"protocol":4,"t":1679490153,"data":{"dps":{"4":true}}}'
eb82######it 0006 0043 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0cx00x04x18x9c{"data":{"dps":{"3":false}},"protocol":5,"t":1679490153}'
eb82######it 0006 0045 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc4x00x00x00x01{"protocol":4,"t":1679490154,"data":{"dps":{"3":false}}}'
eb82######it 0006 0046 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00rx00x04x18x9c{"data":{"dps":{"4":false}},"protocol":5,"t":1679490154}'
eb82######it 0006 0048 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc5x00x00x00x01{"protocol":4,"t":1679490154,"data":{"dps":{"4":false}}}'
eb82######it 0006 0049 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0ex00x04x18x9c{"data":{"dps":{"4":true}},"protocol":5,"t":1679490154}'
eb82######it 0006 0052 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc6x00x00x00x01{"protocol":4,"t":1679490155,"data":{"dps":{"4":true}}}'
eb82######it 0006 0054 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0fx00x04x18x9c{"data":{"dps":{"1":true}},"protocol":5,"t":1679490155}'
eb82######it 0006 0056 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc7x00x00x00x01{"protocol":4,"t":1679490155,"data":{"dps":{"1":true}}}'
eb82######it 0006 0057 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x10x00x04x18x9c{"data":{"dps":{"2":true}},"protocol":5,"t":1679490155}'
eb82######it 0006 0059 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc8x00x00x00x01{"protocol":4,"t":1679490156,"data":{"dps":{"2":true}}}'
eb82######it 0006 0060 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x11x00x04x18x9c{"data":{"dps":{"3":true}},"protocol":5,"t":1679490156}'
eb82######it 0006 0062 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc9x00x00x00x01{"protocol":4,"t":1679490156,"data":{"dps":{"3":true}}}'
eb82######it 0006 0063 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00x12x00x04x18x9c{"data":{"dps":{"1":false,"2":false,"3":false,"4":false}},"protocol":5,"t":1679490159}'
eb82######it 0006 0065 from cmd: 8 (08) v3.4 len(96) b'3.4x00x00x00x00x00x00xefxcax00x00x00x01{"protocol":4,"t":1679490160,"data":{"dps":{"2":false,"3":false,"4":false}}}'
eb82######it 0006 0066 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxcbx00x00x00x01{"protocol":4,"t":1679490160,"data":{"dps":{"1":false}}}'
eb8b######vq 0025 0000 172.20.10.70:6668_172.20.10.64:41360
eb8b######vq 0025 0001 to cmd: 16 (10) v3.3 len(16) {}
eb8b######vq 0025 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb8b######vq 0025 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":913,"23":0,"24":"012e039801a1","25":"000e0d0000000000000000c80000","26":0}}
eb9f######59 0015 0000 172.20.10.179:6668_172.20.10.64:50596
eb9f######59 0015 0001 to cmd: 16 (10) v3.3 len(16) {}
eb9f######59 0015 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eb9f######59 0015 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":1000,"23":0,"24":"006a01bb0092","25":"000e0d0000000000000000c80000","26":0}}
eba4######pl 0005 0000 172.20.10.83:6668_172.20.10.64:57148
eba4######pl 0005 0001 to cmd: 16 (10) v3.3 len(16) {}
eba4######pl 0005 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
eba4######pl 0005 0003 from cmd: 16 (10) v3.3 len(256) {"dps":{"20":false,"21":"white","22":281,"23":0,"24":"001103e8000a","25":"25464601011303e803e800000000464602000003e803e800000000464602003d03e803e8000000004646010154032003e8000000004646010140032003e800000000464601001e02ee03e800000000","26":0}}
ebb7######pe 0014 0000 172.20.10.186:6668_172.20.10.64:44572
ebb7######pe 0014 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
ebb7######pe 0014 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
ebb7######pe 0014 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
ebb7######pe 0014 0004 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebb7######pe 0014 0005 to cmd: 16 (10) v3.4 len(16) {}
ebb7######pe 0014 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
ebcb######qi 0023 0000 172.20.10.97:6668_172.20.10.64:46748
ebcb######qi 0023 0001 to cmd: 16 (10) v3.3 len(16) {}
ebcb######qi 0023 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebcb######qi 0023 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":1000,"23":573,"24":"003c02850014","25":"000e0d0000000000000000c80000","26":0}}
ebd3######q2 0021 0000 172.20.10.176:6668_172.20.10.64:58888
ebd3######q2 0021 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
ebd3######q2 0021 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
ebd3######q2 0021 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
ebd3######q2 0021 0004 to cmd: 16 (10) v3.4 len(16) {}
ebd3######q2 0021 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebd3######q2 0021 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
ebd8######vf 0001 0000 172.20.10.81:6668_172.20.10.64:38210
ebd8######vf 0001 0001 to cmd: 3 (03) v3.4 len(32) <Negotiate Session Key Step 1>
ebd8######vf 0001 0002 from cmd: 4 (04) v3.4 len(64) <Negotiate Session Key Step 2> session key step 2 HMAC verify OK!
ebd8######vf 0001 0003 to cmd: 5 (05) v3.4 len(48) <Negotiate Session Key Step 3> session key step 3 HMAC verify OK!
ebd8######vf 0001 0004 to cmd: 16 (10) v3.4 len(16) {}
ebd8######vf 0001 0005 to cmd: 64 (40) v3.4 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebd8######vf 0001 0006 from cmd: 16 (10) v3.4 len(128) {"dps":{"1":false,"2":false,"3":false,"4":false,"9":0,"10":0,"11":0,"12":0,"38":"off","42":"","43":"","44":"","47":"sync"}}
ebd8######qm 0003 0000 172.20.10.143:6668_172.20.10.64:59336
ebd8######qm 0003 0001 to cmd: 16 (10) v3.3 len(16) {}
ebd8######qm 0003 0002 from cmd: 16 (10) v3.3 len(80) {"dps":{"1":true,"2":"white","3":25,"4":0,"5":"ff00000000ffff"}}
ebd8######qm 0003 0003 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebd9######19 0026 0000 172.20.10.55:6668_172.20.10.64:56714
ebd9######19 0026 0001 to cmd: 16 (10) v3.3 len(16) {}
ebd9######19 0026 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebd9######19 0026 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":true,"21":"colour","22":302,"23":0,"24":"016003e803e8","25":"000e0d0000000000000000c80000","26":0}}
ebed######ue 0008 0000 172.20.10.77:6668_172.20.10.64:36642
ebed######ue 0008 0001 to cmd: 16 (10) v3.3 len(16) {}
ebed######ue 0008 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebed######ue 0008 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":861,"23":0,"24":"007803e8000a","25":"000e0d0000000000000000c80000","26":0}}
ebf0######xj 0022 0000 172.20.10.135:6668_172.20.10.64:57832
ebf0######xj 0022 0001 to cmd: 16 (10) v3.3 len(16) {}
ebf0######xj 0022 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebf0######xj 0022 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":750,"23":278,"24":"00f003e803e8","25":"000e0d0000000000000000c80000","26":0}}
ebf1######hx 0016 0000 172.20.10.181:6668_172.20.10.64:60438
ebf1######hx 0016 0001 to cmd: 16 (10) v3.3 len(16) {}
ebf1######hx 0016 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebf1######hx 0016 0003 from cmd: 16 (10) v3.3 len(224) {"dps":{"2":"heat","16":1850,"17":65,"23":"f","24":1850,"29":65,"34":55,"45":0,"107":"4","108":2450,"109":1850,"110":76,"111":65,"115":"on","116":"1","119":true,"120":"followschedule","123":15,"129":"fanon"}}
ebf1######hx 0016 0008 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxdcx00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLEAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPHgEKAQddAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHLwAAAAAAAA=="},"t":1679490087}'
ebf1######hx 0016 0009 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxddx00x00x00x01{"dps":{"125":"Aw=="},"t":1679490088}'
ebf1######hx 0016 0010 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxdex00x00x00x01{"dps":{"126":"Aw=="},"t":1679490088}'
ebf1######hx 0016 0011 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxdfx00x00x00x01{"dps":{"127":"Aw=="},"t":1679490088}'
ebf1######hx 0016 0012 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe0x00x00x00x01{"dps":{"128":"Aw=="},"t":1679490088}'
ebf1######hx 0016 0017 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxe1x00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLEAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPHgEKAQddAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHMgAAAAAAAA=="},"t":1679490114}'
ebf1######hx 0016 0018 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe2x00x00x00x01{"dps":{"125":"Aw=="},"t":1679490114}'
ebf1######hx 0016 0019 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe3x00x00x00x01{"dps":{"126":"Aw=="},"t":1679490115}'
ebf1######hx 0016 0020 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe4x00x00x00x01{"dps":{"127":"Aw=="},"t":1679490115}'
ebf1######hx 0016 0021 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe5x00x00x00x01{"dps":{"128":"Aw=="},"t":1679490115}'
ebf1######hx 0016 0024 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxe6x00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLEAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPHgEKAQdhAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHMgAAAAAAAA=="},"t":1679490124}'
ebf1######hx 0016 0025 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe7x00x00x00x01{"dps":{"125":"Aw=="},"t":1679490124}'
ebf1######hx 0016 0026 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe8x00x00x00x01{"dps":{"126":"Aw=="},"t":1679490124}'
ebf1######hx 0016 0027 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxe9x00x00x00x01{"dps":{"127":"Aw=="},"t":1679490124}'
ebf1######hx 0016 0028 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxeax00x00x00x01{"dps":{"128":"Aw=="},"t":1679490125}'
ebf1######hx 0016 0035 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxebx00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLUAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPHgEKAQdhAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHMgAAAAAAAA=="},"t":1679490151}'
ebf1######hx 0016 0036 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxecx00x00x00x01{"dps":{"125":"Aw=="},"t":1679490151}'
ebf1######hx 0016 0037 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxedx00x00x00x01{"dps":{"126":"Aw=="},"t":1679490151}'
ebf1######hx 0016 0038 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxeex00x00x00x01{"dps":{"127":"Aw=="},"t":1679490151}'
ebf1######hx 0016 0039 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxefx00x00x00x01{"dps":{"128":"Aw=="},"t":1679490151}'
ebf1######hx 0016 0045 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxf0x00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLUAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPHgEKAQdhAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHNQAAAAAAAA=="},"t":1679490175}'
ebf1######hx 0016 0046 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf1x00x00x00x01{"dps":{"125":"Aw=="},"t":1679490176}'
ebf1######hx 0016 0047 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf2x00x00x00x01{"dps":{"126":"Aw=="},"t":1679490176}'
ebf1######hx 0016 0048 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf3x00x00x00x01{"dps":{"127":"Aw=="},"t":1679490176}'
ebf1######hx 0016 0049 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf4x00x00x00x01{"dps":{"128":"Aw=="},"t":1679490176}'
ebf1######hx 0016 0052 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxf5x00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLUAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPKAEKAQdkAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHNQAAAAAAAA=="},"t":1679490185}'
ebf1######hx 0016 0053 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf6x00x00x00x01{"dps":{"125":"Aw=="},"t":1679490185}'
ebf1######hx 0016 0054 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf7x00x00x00x01{"dps":{"126":"Aw=="},"t":1679490185}'
ebf1######hx 0016 0055 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf8x00x00x00x01{"dps":{"127":"Aw=="},"t":1679490185}'
ebf1######hx 0016 0056 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxf9x00x00x00x01{"dps":{"128":"Aw=="},"t":1679490185}'
ebf1######hx 0016 0061 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x03x00x01Lx11{"dps":{"111":66}}'
ebf1######hx 0016 0063 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxfax00x00x00x01{"dps":{"16":1900},"t":1679490203}'
ebf1######hx 0016 0064 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxfbx00x00x00x01{"dps":{"17":66},"t":1679490203}'
ebf1######hx 0016 0065 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxfcx00x00x00x01{"dps":{"109":1900},"t":1679490203}'
ebf1######hx 0016 0066 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxfdx00x00x00x01{"dps":{"111":66},"t":1679490203}'
ebf1######hx 0016 0067 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdbxfex00x00x00x01{"dps":{"120":"temphold"},"t":1679490205}'
ebf1######hx 0016 0070 from cmd: 8 (08) v3.3 len(271) b'3.3x00x00x00x00x00x08xdbxffx00x00x00x01{"dps":{"122":"AwAAA/YAAAAAAAAAAAAAAAAAAAAAAAAAAFRoZXJtb3N0YXQAAQjKAQ8AAQoACLcAAAAAAABWRgVRAAAAAAAAAAAAAAAAAENvdW50ZXIgNTY0NTA1NTEAAQEHbAEPKAEKAQdkAAAAAAAAVkUEcgAAAAAAAAAAAAAAAAAAAEZyb250IDU2NDUwNDcyAAEBBzoBDx4BCgEHNQAAAAAAAA=="},"t":1679490213}'
ebf1######hx 0016 0071 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdcx00x00x00x00x01{"dps":{"125":"Aw=="},"t":1679490213}'
ebf1######hx 0016 0072 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdcx01x00x00x00x01{"dps":{"126":"Aw=="},"t":1679490213}'
ebf1######hx 0016 0073 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdcx02x00x00x00x01{"dps":{"127":"Aw=="},"t":1679490213}'
ebf1######hx 0016 0074 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x08xdcx03x00x00x00x01{"dps":{"128":"Aw=="},"t":1679490213}'
ebf9######z6 0018 0000 172.20.10.196:6668_172.20.10.64:35476
ebf9######z6 0018 0001 to cmd: 16 (10) v3.3 len(16) {}
ebf9######z6 0018 0002 to cmd: 64 (40) v3.3 len(64) {"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
ebf9######z6 0018 0003 from cmd: 16 (10) v3.3 len(128) {"dps":{"20":false,"21":"white","22":10,"23":56,"24":"003c03e80163","25":"0f000000001e025803e800000000","26":0}}
ebf9######z6 0018 0018 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x04x00x001xd1{"dps":{"20":true}}'
ebf9######z6 0018 0019 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00>tx00x00x00x01{"dps":{"20":true},"t":1679490141}'
ebf9######z6 0018 0021 to cmd: 13 (0D) v3.3 len(47) b'3.3x00x00x00x00x00x00x00x05x00x001xd1{"dps":{"20":false}}'
ebf9######z6 0018 0022 from cmd: 8 (08) v3.3 len(63) b'3.3x00x00x00x00x00x00>nx00x00x00x01{"dps":{"20":false},"t":1679490145}'
PCAP output filtered to just show where protocol:N was included:
python3 pcap_parse.py -d ../devices.json -z -s lw-2.pcap | sort | grep protocol | while read line; do echo "${line:0:4}######${line:20}" ; done
eb52######k7 0011 0030 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x06x00x06x15xff{"data":{"dps":{"2":true}},"protocol":5,"t":1679490168}'
eb52######k7 0011 0032 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxb9x00x00x00x01{"protocol":4,"t":1679490169,"data":{"dps":{"2":true}}}'
eb52######k7 0011 0033 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x06x15xff{"data":{"dps":{"2":false}},"protocol":5,"t":1679490169}'
eb52######k7 0011 0034 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x06x15xff{"data":{"dps":{"2":false}},"protocol":5,"t":1679490169}'
eb52######k7 0011 0036 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbax00x00x00x01{"protocol":4,"t":1679490170,"data":{"dps":{"2":false}}}'
eb52######k7 0011 0037 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00x08x00x06x15xff{"data":{"dps":{"1":true,"2":true,"3":true,"4":true}},"protocol":5,"t":1679490173}'
eb52######k7 0011 0039 from cmd: 8 (08) v3.4 len(96) b'3.4x00x00x00x00x00x00xefxbbx00x00x00x01{"protocol":4,"t":1679490174,"data":{"dps":{"2":true,"3":true,"4":true}}}'
eb52######k7 0011 0040 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbcx00x00x00x01{"protocol":4,"t":1679490174,"data":{"dps":{"1":true}}}'
eb52######k7 0011 0041 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00tx00x06x15xff{"data":{"dps":{"1":false,"2":false,"3":false,"4":false}},"protocol":5,"t":1679490174}'
eb52######k7 0011 0043 from cmd: 8 (08) v3.4 len(112) b'3.4x00x00x00x00x00x00xefxbdx00x00x00x01{"protocol":4,"t":1679490175,"data":{"dps":{"1":false,"2":false,"3":false,"4":false}}}'
eb82######it 0006 0025 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x06x00x04x18x9c{"data":{"dps":{"1":true}},"protocol":5,"t":1679490149}'
eb82######it 0006 0027 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbex00x00x00x01{"protocol":4,"t":1679490149,"data":{"dps":{"1":true}}}'
eb82######it 0006 0028 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x07x00x04x18x9c{"data":{"dps":{"1":false}},"protocol":5,"t":1679490150}'
eb82######it 0006 0030 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxbfx00x00x00x01{"protocol":4,"t":1679490150,"data":{"dps":{"1":false}}}'
eb82######it 0006 0031 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x08x00x04x18x9c{"data":{"dps":{"2":true}},"protocol":5,"t":1679490150}'
eb82######it 0006 0033 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc0x00x00x00x01{"protocol":4,"t":1679490151,"data":{"dps":{"2":true}}}'
eb82######it 0006 0034 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00tx00x04x18x9c{"data":{"dps":{"2":false}},"protocol":5,"t":1679490151}'
eb82######it 0006 0036 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc1x00x00x00x01{"protocol":4,"t":1679490152,"data":{"dps":{"2":false}}}'
eb82######it 0006 0037 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00nx00x04x18x9c{"data":{"dps":{"3":true}},"protocol":5,"t":1679490152}'
eb82######it 0006 0039 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc2x00x00x00x01{"protocol":4,"t":1679490153,"data":{"dps":{"3":true}}}'
eb82######it 0006 0040 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0bx00x04x18x9c{"data":{"dps":{"4":true}},"protocol":5,"t":1679490152}'
eb82######it 0006 0042 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc3x00x00x00x01{"protocol":4,"t":1679490153,"data":{"dps":{"4":true}}}'
eb82######it 0006 0043 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0cx00x04x18x9c{"data":{"dps":{"3":false}},"protocol":5,"t":1679490153}'
eb82######it 0006 0045 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc4x00x00x00x01{"protocol":4,"t":1679490154,"data":{"dps":{"3":false}}}'
eb82######it 0006 0046 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00rx00x04x18x9c{"data":{"dps":{"4":false}},"protocol":5,"t":1679490154}'
eb82######it 0006 0048 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc5x00x00x00x01{"protocol":4,"t":1679490154,"data":{"dps":{"4":false}}}'
eb82######it 0006 0049 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0ex00x04x18x9c{"data":{"dps":{"4":true}},"protocol":5,"t":1679490154}'
eb82######it 0006 0052 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc6x00x00x00x01{"protocol":4,"t":1679490155,"data":{"dps":{"4":true}}}'
eb82######it 0006 0054 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x0fx00x04x18x9c{"data":{"dps":{"1":true}},"protocol":5,"t":1679490155}'
eb82######it 0006 0056 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc7x00x00x00x01{"protocol":4,"t":1679490155,"data":{"dps":{"1":true}}}'
eb82######it 0006 0057 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x10x00x04x18x9c{"data":{"dps":{"2":true}},"protocol":5,"t":1679490155}'
eb82######it 0006 0059 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc8x00x00x00x01{"protocol":4,"t":1679490156,"data":{"dps":{"2":true}}}'
eb82######it 0006 0060 to cmd: 13 (0D) v3.4 len(80) b'3.4x00x00x00x00x00x00x00x11x00x04x18x9c{"data":{"dps":{"3":true}},"protocol":5,"t":1679490156}'
eb82######it 0006 0062 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxc9x00x00x00x01{"protocol":4,"t":1679490156,"data":{"dps":{"3":true}}}'
eb82######it 0006 0063 to cmd: 13 (0D) v3.4 len(112) b'3.4x00x00x00x00x00x00x00x12x00x04x18x9c{"data":{"dps":{"1":false,"2":false,"3":false,"4":false}},"protocol":5,"t":1679490159}'
eb82######it 0006 0065 from cmd: 8 (08) v3.4 len(96) b'3.4x00x00x00x00x00x00xefxcax00x00x00x01{"protocol":4,"t":1679490160,"data":{"dps":{"2":false,"3":false,"4":false}}}'
eb82######it 0006 0066 from cmd: 8 (08) v3.4 len(80) b'3.4x00x00x00x00x00x00xefxcbx00x00x00x01{"protocol":4,"t":1679490160,"data":{"dps":{"1":false}}}'
After spending some time in Ghidra I have figured out what the "version protocol" header fields are. First is the protocol version as a string, i.e. "3.3". After this there are 3x 32-bit words. When the message comes from the MQTT server, the first word is a crc32 hash of the message; when it comes from the LAN it is set to 0. Skipping the 2nd word for a moment, the 3rd word is a unique source identifier. The device is source 1 and clients should generate a unique (random?) number to identify that specific client - this identifier should persist across connections. The 2nd word is a source-specific message sequence number that increments on every message and also persists across connections. If a device receives a 2nd message from the same source with the same or decreasing sequence number, that message is discarded. This allows a client to send a message via both the cloud and the local network simultaneously and the device will process whichever arrives first and ignore the other. The client can also use it to figure out if it has missed any messages by looking for jumps in the sequence number. If the unique source identifier is "0" then the sequence number is ignored and all messages are processes. The device I looked at only "remembers" the last 5 unique source identifiers; the oldest is overwritten when a new source shows up.
I still have no idea what the "protocol:N" does in the payload. The device I looked at has it fixed as "4" and doesn't appear to look at it in received messages.
I went ahead and pulled the pcap parser out and made it its own PR.
I felt like I'd regret not keeping "protocol:5" so I went ahead and put that back as well.
With that, I think this one's ready. I do recommend the "Squash and merge" option to reduce the number of commits in the log.
Thanks @uzlonewolf ! Running tests... going to rev to (edit) 1.12.2 when we are ready.
Quite a few changes to payload_dict processing. I don't expect it to affect non-gateway 3.1-3.3 devices at all, but for v3.4+ I changed the "protocol" key from 5 to 4. My packet captures seem to show the app and devices use them interchangeably and I have not noticed any issues with "4" on my v3.4 devices.
Said packet captures also showed the app polling for sub-device status, so I implemented that via the new
subdev_query()
function. My v3.3 gateways just ignore it though, so it's probably a v3.4+-only thing. Request: cmd=64,'{"data":{"cids":[]},"reqType":"subdev_online_stat_query"}
Response:{"reqType":"subdev_online_stat_report","data":{"online":["tu###4"],"offline":[],"nearby":["tu###4"]}}
I poked around in the firmware a bit but didn't see any other "reqType" commands which actually did anything.Closes #302 Possibly closes #266 Closes #307 Closes #309