A simple utility to generate signed certificate files to allow local control of a Lutron Caseta smart bridge.
About
This add-on will guide you through the necessary steps to create signed certificate files necessary to control your Lutron Caseta smart bridge with Home Assistant.
Three files will be created during successful execution of the wizard:
/ssl/lutron/caseta.key: the private key file used to generate the certificate.
/ssl/lutron/caseta.crt: the signed certificate file used to connect to the Lutron Caseta bridge.
/ssl/lutron/caseta-bridge.crt: the certificate authority file that is downloaded from the Lutron Caseta bridge.
Be sure to add Lutron Caseta to your configuration.yaml after starting the add-on:
The primary goal of our add-ons project is to provide you (as a Home Assistant user) with additional, high quality, add-ons that allow you to take your automated home to the next level.
For me it gives me a 500 Internal server error, but still generates a caseta.key file. I am missing caseta.crt and caseta-bridge.crt. Here’s my log output:
I found it, and copied the files into my config folder - having no luck with this. I’m getting the following error:
Error during setup of component lutron_caseta
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 148, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/lutron_caseta.py”, line 51, in setup
keyfile=_keyfile,certfile=_certfile,ca_certs=_ca_certs)
File “/config/deps/lib/python3.6/site-packages/pylutron_caseta/smartbridge.py”, line 63, in connect
return cls(_connect)
File “/config/deps/lib/python3.6/site-packages/pylutron_caseta/smartbridge.py”, line 38, in init
self._loop.run_until_complete(self._login())
File “uvloop/loop.pyx”, line 1448, in uvloop.loop.Loop.run_until_complete
File “/config/deps/lib/python3.6/site-packages/pylutron_caseta/smartbridge.py”, line 287, in _login
yield from self._load_devices()
File “/config/deps/lib/python3.6/site-packages/pylutron_caseta/smartbridge.py”, line 317, in _load_devices
for device in device_json[‘Body’][‘Devices’]:
KeyError: ‘Body’
When trying to run the add-on, I get a 500 Internal Error:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Below is from the log. Can anyone help me out and whether or not this add-on is still functional or if there is a workaround?
INFO: Starting Lutron certificate server
Serving Flask app “cert_server” (lazy loading)
Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
Debug mode: off
Running on http://0.0.0.0:5817/ (Press CTRL+C to quit)
XXX.XXX.XXX.XXX - - [18/Jan/2019 07:12:06] “GET / HTTP/1.1” 200 -
[2019-01-18 07:12:21,114] ERROR in app: Exception on /process_url [POST]
Traceback (most recent call last):
File “/etc/lutron/cert_server.py”, line 91, in get_certificate
with open(CERT_FILE, ‘rb’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/ssl/lutron/caseta.crt’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/flask/app.py”, line 2292, in wsgi_app
response = self.full_dispatch_request()
File “/usr/lib/python3.6/site-packages/flask/app.py”, line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/lib/python3.6/site-packages/flask/app.py”, line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python3.6/site-packages/flask/_compat.py”, line 35, in reraise
raise value
File “/usr/lib/python3.6/site-packages/flask/app.py”, line 1813, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/lib/python3.6/site-packages/flask/app.py”, line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File “/etc/lutron/cert_server.py”, line 253, in process_url
get_certificate(oauth_code)
File “/etc/lutron/cert_server.py”, line 134, in get_certificate
app_cert = pairing_response[‘remote_signs_app_certificate’]
KeyError: ‘remote_signs_app_certificate’
XXX.XXX.XXX.XXX - - [18/Jan/2019 07:12:21] “POST /process_url HTTP/1.1” 500 -
Hi. Thanks for this. Installed flawlessly. No errors. Log looks fine. One problem I am seeing is HA does not seem to be able to track the status of a device. I can turn it on but that’s pretty much it. Am I missing something?
@TurboJones, yes, I believe I just started completely over with the bridge. Since this was the initial install, it was no big deal. IIRC, I believe you have to take the url from the 500 error page and post it into the Cert Web UI.
Thanks. It’s good to know I’m not the only one. I’ve manged to get things working for now through the SmartThings integration, but it’s a bit of a kludge, plus the HA is local (I think) which I prefer.