TP-Link HS100 - Godsend for Smart Home Integration

The following code works on the HS100, HS105 and HS110, it may be compatible with more models, but was tested with success on these.