Hassbian - GET_LUTRON_CERT.PY not working

Hi,

I’m so close (I think) to get my Lutron lights working again after I switched from Raspbian&HASSIO to HASSBIAN. I followed the following steps and everything is looking good until the last step :frowning:

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

Getting the following error:

   Traceback (most recent call last):
  File "get_lutron_cert.py", line 64, in <module>
    with open('caseta.key', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'caseta.key'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "get_lutron_cert.py", line 70, in <module>
    with open('caseta.key', 'wb') as f:
PermissionError: [Errno 13] Permission denied: 'caseta.key'

Any help very much appreciated!
Thanks Hermen

I might be the only one that is struggling with enabling the lutron caseta to home assistant, but just in case other newbies are experiencing the same issues, I decided to document my journey, which has not ended yet :frowning:

One of the mistakes I made with the directions mentioned in the get_lutron_cert.py script is:

  1. that I did not understand where I was in the directory path using the e.g. the putty terminal. I installed HASSBIAN and I am loging in with the ‘PI’ user id. This is NOT the directory path where home assistant is located. cd / brings you to the root and from therefore you can go up the tree to homeassistant. (there are 2 directories for homeassistant. The 2nd one .homeassistant is where the files are.
  2. Run the get_lutron_cert.py in a directory where the user you logged on with (in putty), has write permission. In my case I logged on with ‘PI’, but homeassistant had the write permission to the folder and this resulted in the permission error in the above post. Run ls -l to check the permission and I used sudo -u homeassistant -H -sto resolve that issue (thank you Matthew Donoughe).
  3. After you login to the Lutron WEBUI, get the error, copy-past the URL into the terminal and enter the IPaddress of the caseta hub, you should get the message that ‘a successful connection to your hub’ (Don’t celebrate too early, because you are not there yet)
    4.1 the 3 files are in the directory from which you execute the get_lutron_cert.py command and at this moment I am still not clear where to copy these files to. The documentation states 'Once you have the three necessary files, place them in your configuration directory. (I believe that the 'configuration directory is the directory where e.g. configuration.yaml is located, but I am not sure)
    4.2. update the configuration.yaml file with the lutron_caseta:entries (see the Lutron Caseta documentio at the home assistant website.

After hours of trial and error and multiple emails to Matthew, I still don’t have the Lutron caseta working (invalid config) error in home assistant with the following errors in the log. I’ll update my post if I eventually get it to work, but I might have to bite the bullet and switch to the Pro version of the bridge, because this way too time consuming.

LOG:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 145, in _async_setup_component
hass, processed_config)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/lutron_caseta.py”, line 55, in async_setup
await bridge.connect()
File “/srv/homeassistant/lib/python3.5/site-packages/pylutron_caseta/smartbridge.py”, line 40, in connect
yield from self._login()
File “/srv/homeassistant/lib/python3.5/site-packages/pylutron_caseta/smartbridge.py”, line 281, in _login
self._reader, self._writer = yield from self._connect()
File “/srv/homeassistant/lib/python3.5/site-packages/pylutron_caseta/smartbridge.py”, line 58, in _connect
family=socket.AF_INET)
File “/srv/homeassistant/lib/python3.5/site-packages/pylutron_caseta/leap.py”, line 16, in open_connection
limit=limit, **kwds)
File “/usr/lib/python3.5/asyncio/streams.py”, line 75, in open_connection
lambda: protocol, host, port, **kwds)
File “/usr/lib/python3.5/asyncio/base_events.py”, line 801, in create_connection
sock, protocol_factory, ssl, server_hostname)
File “/usr/lib/python3.5/asyncio/base_events.py”, line 827, in _create_connection_transport
yield from waiter
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/sslproto.py”, line 502, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File “/usr/lib/python3.5/asyncio/sslproto.py”, line 201, in feed_ssldata
self._sslobj.do_handshake()
File “/usr/lib/python3.5/ssl.py”, line 641, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)

after 20-30 hours resolving one error after the other, with the help of a few folks much smarted than I am, I decided to give up, because this is way too complex for a simple IT guy. It worked great with HASSIO, but with HASSBIAN setting up the non-pro version of lutron caseta has been an absolute nightmare. Will order the PRO version because 80% of my lights are Lutron… unfortunately

I have the same error:

  File "/usr/lib/python3.5/asyncio/sslproto.py", line 201, in feed_ssldata
    self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 641, in do_handshake
    self._sslobj.do_handshake()
  ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)

I am also on hassbian.

The thing is however for me that it worked fine and I have not touched the caseta configuration.

I even regenerated the certificates but still the same certificate issue.

I don’t know if they Lutron has pushed some update to the hub that broke this or if there is something else.

I would be happy to know if there is a known reason behind this.

I wish I could help, but instead of getting the PRO version I reverted back to HASSIO only because of Lutron, which is 90% of the lighting in my house. I got some help from the guys that updated this development in GITHUB, but I got to a point that I was ready to jump out of a 8 story building and it was just not worth it. HASSIO also gave me some errors, but when I used the certificates generated during this complex HASSBIAN Lutron installation process, I got it to work in HASSIO. Not touching Lutron anymore :slight_smile:

So in hassio it works fine?

Then I guess it is not the lutron hub that broke.

I think I might have to give up some other integrations though if I give up hassbian and switch to hassio :frowning:
Need to investigate that further if all my use cases are possible with hassio.

Yes, I had HASSIO working before I switched to HASSBIAN and got it working again when I used the certificates that were generated while using HASSBIAN.

I just switched from hassbian to running home assistant in docker on the raspberry.

Reused all config and I can confiem that lutron works fine, so it seems it seems to be a version issue, that the latest hassbian as of now does not work with lutron while the latest docker image works fine.

Now I just need to find out how to use tellstick from within a docker home assistant, but that is another story :slight_smile:

1 Like

Got the same issue for the latest 0.88.1 :frowning:

Found a temp fix here - https://github.com/home-assistant/home-assistant/issues/15421#issuecomment-459453030