-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from TomFaulkner/cli
add script, update setup.py, remove symlink, release 0.1.3
- Loading branch information
Showing
6 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,3 +103,6 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# editor configs and cache | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
v0.1.0, 2018-03-06 -- Initial release. | ||
v0.1.1, 2018-03-12 -- Fix neglected lib directory | ||
v0.1.2, 2018-06-23 -- Fix issues with reading fan variables | ||
v0.1.3, 2018-07-05 -- Add command line script (senseme_cli), improve setup.py |
Submodule SenseMe
deleted from
b76c6c
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
"""Haiku Home SenseMe CLI | ||
fan x - set speed to x (0-7) | ||
fan [on|off] - fan on/off | ||
light x - set light brightness to x | ||
light [on|off] - light on/off | ||
whoosh [on|off] - whoosh mode on/off | ||
""" | ||
|
||
import os | ||
import sys | ||
|
||
from senseme import SenseMe | ||
|
||
IP = os.environ.get('SENSEME_DEFAULT_FAN_IP') | ||
NAME = os.environ.get('SENSEME_DEFAULT_FAN_NAME') | ||
|
||
VALID_PARAMS = f"on off {' '.join([str(x) for x in range(17)])}".split() | ||
|
||
if __name__ == "__main__": | ||
device = SenseMe(ip=IP, name=NAME) | ||
OPTIONS = "fan light whoosh".split() | ||
|
||
if len(sys.argv) != 3 or sys.argv[1] not in OPTIONS or sys.argv[2] not in VALID_PARAMS: | ||
print(f"Invalid parameter. Printing help.\n\n{__doc__}") | ||
sys.exit(1) | ||
|
||
try: | ||
# intify 0-16, but leave on|off alone | ||
number = int(sys.argv[2]) | ||
power_toggle = False | ||
except ValueError: | ||
on_or_off = True if sys.argv[2] == "on" else False | ||
power_toggle = True | ||
|
||
option = sys.argv[1] | ||
if option == "fan" and power_toggle: | ||
device.fan_powered_on = on_or_off | ||
elif option == "fan": | ||
device.speed = number | ||
elif option == "light" and power_toggle: | ||
device.light_powered_on = on_or_off | ||
elif option == "light": | ||
device.brightness = number | ||
elif option == "whoosh": | ||
device.whoosh = on_or_off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python | ||
|
||
from distutils.core import setup | ||
from setuptools import setup | ||
|
||
long_description = """HaikuHome SenseMe API for fans and lights. | ||
|
@@ -12,19 +12,21 @@ | |
|
||
setup( | ||
name="SenseMe", | ||
version="0.1.2", | ||
version="0.1.3", | ||
description="HaikuHome SenseMe API for fans and lights", | ||
author="Tom Faulkner", | ||
author_email="[email protected]", | ||
url="https://github.com/TomFaulkner/SenseMe", | ||
packages=["senseme", "senseme.lib"], | ||
packages=["senseme", "senseme.lib", "bin"], | ||
license="GPL3", | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Topic :: Home Automation" | ||
], | ||
keywords="HaikuHome SenseMe fan light home automation bigassfans", | ||
python_requires=">=3.6", | ||
scripts=['bin/senseme_cli'] | ||
) |