Home Assistant Community Add-on: Lutron Certificate

This add-on is provided by the Home Assistant Community Add-ons project.

GitHub Release GitLab CI Project Stage Project Maintenance

Supports armhf Architecture Supports armv7 Architecture Supports aarch64 Architecture Supports amd64 Architecture Supports i386 Architecture

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:

lutron_caseta:
  host: 192.168.1.100
  keyfile: /ssl/lutron/caseta.key
  certfile: /ssl/lutron/caseta.crt
  ca_certs: /ssl/lutron/caseta-bridge.crt

For more information on how to configure Lutron Caseta in Home Assistant see the Lutron Caseta documentation.

Installation


The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

  1. Search for the “Lutron Certificate” add-on in the add-on store and install it.
  2. Start the “Lutron Certificate” add-on.
  3. Check the logs of the “Lutron Certificate” add-on to see if everything went well.
  4. Open the web UI for the “Lutron Certificate” add-on and follow the steps.
  5. Configure Lutron Caseta in your configuration.yaml file.

Support


You can always try to get support from the community here at the Home Assistant community forums, join the conversation!

Questions? You have several options to get them answered:

You could also open an issue on GitHub, in case you ran into a bug, or maybe you have an idea on improving the add-on:

:information_source: At this moment our Home Assistant Community Add-ons Discord chat server and GitHub are our only official support channels. All others rely on community effort.

Repository on GitHub


Looking for more add-ons?


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.

Check out some of our other add-ons in our Home Assistant Community Add-ons project.

3 Likes

(reserved for future use)

Worked great! Thank you so much for this add-on!!

1 Like

Worked perfectly, so much easier than the old method. Thanks so much!

I do not see the /ssl/lutron/ directory being created.

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:

https://pastebin.com/7SawGpBF

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 -

Did you ever figure out the internal server error?

I removed the hub from HA, reset it, and signed up with a new email address. That worked.

:tada: Release v0.2.0

Full Changelog

Changes

  • :truck: Moves server files to /opt
  • :beetle: Removes debug maps in config.json
  • Configure Renovate (#1)
  • :fireworks: Updates maintenance year to 2019
  • :fire: Removes BountySource links
  • :hammer: Makes log_level optional
  • :fire: Removes custom log format override
  • :arrow_up: Upgrades add-on base image to 3.0.1 + ARMv7 support
  • :books: Updates documentation for ARMv7
  • :hammer: Rewrite add-on onto Bashio
  • :hammer: Moves Python requirement into a requirements file
  • :arrow_up: Upgrades python3 to 3.6.8-r1
  • :arrow_up: Upgrades py3-cryptography to 2.4.2-r2

Questions? Join our Discord server! https://discord.me/hassioaddons

:tada: Release v0.2.1

Full Changelog

This is a maintenance release and does not have breaking changes.

Changes

  • :arrow_up: Upgrades add-on base image to Python 1.1.0
  • :sparkles: Adds port descriptions
  • :hammer: Refactor add-on to be compatible with new base image

Questions? Join our Discord server! https://discord.me/hassioaddons

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?

Tried to create the cert today and got the 500 error. Logs say OAuth retry issue.

@BigMal were you able to resolve this without completely resetting your Lutron hub or did you have to rebuild Lutron from scratch?

more info, I’m also seeing a file not found error. wonder if it’s permissions related?

I installed hassio with sudo/admin but maybe the addon can’t create files?

@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.

@Phillip_Sperry, there appears to a widespread issue with users experiencing the same issue as you. I’m having the same issue…it’s PITA.

https://community.home-assistant.io/t/lutron-caseta-switches-lose-state/108568/24

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.

:tada: Release v0.2.2

Full Changelog

This is a maintenance release and does not have breaking changes.

:hammer: Changes

  • :arrow_up: Updates requests to v2.22.0 (#3)
  • :arrow_up: Updates Flask to v1.0.3 (#4)

Questions? Join our Discord server! https://discord.me/hassioaddons

:tada: Release v0.3.0

Full Changelog

This is a maintenance release and does not have breaking changes.

:hammer: Changes

  • :pencil2: Maintaince -> Maintenance
  • :arrow_up: Upgrades openssl-dev to 1.1.1c-r0
  • :arrow_up: Upgrades dbus to 1.12.16-r0
  • :sparkles: Adds Hass.io wheels
  • :arrow_up: Updates Flask to v1.1.1 (#6)
  • :arrow_up: Updates cryptography to v2.7 (#5)
  • :arrow_up: Upgrades add-on base image to v2.1.0
  • :ambulance: Ensure we have a DBus UUID at any time

Questions? Join our Discord server! https://discord.me/hassioaddons