From 56340d5f6affe63ef34f27392ab30a20d911a1ef Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 15 Dec 2024 21:30:48 +0100 Subject: [PATCH 1/4] Update .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5d0a8ad..ea15adf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ test.py *.sublime-workspace dist MANIFEST +.python_hue +lights.json +.venv From fdf3aaa51f6fdb8c579cf7762bd855c0be7feb5e Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 15 Dec 2024 21:31:04 +0100 Subject: [PATCH 2/4] - Simplify discovery `.python_hue` - TODO: move solution to `Bridge.connect` --- phue.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phue.py b/phue.py index a6a2612..5df59db 100755 --- a/phue.py +++ b/phue.py @@ -621,12 +621,14 @@ def __init__(self, ip=None, username=None, config_file_path=None): if config_file_path is not None: self.config_file_path = config_file_path + elif os.access(os.path.join(os.getcwd(), '.python_hue'), os.R_OK): + self.config_file_path = os.path.join(os.getcwd(), '.python_hue') elif os.getenv(USER_HOME) is not None and os.access(os.getenv(USER_HOME), os.W_OK): self.config_file_path = os.path.join(os.getenv(USER_HOME), '.python_hue') elif 'iPad' in platform.machine() or 'iPhone' in platform.machine() or 'iPad' in platform.machine(): self.config_file_path = os.path.join(os.getenv(USER_HOME), 'Documents', '.python_hue') else: - self.config_file_path = os.path.join(os.getcwd(), '.python_hue') + logger.exception('Could not retrieve bridge connection configuration.') self.ip = ip self.username = username From 4264b10f8fc32500d067a56f497765bc2597f919 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 15 Dec 2024 21:32:23 +0100 Subject: [PATCH 3/4] - Update `examples/flicker.py` - TODO: roll out to testing --- examples/flicker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/flicker.py b/examples/flicker.py index ee1ee4c..5cfca7a 100644 --- a/examples/flicker.py +++ b/examples/flicker.py @@ -1,7 +1,7 @@ import random from time import sleep from phue import Bridge -b = Bridge('192.168.0.23') +b = Bridge() b.connect() lights = b.lights From 01e6e1b1eb13970e0c5935db188b68280c1a5a80 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 15 Dec 2024 21:38:43 +0100 Subject: [PATCH 4/4] Fix `sleep` import --- examples/hue-rainbow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/hue-rainbow.py b/examples/hue-rainbow.py index edaf981..4864980 100644 --- a/examples/hue-rainbow.py +++ b/examples/hue-rainbow.py @@ -3,6 +3,7 @@ # in the time specified in totalTime from phue import Bridge import random +from time import sleep b = Bridge() # Enter bridge IP here.