Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lutron Caseta component works at startup but eventually fails #31361

Closed
TonyApuzzo opened this issue Jan 31, 2020 · 19 comments · Fixed by #33815
Closed

Lutron Caseta component works at startup but eventually fails #31361

TonyApuzzo opened this issue Jan 31, 2020 · 19 comments · Fixed by #33815

Comments

@TonyApuzzo
Copy link

TonyApuzzo commented Jan 31, 2020

The problem

As documented in this thread 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

  • Home Assistant release with the issue: 0.103 - 0.107.5

  • Last working Home Assistant release (if known):
    0.102 (or maybe 0.101, I am not completely sure when it started.)

  • Operating environment (Hass.io/Docker/Windows/etc.):
    Hass.io 3.8 on ODroid XU4

  • 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

# 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

At startup, everything looks good:

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:

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:

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.

@vivektiwari1986
Copy link

Having the same issue. Lutron works at startup, but eventually stops works within a day. After restart, it works again.

@holelattanuttin
Copy link

I have had the same issue the past couple of days. I had to restart HA but I haven't tried anything else. My Lutron Android App also just updated, so it is possible it is Lutron.

@TonyApuzzo
Copy link
Author

TonyApuzzo commented Feb 1, 2020

I verified that this problem is still occurring on 0.105.0b3 0.105.2, and will update the main issue text accordingly as I test newer versions.

@pi642s
Copy link

pi642s commented Feb 8, 2020

still having the same issue

@holelattanuttin
Copy link

I am running 0.104.0 and since I restarted HA and cold booted the Lutron Caseta bridge 7 days ago, it has not happened. It would be interesting to understand from others what they did to fix it after the symptoms and how long it took the symptoms to come back.

@holelattanuttin
Copy link

Correction. It just happened and I had to cold boot the lutron box and then restart HA.

@TonyApuzzo
Copy link
Author

TonyApuzzo commented Feb 16, 2020

With 0.105.4, so far, the lutron connection has been stable. I don't think anything changed in 0.105.4 that would affect this, so maybe something changed in the lutron hub.

Edits:

  • 2012-02-17: Redid my DHCP configuration to enforce static IP for the lutron hub, might be contributing to stability.
  • 2012-02-20: HA version 0.105.5; lutron has been stable for me for more than 24 hours.
  • 2012-02-22: Sadly, 0.105.5 failed sometime in the last day. The problem didn't fix itself.

@jpearce73
Copy link

I am just adding my vote to this one, I have exactly the same symptoms.
It's not very frequent, sometimes a month can go by which makes reporting the bug by HA version difficult.

My "anecdotal report" is that I never saw this before the 0.100+ series. I've been running HA since about 0.83 and was using Lutron Integration from the beginning. I never had any problems until the last couple of months and going beyond 0.100. I don't know if the Lutron hub has been updating its version in the meantime.

@Tadimsky
Copy link

I'm having the same problem. I also feel like it's been happening only in the last few releases.

Happened 959 times over the last 30 days:

image

@JoeyG1973
Copy link

I too can verify I am having this issue with the last coupe of releases. Currently on 0.105.5

@chadmccune
Copy link

I'm also having this issue, considering ordering a pro hub just to switch to the custom component :/

@chadmccune
Copy link

I would also add, that when this happens, even the Lutron app appears to stop working, in that, if you open the app and try, it will seem like it doesn't work. For example, you turn a light off, the light stays on, but then, several minutes later it turns off...Its as if the hub is being flooded by home assistant and gets behind. However, as soon as you restart home assistant, the app starts responding instantly again.

@TonyApuzzo
Copy link
Author

I would also add, that when this happens, even the Lutron app appears to stop working, in that, if you open the app and try, it will seem like it doesn't work. For example, you turn a light off, the light stays on, but then, several minutes later it turns off...Its as if the hub is being flooded by home assistant and gets behind. However, as soon as you restart home assistant, the app starts responding instantly again.

For me, this is not the case. When HA stops working with Lutron, I can still use Alexa, Google Assistant, and the Lutron Android app and they all continue working.

@wacarlton
Copy link

wacarlton commented Mar 11, 2020

Having the same issue as well. Updated Core and HassOS to 0.106.6 and 3.12. Once the Caseta lights stop working w/ Home Assistant, they also are flaky with the iOS Lutron app. Here's my stacktrace:

2020-03-11 09:03:09 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2844344272] 'NoneType' object has no attribute 'write'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1230, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 243, in async_handle_light_on_service
    await light.async_turn_on(**params)
  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'

@NLVMike
Copy link

NLVMike commented Apr 6, 2020

Hi, so this is still a problem for me, even on the 108 beta -- haven't seen any updates in nearly a month, and wondering when I'll be able to stop rebooting my HomeAssistant VM multiple times per day?

@TonyApuzzo
Copy link
Author

It appears, based on work happening in the pylutron-caseta base library. that the devs are attempting to have this patched for the 0.108 release. The current 0.108.4 beta does not have the fix yet from what I can tell looking at github though.

@swails
Copy link
Contributor

swails commented Apr 7, 2020

We are waiting on pylutron-caseta 0.6.1 to be released with this and another fix. Once it is, we can bump the required version in hass and close this issue as fixed.

@dan040790
Copy link

Sorry to re-open this, but I'm now having this exact issue. Same error messages and everything.

@Sperryfreak01
Copy link

I am also having this issue, just started out of the blue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.