Skip to content

Integration doesn't recover from loss of internet #239

@HandyHat

Description

@HandyHat

Hey there, thank you so much for the integration!

I've been experiencing some connectivity issues with my air purifier and have managed to reliably reproduce it. If there is any issue with the local network after Home Assistant starts up the integration seems to break and doesn't recover until Home Assistant is restarted again. I first noticed this in December but didn't want to open an issue until I could reproduce it.

To reproduce, I restarted my router at 13:16:40. Then, once my local network had fully come back up, I tried to turn off my air purifier at 13:21:00. This raised DysonNotConnected. I tried to reload the integration afterwards but this did not fix it. The only way to fix it is to restart Home Assistant.

Here are the debug logs:

2025-04-18 13:16:23.970 DEBUG (paho-mqtt-client-7icvbHRI2txsfIJ609vOw9) [custom_components.dyson_local.vendor.libdyson.dyson_device] New environmental state: {'msg': 'ENVIRONMENTAL-CURRENT-SENSOR-DATA', 'time': '2025-04-18T06:16:23.000Z', 'data': {'tact': '3026', 'hact': '0050', 'pm25': '0000', 'pm10': '0000', 'va10': '0006', 'noxl': '0000', 'p25r': '0001', 'p10r': '0001', 'hcho': '0023', 'hchr': '0055', 'co2a': '0035', 'co2r': '0882', 'sltm': 'OFF'}}
2025-04-18 13:16:53.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.002 seconds (success: True)
2025-04-18 13:17:23.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: True)
2025-04-18 13:17:53.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.002 seconds (success: True)
2025-04-18 13:18:23.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.002 seconds (success: True)
2025-04-18 13:18:25.894 DEBUG (paho-mqtt-client-7icvbHRI2txsfIJ609vOw9) [custom_components.dyson_local.vendor.libdyson.dyson_device] Disconnected with result code 16
2025-04-18 13:18:25.895 DEBUG (paho-mqtt-client-7icvbHRI2txsfIJ609vOw9) [custom_components.dyson_local.vendor.libdyson.dyson_device] Disconnected with result code 16
2025-04-18 13:18:53.891 ERROR (MainThread) [custom_components.dyson_local] Error fetching environmental data: Failed to request environmental data
2025-04-18 13:18:53.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)
2025-04-18 13:19:23.891 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)
2025-04-18 13:19:53.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)
2025-04-18 13:20:23.891 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)
2025-04-18 13:20:53.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)
2025-04-18 13:21:00.709 DEBUG (SyncWorker_1) [custom_components.dyson_local.fan] Turn off fan Air Purifier
2025-04-18 13:21:00.712 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547518969264] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1711, in async_turn_off
    await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/dyson_local/fan.py", line 179, in turn_off
    return self._device.turn_off()
           ~~~~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/dyson_local/vendor/libdyson/dyson_purifier_big_quiet.py", line 81, in turn_off
    self._set_configuration(fpwr="OFF")
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/config/custom_components/dyson_local/vendor/libdyson/dyson_device.py", line 324, in _set_configuration
    raise DysonNotConnected
custom_components.dyson_local.vendor.libdyson.exceptions.DysonNotConnected
2025-04-18 13:21:23.892 DEBUG (MainThread) [custom_components.dyson_local] Finished fetching environmental data in 0.001 seconds (success: False)

Please let me know if there's any other information that would be useful or if there is anything I can test!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions