Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring. Command class. Example settings.
- Loading branch information
Showing
4 changed files
with
198 additions
and
72 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 |
---|---|---|
|
@@ -39,3 +39,11 @@ nosetests.xml | |
venv | ||
|
||
settings.py | ||
|
||
|
||
audio | ||
audio.flac | ||
|
||
*.un~ | ||
|
||
*.log |
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
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,22 @@ | ||
NEST_LOGIN = 'your@email.com' | ||
NEST_PASS = 'password' | ||
HUE_BRIDGE = '10.0.1.147' | ||
|
||
colors = { | ||
'red': [0], | ||
'read': [0], | ||
'green': [25500], | ||
'blue': [46920], | ||
'rainbow': [0, 25500, 46920], | ||
} | ||
|
||
light_groups = { | ||
'office': [7, 8, 9], | ||
'living': [6, 3, 1], | ||
'upstairs': [4, 5], | ||
'kitchen': [2], | ||
'bedroom': [5], | ||
'stairs': [4, 6], | ||
'staircase': [4, 6], | ||
'house': range(1, 10), | ||
} |
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,44 @@ | ||
import automate | ||
|
||
|
||
def test_temperature(): | ||
automate.setup_logging() | ||
command_text = 'set the temperature to 80 degrees' | ||
command = automate.Command() | ||
command = automate.parse_command(command_text) | ||
print str(command) | ||
assert command.action == 'temperature' | ||
assert command.value == 80 | ||
|
||
|
||
def test_green_office(): | ||
automate.setup_logging() | ||
command_text = 'make the office green' | ||
command = automate.Command() | ||
command = automate.parse_command(command_text) | ||
print str(command) | ||
assert command.room == 'office' | ||
assert command.action == 'hue' | ||
assert command.value == [25500] | ||
|
||
|
||
def test_blue_house(): | ||
automate.setup_logging() | ||
command_text = 'turn the house blue' | ||
command = automate.Command() | ||
command = automate.parse_command(command_text) | ||
print str(command) | ||
assert command.room == 'house' | ||
assert command.action == 'hue' | ||
assert command.value == [46920] | ||
|
||
|
||
def test_office_off(): | ||
automate.setup_logging() | ||
command_text = 'turn the office lights off' | ||
command = automate.Command() | ||
command = automate.parse_command(command_text) | ||
print str(command) | ||
assert command.room == 'office' | ||
assert command.action == 'power' | ||
assert command.value == 'off' |