-
Notifications
You must be signed in to change notification settings - Fork 694
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
src/action.py
Outdated
light.xy = converter.hex_to_xy(self.hex_colour) | ||
self.say(_("Ok")) | ||
bridge = self.find_bridge() | ||
if bridge is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if bridge:
Thanks. Please squash the changes and make sure travis is happy (follow Details link). |
Squashed and fixed travis. Also use |
Thanks for the PR, @bazwilliams! If you can use rgbxy from PyPI, it's just some style changes required. |
@drigz What style changes do I need to make? I tried the rgbxy lib from PyPI as I'd rather install the dependency, but it failed to install. I'll have another look tonight to see what I can do. |
You should see the comments on the GitHub pull request. Also, now #48 is merged, you can add phue and rgbxy to requirements.txt. If rgbxy is broken, maybe you could get in touch with the author? If they're not responding, you'll have to fork their project. Unfortunately, we can't bring the code into our repo. |
Thanks for clarifying and will get the requirements.txt file updated, worst case I'll fork publish a new pypi lib for rgbxy. |
src/rgb_xy.py
Outdated
Library for RGB / CIE1931 "x, y" coversion. | ||
Based on Philips implementation guidance: | ||
http://www.developers.meethue.com/documentation/color-conversions-rgb-xy | ||
Copyright (c) 2016 Benjamin Knight / MIT License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't add this file to our repo, as the copyright/license aren't compatible.
Can you use rgbxy from PyPI?
src/action.py
Outdated
@@ -20,6 +20,10 @@ | |||
|
|||
import actionbase | |||
|
|||
import phue | |||
from rgb_xy import Converter | |||
converter = Converter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move converter
to within ChangeLightColor
instead of creating a global variable.
src/action.py
Outdated
@@ -194,6 +198,43 @@ def run(self, voice_command): | |||
self.say(to_repeat) | |||
|
|||
|
|||
# Example: Change Philips Light Colour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to color
, here and in the rest of the file. Google coding style is to use the US spellings (any other British spellings in the codebase are probably from me in a moment of weakness).
src/action.py
Outdated
@@ -20,6 +20,10 @@ | |||
|
|||
import actionbase | |||
|
|||
import phue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ordering of imports should be:
- Standard library
- Dependencies
- Within the project
So phue
and rgbxy
need to be a separate section between subprocess
and actionbase
.
src/action.py
Outdated
|
||
class ChangeLightColour(object): | ||
|
||
"""Change a philips hue bulb colour.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uppercase Philips Hue
.
FYI, I missed clicking Submit on the review, but I have now. |
scripts/install-deps.sh
Outdated
@@ -32,6 +32,7 @@ sudo pip3 install --upgrade pip virtualenv | |||
|
|||
cd "${scripts_dir}/.." | |||
virtualenv --system-site-packages -p python3 env | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the empty line here.
Codecov Report
@@ Coverage Diff @@
## master #33 +/- ##
==========================================
- Coverage 79.2% 9.67% -69.54%
==========================================
Files 5 3 -2
Lines 202 1705 +1503
Branches 0 293 +293
==========================================
+ Hits 160 165 +5
- Misses 42 1530 +1488
- Partials 0 10 +10
Continue to review full report at Codecov.
|
I added a test to improve the coverage, but it hasn't been recognised by codecov. Any idea why not? |
.coveragerc
Outdated
*/mock/mock.py | ||
*/mock/__init__.py | ||
*/pbr/*.py | ||
*/six.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: here is the generic coveragerc that codecov suggests: https://gist.github.com/codecov-io/bf15bde2c7db1a011b6e
I am not seeing any coverage data for your branch on:
https://codecov.io/gh/google/aiyprojects-raspbian/commits
I think you need to fixs fix the pep8 warnings, see
https://travis-ci.org/google/aiyprojects-raspbian/builds/234963910?utm_source=github_status&utm_medium=notification
@ensonic you were right! The coverage never ran due to that pep8 warning that was added by mistake. Fixing that and including the suggested Thanks for helping out! I've rebased the PR. |
Thanks! |
This adds Philips hue support using the
phue
library.It would be nice to configure the hue bridge in the global configuration file, but I wasn't able to find a nice way to pass this into the
actions.py
class. As such I've forced the user to set it for each actor request.Example use where the hostname for my Hue bridge is
philips-hue
.actor.add_keyword(_('change to purple'), ChangeLightColour(say, "philips-hue", "Lounge Lamp", "FFFFbe"))