Lutron Caseta Bridge Pro Custom Component Install


#1

Hey everyone, I just finished a Home Assistant install (0.83.2) in virtualenv on a FreeNAS 11.2 jail yesterday, so far so good. Still very new to all of this.

I got stuck on trying to configure a Lutron Caseta Pro hub/bridge, following the upsert custom component method. After dumping the files into the custom_components directory alongside my configuration.yaml and attempting to restart HA via the GUI, here’s what the log reports:

Log Details (ERROR)
Mon Dec 03 2018 22:08:36 GMT-0600 (CST)
Error executing service <ServiceCall homeassistant.restart (c:df17676cd5964032a6e4095b5ba1180e)>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
await service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/__init__.py", line 129, in async_handle_core_service
errors = await conf_util.async_check_ha_config_file(hass)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/config.py", line 796, in async_check_ha_config_file
check_ha_config_file, hass)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 340, in check_ha_config_file
component = loader.get_component(hass, domain)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/loader.py", line 92, in get_component
module = importlib.import_module(path)
  File "/srv/homeassistant/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/hass/homeassistant/custom_components/lutron_caseta_pro.py", line 24, in <module>
from . import casetify
  File "/home/hass/homeassistant/custom_components/casetify.py", line 98, in <module>
class Casetify:
  File "/home/hass/homeassistant/custom_components/casetify.py", line 101, in Casetify
loop = asyncio.get_event_loop()
  File "/usr/local/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
return get_event_loop_policy().get_event_loop()
  File "/usr/local/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'SyncWorker_62'.

I doubled checked my config, IP and mac address check out:

## Lutron Caseta Pro
lutron_caseta_pro:
    bridges:
      - host: 10.0.1.30
        mac: !secret mac_address

“Telnet Support” in the app is enabled. I have a duckdns hostname set up with SSL and port forwarding, all working as expected as far as I can tell. I looked at other faqs and posts, thankfully didn’t see any call for port forwarding or anything to the bridge.

Any ideas what I might be missing? Thanks in advance!


#2

Bump. Anyone have any ideas? Still can’t seem to get this custom component installed. I’d be super grateful for any help.


#3

I narrowed this down to an issue with “asyncio” and it not cooperating with multithreading? I overcame this by changing line 101 in casetify.py from:

loop = asyncio.get_event_loop()

to

loop = asyncio.new_event_loop()

I don’t know enough about this configuration to foresee whether or not this will create issues down the road, but it finally got me to the Lutron configurator on HASS.