Merge pull request #1 from kchiem/master
Add Support for HS105 and add Energy Command
This commit is contained in:
commit
2d8c28713c
@ -40,6 +40,7 @@ Provide the target IP using `-t` and a command to send using either `-c` or `-j`
|
||||
| antitheft | Lists configured antitheft rules |
|
||||
| reboot | Reboot the device |
|
||||
| reset | Reset the device to factory settings |
|
||||
| energy | Return realtime voltage/current/power|
|
||||
|
||||
More advanced commands such as creating or editing rules can be issued using the `-j` flag by providing the full JSON string for the command. Please consult [tplink-smarthome-commands.txt](tplink-smarthome-commands.txt) for a comprehensive list of commands.
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#
|
||||
import socket
|
||||
import argparse
|
||||
from struct import pack
|
||||
|
||||
version = 0.1
|
||||
|
||||
@ -44,14 +45,15 @@ commands = {'info' : '{"system":{"get_sysinfo":{}}}',
|
||||
'countdown': '{"count_down":{"get_rules":{}}}',
|
||||
'antitheft': '{"anti_theft":{"get_rules":{}}}',
|
||||
'reboot' : '{"system":{"reboot":{"delay":1}}}',
|
||||
'reset' : '{"system":{"reset":{"delay":1}}}'
|
||||
'reset' : '{"system":{"reset":{"delay":1}}}',
|
||||
'energy' : '{"emeter":{"get_realtime":{}}}'
|
||||
}
|
||||
|
||||
# Encryption and Decryption of TP-Link Smart Home Protocol
|
||||
# XOR Autokey Cipher with starting key = 171
|
||||
def encrypt(string):
|
||||
key = 171
|
||||
result = "\0\0\0\0"
|
||||
result = pack('>I', len(string))
|
||||
for i in string:
|
||||
a = key ^ ord(i)
|
||||
key = a
|
||||
|
Loading…
Reference in New Issue
Block a user