Refactor and drop py2 support (#49)

* move is_off property to SmartDevice, implement is_on for bulb and use it

* refactor by moving smartbulb and smartplug to their own classes

* drop python2 compatibility, make flake8 happy

* travis: remove 2.7, add 3.6
This commit is contained in:
Teemu R
2017-04-14 14:24:58 +02:00
committed by GitHub
parent c9662fcb7b
commit 86f14642c8
13 changed files with 497 additions and 497 deletions

View File

@@ -4,7 +4,12 @@ import logging
from click_datetime import Datetime
from pprint import pformat
from pyHS100 import SmartPlug, TPLinkSmartHomeProtocol
if sys.version_info < (3, 4):
print("To use this script you need python 3.4 or newer! got %s" %
sys.version_info)
sys.exit(1)
from pyHS100 import SmartPlug, TPLinkSmartHomeProtocol # noqa: E402
pass_dev = click.make_pass_decorator(SmartPlug)
@@ -24,7 +29,7 @@ def cli(ctx, ip, debug):
return
if ip is None:
click.echo("You must specify the IP either by --ip or setting PYHS100_IP environment variable!")
click.echo("You must specify the IP!")
sys.exit(-1)
plug = SmartPlug(ip)