Skip to content

Instantly share code, notes, and snippets.

@TonyApuzzo
Last active January 31, 2020 22:01
Show Gist options
  • Save TonyApuzzo/ba5de8293e1387472dda023cb1fbe2e6 to your computer and use it in GitHub Desktop.
Save TonyApuzzo/ba5de8293e1387472dda023cb1fbe2e6 to your computer and use it in GitHub Desktop.
<!-- READ THIS FIRST:
- If you need additional help with this template, please refer to https://www.home-assistant.io/help/reporting_issues/
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
- Do not report issues for integrations if you are using custom components or integrations.
- Provide as many details as possible. Paste logs, configuration samples and code into the backticks.
DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed without comment.
-->
## The problem
<!--
Describe the issue you are experiencing here to communicate to the
maintainers. Tell us what you were trying to do and what happened instead.
-->
As documented in [this thread](https://community.home-assistant.io/t/lutron-caseta-suddenly-stopped-working/161390) the Lutron Caseta integration fails after several hours to days and can only be reset by restarting the Home Asssistant server, after which time the services work fine for an indeterminate period but ultimately will fail within a few hours to days of server uptime.
See the linked forum thread for more examples of other people with this problem.
## Environment
<!--
Provide details about the versions you are using, which helps us to reproduce
and find the issue quicker. Version information is found in the
Home Assistant frontend: Developer tools -> Info.
-->
- Home Assistant release with the issue: 0.103
- Last working Home Assistant release (if known):
0.102 (or maybe 0.101)
- Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io
- Integration causing this issue:
lutron_caseta
- Link to integration documentation on our website:
https://www.home-assistant.io/integrations/lutron_caseta/
## Problem-relevant `configuration.yaml`
<!--
An example configuration that caused the problem for you. Fill this out even
if it seems unimportant to you. Please be sure to remove personal information
like passwords, private URLs and other credentials.
-->
```yaml
# Lutron Caseta
lutron_caseta:
host: !secret lutron_caseta_host
keyfile: /ssl/caseta.key
certfile: /ssl/caseta.crt
ca_certs: /ssl/caseta-bridge.crt
```
## Traceback/Error logs
<!--
If you come across any trace or error logs, please provide them.
-->
At startup, everything looks good:
```txt
2020-01-30 15:48:39 DEBUG (MainThread) [homeassistant.components.lutron_caseta.switch] {'device_id': '9', 'current_state': 0, 'fan_speed': None, 'zone': '5', 'name': 'Front Foyer_Chandelier', 'type': 'WallSwitch', 'model': 'PD-8ANS-XX', 'serial': 2668XXXX}
2020-01-30 15:48:39 DEBUG (MainThread) [homeassistant.components.lutron_caseta.switch] {'device_id': '10', 'current_state': 0, 'fan_speed': None, 'zone': '6', 'name': 'Front Porch_Light', 'type': 'WallSwitch', 'model': 'PD-8ANS-XX', 'serial': 2668XXXX}
2020-01-30 15:48:39 DEBUG (MainThread) [homeassistant.components.lutron_caseta.switch] {'device_id': '4', 'current_state': 0, 'fan_speed': None, 'zone': '2', 'name': 'Kitchen_Lights', 'type': 'WallSwitch', 'model': 'PD-8ANS-XX', 'serial': 2668XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '13', 'current_state': -1, 'fan_speed': None, 'zone': '9', 'name': 'Master Bedroom_Cove Lights', 'type': 'WallDimmer', 'model': 'PD-6WCL-XX', 'serial': 3365XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '5', 'current_state': 0, 'fan_speed': None, 'zone': '3', 'name': 'Dining Room_Chandelier', 'type': 'WallDimmer', 'model': 'PD-6WCL-XX', 'serial': 2728XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '12', 'current_state': -1, 'fan_speed': None, 'zone': '8', 'name': 'Upstairs Hallway_Landing', 'type': 'WallDimmer', 'model': 'PD-10NXD-XX', 'serial': 2807XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '11', 'current_state': -1, 'fan_speed': None, 'zone': '7', 'name': 'Living Room_Table', 'type': 'PlugInDimmer', 'model': 'PD-3PCL-WH', 'serial': 1942XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '3', 'current_state': 0, 'fan_speed': None, 'zone': '1', 'name': 'Family Room_Landing', 'type': 'WallDimmer', 'model': 'PD-6WCL-XX', 'serial': 3357XXXX}
2020-01-30 15:48:40 DEBUG (MainThread) [homeassistant.components.lutron_caseta.light] {'device_id': '7', 'current_state': 0, 'fan_speed': None, 'zone': '4', 'name': 'Family Room_Floor Lamp', 'type': 'PlugInDimmer', 'model': 'PD-3PCL-WH', 'serial': 1930XXXX}
```
Eventually some strange errors occur:
```txt
2020-01-31 07:03:58 WARNING (MainThread) [pylutron_caseta.smartbridge] ping was not answered. closing connection.
2020-01-31 07:04:03 WARNING (MainThread) [pylutron_caseta.smartbridge] reconnecting
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 260, in _monitor
loop=self._loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 449, in wait_for
raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
2020-01-31 07:04:08 CRITICAL (MainThread) [pylutron_caseta.smartbridge] monitor loop has exited
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 260, in _monitor
loop=self._loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 322, in _login
self._reader, self._writer = yield from self._connect()
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 64, in _connect
family=socket.AF_INET)
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/leap.py", line 16, in open_connection
limit=limit, **kwds)
File "/usr/local/lib/python3.7/asyncio/streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 958, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 945, in create_connection
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
return await fut
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('LUTRON_IP', 8081)
```
Subsequent calls to lutron caseta fail:
```txt
2020-01-31 07:13:36 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 576, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/components/lutron_caseta/light.py", line 45, in async_turn_on
self._smartbridge.set_value(self.device_id, to_lutron_level(brightness))
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 189, in set_value
return self._writer.write(cmd)
AttributeError: 'NoneType' object has no attribute 'write'
2020-01-31 07:13:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on openevse/amp: b'0'
2020-01-31 07:13:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on openevse/wh: b'477788'
2020-01-31 07:13:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on openevse/temp1: b'145'
2020-01-31 07:13:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on openevse/pilot: b'30'
2020-01-31 07:13:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 576, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/components/lutron_caseta/light.py", line 45, in async_turn_on
self._smartbridge.set_value(self.device_id, to_lutron_level(brightness))
File "/usr/local/lib/python3.7/site-packages/pylutron_caseta/smartbridge.py", line 189, in set_value
return self._writer.write(cmd)
AttributeError: 'NoneType' object has no attribute 'write'
```
## Additional information
Note that my Lutron configuration has been working for over a year, and it will briefly work again upon each restart of HASS. Restarting the Lutron bridge has no effect that I've noticed on this problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment