Talk About the Latest in Home Automation/Home Electronics -
Home Automation Forum

Smarthome Forum
Insteon Home Automation
Login or Register
 
Home | Profile | Register | Active Topics | Search | FAQ | Smarthome | Security and Privacy
 All Forums
 General Discussion
 Computer Interfaces
 Linux command line control
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

liderbug
Starting Member

USA
5 Posts

Posted - 11/30/2018 :  06:05:26 AM  Show Profile  Reply with Quote
Needle in a haystack or hasn't be discussed - yet.

Choice: Smart Life Plug, Amazon $9 or a X10/Zwave device at $35. My problem is I can't find out how to communicate with these "smart" devices. Yes I can tell Alexa to turn family room on/off. But Wireshark isn't showing me anything (or I'm not filtering right). Understand I'm a LAMP guy, I like Bash, I like PHP, I love C, I'm not a fan of Python (sorry)(not really). I like to control things myself and not depend on something unknown in a cloud. I'd like to do: echo -n "On" | nc [IP] 6668. when the driveway motion sensor detects a car. I have a RasPi in my hydroponics green house with X10 to heat/cool and water. It also reports temp/humd. I also run Domoticz to observe/do on/off. Can someone tell me where to go (politely) to find out how to communicate with a smart device - without contacting a server in China.

Thanks

liderbug
Starting Member

USA
5 Posts

Posted - 11/30/2018 :  10:45:57 AM  Show Profile  Reply with Quote
And with that I was able to tcpdump the following:

android-b530700e1ce6eb2e.domain.39776 > ESP_BF39EC.domain.6668: Flags [.], cksum 0xf8c0 (correct), seq 24, ack 29, win 65535, length 0
0x0000: 4500 0028 5de6 4000 4006 5ae8 c0a8 004b E..(][email protected]@.Z....K
0x0010: c0a8 0066 9b60 1a0c 1d46 3afa 0078 26ed ...f.`...F:..x&.
0x0020: 5010 ffff f8c0 0000 P.......

android-b530700e1ce6eb2e.domain.45919 > ESP_C24180.domain.6668: Flags [P.], cksum 0x021e (correct), seq 171:342, ack 184, win 65535, length 171
0x0000: 4500 00d3 bdf6 4000 4006 fa52 c0a8 004b [email protected]@..R...K
0x0010: c0a8 0040 b35f 1a0c 0441 d667 0021 589b [email protected]_...A.g.!X.
0x0020: 5018 ffff 021e 0000 0000 55aa 0000 0004 P.........U.....
0x0030: 0000 0007 0000 009b 332e 3136 6630 6134 ........3.16f0a4
0x0040: 6531 6534 6265 3632 6565 644d 5170 5859 e1e4be62eedMQpXY
0x0050: 5131 6f51 634a 787a 7231 6767 614f 6545 Q1oQcJxzr1ggaOeE
0x0060: 6b57 7341 2b4d 7737 7967 5444 5030 7152 kWsA+Mw7ygTDP0qR
0x0070: 4843 6369 7579 4232 4255 385a 6e31 5768 HCciuyB2BU8Zn1Wh
0x0080: 5676 722f 7941 2f50 5879 6577 6446 4630 Vvr/yA/PXyewdFF0
0x0090: 4c4e 586b 385a 6c57 5345 4a31 5669 4731 LNXk8ZlWSEJ1ViG1
0x00a0: 3872 4b65 7a46 6966 3465 7439 5233 5561 8rKezFif4et9R3Ua
0x00b0: 3576 796a 5739 5365 516a 6947 5442 5073 5vyjW9SeQjiGTBPs
0x00c0: 3357 336e 7948 5a50 5445 2f85 47d3 b700 3W3nyHZPTE/.G...
0x00d0: 00aa 55 ..U

and from my router that translates to 192.168.0.102. There are also
ESP_C24180.domain.6668 > android-b530700e1ce6eb2e.domain.45919
lines. Now to decipher..


Go to Top of Page

liderbug
Starting Member

USA
5 Posts

Posted - 12/12/2018 :  09:44:04 AM  Show Profile  Reply with Quote
OK, I've been able to get somewhere ...

telnet router
sh
tcpdump -v -n -X port 6668

then with phone app on/off/on/off/on/off.......
copy & paste into file, extract hex from 0x0020 second half on to end (0x00d0).
Then process through base64 to create an encoded string ie. AAAAAFWqAAAAIgAAAAcAAACb...
I had 21 on/off examples which I ran through a for loop as:
echo -n -e "$string" | base64 -d | nc IP 6668
and [click] ON [click] OFF I tried it several time and found a pair of strings that seemed to turn it on/off. Well almost, it seemed to be more of "toggle" than on/off and on the hour it quit working - and now it's working again.


#!/bin/bash
off="AAAAAFWqAAAAHwAAAAcAAACbMy4xNjRiMjc3OWU2ODVlNTE4NFFXdlNrYS9uTmtoUzFiL0V0K2lSbG4yK2dITWRRTVFZZ2J6R0dtdy9pTTgrbno4UXllZmVFRDd5REhyMVhVNGhYVHJ0VkM0eVNNb2FIcmdocXFDTFExbVRtMHVjOHRJTlU0eVBvaWc2cHVURndNR281bHljTnlYdzlkeDg3ak9GTriUPgAAqlU="
on="AAAAAFWqAAAAIAAAAAcAAACbMy4xOWRjZTUyNDYzY2YyYWQ3N1FXdlNrYS9uTmtoUzFiL0V0K2lSbG4yK2dITWRRTVFZZ2J6R0dtdy9pTS9hbFM5dldGZW1Pb2sySHYxUXFWNHNxQittZGxIYXFWcGQwZVRyUE9CUjhCN2dJbmNXN21LMDdyb0Z3WE51QWJiQ0V1VlQxWEkxQ2ZTcGN0U1lsamYvXWcXQQAAqlU="

case $1 in
   on) echo "ON" ; ret=`echo -n -e $off | base64 -d | nc sg64 6668 2> /dev/null | base64` ;
       echo "$ret" ;
       ret=`echo -n -e $on | base64 -d | nc sg64 6668 2> /dev/null | base64` ;
       echo "$ret" ;;
   off) echo "OFF" ; ret=`echo -n -e $on | base64 -d | nc sg64 6668 2> /dev/null | base64` ;
        echo "$ret" ;
        ret=`echo -n -e $off | base64 -d | nc sg64 6668 2> /dev/null | base64` ;
        echo "$ret" ;;
    *) echo "Hu?" ;;
esac


while [ 1 ]; do ./my68 on; sleep 1; ./my68 off; sleep 1; done

ran for about 1/2 hour working just fine. I've found if I don't do a double send - on-off off-on it doesn't work. It's as if it's a toggle.

Go to Top of Page
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Smarthome Forum © 2000-2018 Smartlabs, Inc Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07