Lutron - get_lutron_cert.py

I am not a programmer but I try and follow instructions the best that I can. I have the Lutron_Caseta installed in my home and trying to set up hassbian. I downloaded the python script get_lutron_cert.py. I uncommented the lines:
host: 192.168.20.36
keyfile: caseta.keypython
certfile: caseta.crt
ca_certs: caseta-bridge.crt

(2 spaces before each line). That is the IP address of my Lutron Hub. when I run
python get_lutron_cert.py then I get:

root@hassbian:/home/homeassistant/.homeassistant# python get_lutron_cert.py
File “get_lutron_cert.py”, line 18
host: 192.168.20.36

IndentationError: unexpected indent

I have tried this without any indenting and I get:

root@hassbian:/home/homeassistant/.homeassistant# python get_lutron_cert.py
File “get_lutron_cert.py”, line 18
host: 192.168.20.36
^
SyntaxError: invalid syntax

Could someone tell me if this is the way I should run this and what my probably is?

Thanks very much.

I should have mentioned my version: Home Assistant
0.69.1

You aren’t meant to uncomment those lines in the python script. Those comments at the beginning are just telling you how to set up a venv with the script prereqs and then also how to add the component to your Home Assistant configuration.yaml. Recomment those lines and run the script again.

Thank you for your help. I nuked my modified get_lutron_cert.py file and downloaded again so it’s original.

I run it now like:

sudo python get_lutron_cert.py and I get:

pi@hassbian:/home/homeassistant/.homeassistant$ sudo python get_lutron_cert.py
Traceback (most recent call last):
File “get_lutron_cert.py”, line 25, in
import requests
ImportError: No module named requests
pi@hassbian:/home/homeassistant/.homeassistant$

Line 25 states:

import requests

Any suggestions as to where I go from here?

Thanks again.

Yes - you need to follow the other instructions at the top of the py file. Do this:

  1. Move the py file into a directory.
  2. python3 -m venv [directory]
  3. source [directory]/bin/activate
  4. pip install cryptography==2.1.3 requests==2.18.4
  5. cd [directory]
  6. python get_lutron_cert.py
2 Likes

Thanks for those excellent directions. I got through it ok until line # 6.I am sure I missed something that you were telling me.

I got a "Open Browser and login at https://XXXXX
Enter the URL (of the “error” page you got redirected to (or code in the URL).
I put the code in the https:// line
and got back “Enter the address of your Caseta bridge device” I put that in and then got:

Enter the address of your Caseta bridge device: 192.168.20.36
Traceback (most recent call last):
File “get_lutron_cert.py”, line 156, in
leap_response[‘Body’][‘PingResponse’][‘LEAPVersion’])
KeyError: ‘Body’
(.homeassistant) root@hassbian:/home/homeassistant/.homeassistant#

Once I got the “Enter the ip address:” I thought it was going to work for me.

Or maybe it did?

I now have:
caseta-bridge.crt
caseta.crt
caseta.key

So it appears it works as expected?

Thank you so much for all of your help. I hope this help others as well. I don’t mean to be stupid, but I am trying to learn how to do this and again I appreciate all of your help.

I just verified that I now how what I needed and re-ran the configuration and now I have the lutron devices in hassbian

Thank you kindly, Marthocoo for your time and consideration in the help. I am so grateful.

This is awesome. I would have never figured it out without your help.

Thanks!

1 Like