Follow @buran advice to first get Python setup before PyCharm,i guess you use Windows?
There are many Python modules made for this,eg the first one that show up in Google search.
phue: A Python library for Philips Hue.
To use it pretty straight forward.
If setup of Python is okay then the important
Example:
There are many Python modules made for this,eg the first one that show up in Google search.
phue: A Python library for Philips Hue.
To use it pretty straight forward.
If setup of Python is okay then the important
pip
work(Used to install all library/modules to Python).Example:
# Test that pip work C:\ λ pip -V pip 18.1 from c:\python37\lib\site-packages\pip (python 3.7) # Install phue C:\ λ pip install phue Collecting phue Downloading https://files.pythonhosted.org/packages/34/d2/35bfef007857ef2949b7271a263ef0c37cd9714f5b61f7d5ac02f20d7174/phue-1.0.tar.gz Installing collected packages: phue Running setup.py install for phue ... done Successfully installed phue-1.0At this point is installed and look at it.
C:\ λ ptpython >>> from phue import Bridge >>> Bridge <class 'phue.Bridge'> >>> Bridge.connect <function Bridge.connect at 0x04C3A4F8> >>> help(Bridge.connect) Help on function connect in module phue: connect(self) Connect to the Hue bridge >>> help(Bridge) Help on class Bridge in module phue: class Bridge(builtins.object) | Bridge(ip=None, username=None, config_file_path=None) | | Interface to the Hue ZigBee bridge | | You can obtain Light objects by calling the get_light_objects method: | | >>> b = Bridge(ip='192.168.1.100') | >>> b.get_light_objects() | [<phue.Light at 0x10473d750>, | <phue.Light at 0x1046ce110>] | | Or more succinctly just by accessing this Bridge object as a list or dict: | | >>> b[1] | <phue.Light at 0x10473d750> | >>> b['Kitchen'] | <phue.Light at 0x10473d750> | | Methods defined here: | | __getitem__(self, key) | Lights are accessibly by indexing the bridge either with -- More --So you see that setup work i don't have Philips Hue,so i can not test out connecting to IP out eg:
>>> b = Bridge('ip_of_your_bridge') >>> b.get_light_objects()