Lutron Configuration in 0.37

you’ll need to clone my fork of the code, but I don’t have it fully working yet, I’ll update once I get it tested.

Cool…which part works and which part doesn’t? (i.o.w.: what can you control/do now and what not?)

I’d be more than happy to help or test your code.

So, installing your fork individually is enough? That just taps into the python-caseta code?
Or are there any other manual actions required? (other than creating that config.json file in the same directory as configuration.yaml)

I cloned the git and edited the test.py. Throws an error when I run test.py as Pi user, but seems to work when I run it in virtual environment (where HASS is running too). Now, it is currently installed in the site-packages folder. Can it remain there or does it need to be copied into the HASS depts folder?

Any updates/info regarding progress or my questions, Scott?

I too am very interested in this- would love for lutron caseta to work with ha

Are you able to successfully connect to the Lutron Pro2 hub?

I keep receiving the following errors (and I did update to the latest version you committed 3 days ago):

17-03-01 12:26:43 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component lutron
Traceback (most recent call last):
  File "/usr/lib/python3.4/urllib/request.py", line 1174, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python3.4/http/client.py", line 1090, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 859, in send
    self.connect()
  File "/usr/lib/python3.4/http/client.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.4/socket.py", line 509, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 500, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 153, in _async_setup_component
    None, component.setup, hass, config)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/lutron.py",     line 39, in setup
    hass.data[LUTRON_CONTROLLER].load_xml_db()
  File "/home/homeassistant/.homeassistant/deps/pylutron/__init__.py", line 384, in load_xml_db
    xmlfile = urllib.request.urlopen('http://' + self._host + '/DbXmlInfo.xml')
  File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.4/urllib/request.py", line 455, in open
    response = self._open(req, data)
  File "/usr/lib/python3.4/urllib/request.py", line 473, in _open
    '_open', req)
  File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 1202, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.4/urllib/request.py", line 1176, in do_open
    raise URLError(err)
  urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

Yup successfully working with my Pro2 hub. It looks like its trying to connect as a RadioRA2 hub which makes sense since I forgot to share how to set the config.

with the current pushed version the config should look like this::

lutron:
lutron_host: “10.0.1.242”
lutron_user: “lutron”
lutron_password: “integration”
lutron_caseta: “true”
lutron_caseta_config: “caseta_config.json”

I’m getting the same errors. I’m pretty new to importing custom code, so forgive me if I missed something obvious.

Here’s what I did to install the component:

I replaced /usr/local/lib/python3.4/dist-packages/pylutron/init.py with the version from your github.
I exported the Integration Report from the Lutron app and saved it as caseta_config.json in the same directory as configuration.yaml.

Did I miss something?

Here’s my config:

lutron:
  lutron_host: "10.1.1.24"
  lutron_user: "lutron"
  lutron_password: "integration"
  lutron_caseta: "true"
  lutron_caseta_config: "caseta_config.json"

Here’s the error messages:

17-03-02 23:50:45 INFO (MainThread) [homeassistant.bootstrap] Setting up lutron
17-03-02 23:50:45 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component lutron
Traceback (most recent call last):
  File "/usr/lib/python3.4/urllib/request.py", line 1182, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python3.4/http/client.py", line 1125, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1163, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1121, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 951, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 886, in send
    self.connect()
  File "/usr/lib/python3.4/http/client.py", line 863, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.4/socket.py", line 512, in create_connection
    raise err
  File "/usr/lib/python3.4/socket.py", line 503, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 153, in _async_setup_component
    None, component.setup, hass, config)
  File "/usr/lib/python3.4/asyncio/futures.py", line 386, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 287, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 275, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/lutron.py", line 39, in setup
    hass.data[LUTRON_CONTROLLER].load_xml_db()
  File "/usr/local/lib/python3.4/dist-packages/pylutron/__init__.py", line 388, in load_xml_db
    xmlfile = urllib.request.urlopen('http://' + self._host + '/DbXmlInfo.xml')
  File "/usr/lib/python3.4/urllib/request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.4/urllib/request.py", line 463, in open
    response = self._open(req, data)
  File "/usr/lib/python3.4/urllib/request.py", line 481, in _open
    '_open', req)
  File "/usr/lib/python3.4/urllib/request.py", line 441, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 1210, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.4/urllib/request.py", line 1184, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

Making progress on the Pico remotes, should have them working very soon.

It looks like it is heading down the RadioRA2 path (which querys the configuration via loading an XML from the hub, the caseta pro series hubs doesn’t have that feature so you get the connection refused errors).

To recap; you need the following:
My fork of home assistant: GitHub - scottjgibson/home-assistant: 🏡 Open-source home automation platform running on Python 3
My fork of pylutron: GitHub - scottjgibson/pylutron
The following keys in your configuration.yaml:

lutron:
  lutron_host: "X.X.X.X"
  lutron_user: "lutron" 
  lutron_password: "integration"
  lutron_caseta: "true"
  lutron_caseta_config: "caseta_config.json"

Once I get the Pico remotes working I’ll likely clean up the configuration keys (better naming and defaults for user/pass), but for the current commits what is above should work. I would love to find a way to get the json config automatically but as far as I know it has to be a manual activity.

Scott

2 Likes

I have the Lutron Caseta (non-Pro) hub and from the iOS app, under settings > advanced is just two options (Time and Location, Range Extender). Not sure why I can’t see the Integration Report. Any ideas??

Unfortunately the integration interface (telnet) and integration report is only available on the pro hub.

Scott

That’s what I thought. So does this mean the non-pro hubs are SOL? Or could there be a version that reads the config from them at some point in the future? I currently have only one lutron switch, the rest of my lights are Hue so it’s not a deal breaker, but it’s also annoying to have the one light that doesn’t respond to any of my HA scenes :wink:

As far as I know there isn’t another way to integrate the non-pro hub. Previously I used a rooted wink hub to provide MQTT support for lutron, but I found it unstable so I got the pro hub.

I would too if I had more than one light switch. I may expand if I go for the blinds at some point if/when it’s in HA. Thanks for your help!

Aha, looks like I needed the components/lutron.py from your fork. Using those two files, it works! Instantaneous local control of my Caseta switches. Now I just need a good Zigbee radio and I can ditch my Wink hub entirely.

Thanks a lot @scottjgibson, I really hope this gets included in the GA code. If you need someone to test the pico remotes (or any new code), let me know, I’ve got a bunch of them.

Just gave this a try, and it worked perfectly for me! (One wired-in caseta wall dimmer, one plug-in lamp dimmer that I wired in to my ceiling fan’s light and control via pico remote – both work perfectly.) Thanks. :slight_smile:

Looking forward to giving this a try @scottjgibson …thanks for your efforts! There is some really good code here: http://forum.micasaverde.com/index.php/topic,35577.0.html although written in LUA cybrmage has pretty much discovered everything there is to know about the Lutron SmartBridge. His plugin supports both the SmartBridge and SmartBridge Pro as well as automatically pulls in the device configuration.

Anyhow, thought it might be something that would provide a helpful reference!

@scottjgibson Thank you so much for your work on this! Been waiting to finally move my Caseta switches off of my Wink hub and have them controlled locally. I bought a SmartBridge Pro and got it all setup yesterday. So far, it’s running great.

One thing I wanted to mention though, on my setup, I placed caseta_config.json in the same directory as my configuration.json, but I kept getting errors that the file was not found. I was able to make it work once I put the full path to the file in the config.

So I’ve been working on getting the pico remotes to work. So far I have the config file parsing working and binary sensors created for each button. pylutron is updated and handles the button updates, but I can’t get home assistant’s representation of the buttons to update. If any dev’s have some time to take a look it would be really appreciated.

Can someone tell me how to install this into my current installation of Home Assistant?

Just upgrade HA to the latest version and add the following to your config.

lutron_caseta:
    host: bridge_ip_address