Open RGarrett93 opened 6 months ago
In the lightwave_smart
Home Assistant integration, the service_handle_reconnect
function currently relies on directly accessing a nonexistent _websocket
attribute from the LWLink2
object. This leads to an AttributeError when the lightwave_smart.reconnect
service is called.
async def service_handle_reconnect(call):
_LOGGER.debug("Received service call reconnect")
for entry_id in hass.data[DOMAIN]:
link = hass.data[DOMAIN][entry_id][LIGHTWAVE_LINK2]
try:
# Close the existing WebSocket connection if it exists
if link._ws and link._ws._websocket is not None:
_LOGGER.debug("Closing existing WebSocket connection...")
await link._ws._websocket.close()
else:
_LOGGER.debug("No WebSocket connection to close.")
except Exception as e:
_LOGGER.error("Error closing WebSocket: %s", e)
Changing __init__.py
with the above resolves the AttributeError and now disconnects the WebSocket connection when action: lightwave_smart.reconnect
is performed.
Using a modified version of an automation found here , when an event is not received from Lightwave i.e multi-press event no longer registering, this action: lightwave_smart.reconnect
is called automatically. The WebSocket is then reconnected and events can be received again in Home Assistant.
lightwave_smart.reconnect
service does not work and throws an error.I'm finding that after a small duration the integration no longer registers multi-touch buttons unless HA is rebooted (force restart the Lightwave integration). It would be handy to call the service request
lightwave_smart.reconnect
.This could easily be automated for when a state change occurs but no corresponding multi-touch is detected, which would then call the service
lightwave_smart.reconnect
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/lightwave_smart/init.py:45 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 03:46:14 (1 occurrences) Last logged: 03:46:14
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/lightwave_smart/init.py:45 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 03:46:14 (1 occurrences) Last logged: 03:46:14