Part 4: Lutron
Venturing into Lutron territory now with my Serena Shades.
- To Install Lutron… I need to obtain certification files. This was a painful process since I only have a windows PC and had to install a few things to get this to work.
- Component: https://www.home-assistant.io/components/lutron_caseta/
- This is the first challenging part as I don’t have a python environment nativeon my windows PC. I also am using a Docker for the Home Assistant instance on my RPI3, which previously had a python virtual environment installed.
- On Windows – I installed the latest version of Python 3 (at point of this blog post it is 3.6.5 released 3/28/18)
- https://www.python.org/downloads/
- Make sure to check the “install pathways” or else it is difficult to setup the file pathway in command prompt. Without pathways clicked, command line does not know what the “python” command refers to. This is referring to the python.exe sitting in the install file.
- Grab latest Python Certification script.
- https://github.com/gurumitts/pylutron-caseta/blob/master/get_lutron_cert.py
- Install PIP on windows.
- https://dev.to/el_joft/installing-pip-on-windows
- This is important since it helps us install and manage software packages in Python.
- Run the package installer for cryptography and requests which is required for the Lutron certifications. Within command line.
- pip install cryptography==2.1.3 requests==2.18.4
- Run the Lutron certification python script. Within command line.
- python get_lutron_cert.py
- Nest and Door Sensor Update tomorrow!
Oh yea… broke my foot on 5/7/18.
Process Samples Below
#5 Installing PIP.
C:\Users\Yanyan\Downloads>python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
requests 2.18.4 requires certifi>=2017.4.17, which is not installed.
requests 2.18.4 requires chardet<3.1.0,>=3.0.2, which is not installed.
requests 2.18.4 requires idna<2.7,>=2.5, which is not installed.
requests 2.18.4 requires urllib3<1.23,>=1.21.1, which is not installed.
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-10.0.1C:\Users\Yanyan\Downloads>pip –version
pip 10.0.1 from c:\users\yanyan\appdata\local\programs\python\python36\lib\site-packages\pip (python 3.6)#6 Installing the packages.
C:\Users\Yanyan\Downloads>pip install cryptography==2.1.3
Collecting cryptography==2.1.3
Downloading https://files.pythonhosted.org/packages/b7/c5/f1c09ea19fe7a884b0c9bc5baf6243807bf066282a5e8a5d00cf177c426a/cryptography-2.1.3-cp36-cp36m-win_amd64.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 3.8MB/s
Collecting idna>=2.1 (from cryptography==2.1.3)
Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 6.8MB/s
Collecting cffi>=1.7; platform_python_implementation != “PyPy” (from cryptography==2.1.3)
Downloading https://files.pythonhosted.org/packages/2f/85/a9184548ad4261916d08a50d9e272bf6f93c54f3735878fbfc9335efd94b/cffi-1.11.5-cp36-cp36m-win_amd64.whl (166kB)
100% |████████████████████████████████| 174kB 7.6MB/s
Collecting six>=1.4.1 (from cryptography==2.1.3)
Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography==2.1.3)
Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
100% |████████████████████████████████| 102kB 8.5MB/s
Collecting pycparser (from cffi>=1.7; platform_python_implementation != “PyPy”->cryptography==2.1.3)
Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
100% |████████████████████████████████| 256kB 7.9MB/s
Building wheels for collected packages: pycparser
Running setup.py bdist_wheel for pycparser … done
Stored in directory: C:\Users\Yanyan\AppData\Local\pip\Cache\wheels\c0\a1\27\5ba234bd77ea5a290cbf6d675259ec52293193467a12ef1f46
Successfully built pycparser
Installing collected packages: idna, pycparser, cffi, six, asn1crypto, cryptography
Successfully installed asn1crypto-0.24.0 cffi-1.11.5 cryptography-2.1.3 idna-2.6 pycparser-2.18 six-1.11.0C:\Users\Yanyan\Downloads>pip install requests==2.18.4
Collecting requests==2.18.4
Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 2.8MB/s
Collecting certifi>=2017.4.17 (from requests==2.18.4)
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
100% |████████████████████████████████| 153kB 6.8MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.18.4)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |████████████████████████████████| 143kB 7.8MB/s
Collecting urllib3<1.23,>=1.21.1 (from requests==2.18.4)
Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)
100% |████████████████████████████████| 133kB 6.4MB/s
Requirement already satisfied: idna<2.7,>=2.5 in c:\users\yanyan\appdata\local\programs\python\python36\lib\site-packages (from requests==2.18.4) (2.6)
Installing collected packages: certifi, chardet, urllib3, requests
The script chardetect.exe is installed in ‘c:\users\yanyan\appdata\local\programs\python\python36\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed certifi-2018.4.16 chardet-3.0.4 requests-2.18.4 urllib3-1.22#7 Executing the Lutron Cert Python Script. Follow the prompts. First you copy link in browser and log in to Lutron. Second you look up your bridge IP. And lastly it populates 3 certificate files in your folder.
C:\Users\Yanyan\Downloads>python get_lutron_cert.py
Open Browser and login at https://device-login.lutron.com/oauth/authorize?client_id=XXXXSANITIZED
Enter the URL (of the “error” page you got redirected to (or the code in the URL): https://device-login.lutron.com/lutron_app_oauth_redirect?code=XXXXSANITIZED
Enter the address of your Caseta bridge device: 10.0.1.54
Successfully connected to bridge, running LEAP Server version 1.108C:\Users\Yanyan\Downloads>
Recent Comments