softScheck / tplink-smartplug

TP-Link WiFi SmartPlug Client and Wireshark Dissector
Apache License 2.0
1.14k stars 296 forks source link

add add support for lightbulbs #6

Open konsumer opened 7 years ago

konsumer commented 7 years ago

This adds support for TP-link smart lightbulbs. Tested with LB120. The decrypter needs UDP, and no header bytes. I added this to both the wireshark dissector and tplink-smartplug.py.

konsumer commented 7 years ago

There are lots of other options like

{"smartlife.iot.smartbulb.lightingservice":{"transition_light_state":{"brightness":90,"color_temp":2900,"hue":0,"ignore_default":1,"mode":"normal","on_off":1,"saturation":0,"transition_period":150}}}

Not sure if these should be flags or what. Suggestions?

konsumer commented 7 years ago

I ended up making this with node. My CLI looks like this:

Usage: tplight <COMMAND> <IP_ADDRESS> [options] [<JSON>]

Commands:
  scan     Scan for lightbulbs
  on       Turn on lightbulb
  off      Turn off lightbulb
  cloud    Get cloud info
  raw      Send a raw JSON command
  details  Get details about the device

Options:
  -?, --help        Show help                                          [boolean]
  --transition, -t  Transition time (for on/off)                    [default: 0]
  --hue, -h         Hue of lightbulb (for on)
  --saturation, -s  Saturation of color (for on)
  --color, -c       Color temperature (for on)
  --brightness, -b  Brightness of light (for on)

Examples:
  tplight scan            Get list of lightbulbs on your network
  tplight on 10.0.0.200   Turn on a light
  tplight off 10.0.0.200  Turn off a light