studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.52k stars 267 forks source link

Python Hue Config File Location #183

Open KikeMendez opened 3 years ago

KikeMendez commented 3 years ago

Hi There, I would like to have .python_hue in different location rather that the home default one.

Ideally something like this would be awesome to have:

hue_bridge_config = "home/.folder/python_hue"

bridge = Bridge(ip=bridge_ip, config_file_path=hue_bridge_config)

So instead of saving it on the home directory, saves it wherever the config_file_path is set to, if config_file_path is not set then use the default as it is at the moment.

Does the library have already something to achieve this? I have been looking but no luck so far.

Thanks

natcl commented 3 years ago

This should already work, see https://github.com/studioimaginaire/phue/blob/6882829e1d22bb38737a22cddb21a584a38be8b5/phue.py#L608

KikeMendez commented 3 years ago

Hi natcl thank you for coming back, yeah I though that would work but it doesn't, actually i ended with an empty file. Setting the config_file_path means you need to have it pre configure before hand? Thanks again

natcl commented 3 years ago

Can you show your code ? I can’t see why this wouldn’t work.

-- lecaude.com studioimaginaire.com

Le 9 avr. 2021 à 16:49, Kike Mendez @.***> a écrit :

 Reopened #183.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

bmedicke commented 2 years ago

I just had the same issue before I figured out my error. Note that you should not pass the path alone, but the filename as well. For your example, it would be: config_file_path = "home/.folder/python_hue/.python_hue".

See: https://github.com/studioimaginaire/phue/blob/6882829e1d22bb38737a22cddb21a584a38be8b5/phue.py#L608-L615

For all the other cases, the filename is joined. I would rename the parameter config_file_path to config_file to avoid confusion.