ha-switchbot-curtain icon indicating copy to clipboard operation
ha-switchbot-curtain copied to clipboard

Switchbot integration working well in a freshly booted HA on an Intel NUC but failing later

Open marcgarciamarti opened this issue 3 years ago • 9 comments

Hello, I'm a happy user of this integration. It works just fine right after HA has been started but when the system has been up for a while (I really can’t tell when that starts to happen), the integration fails to trigger my switchbots.

Scenario:

  • HA has been up for a while
  • I click on any of my switchbot curtains
  • My switchbot curtains won't react
  • I wait some time
  • Nothing happens
  • I then restart HA
  • Click on the very same switchbot integration
  • The switchbot integration woks and drapes are pulled correctly
  • After a while (I can't really tell when this happens) the integration will not work any more

And of course, as soon as restart the integration, it works again.

I'm just wondering if this is something which only happens on an intel NUC and the way it handles bluetooth. I would appreciate it if you could help me troubleshoot my system.

I'm using the Bluetooth tracking integration to track family members presence. Not sure if this could be problematic.

thanks

marcgarciamarti avatar Jul 17 '21 16:07 marcgarciamarti

I’ve got the same plus the integration always reports open. Closing with the app and then opening syncs it up.

Derek McFarland

On Jul 17, 2021, at 10:48 AM, marcgarciamarti @.***> wrote:

 Hello, I'm a happy user of this integration. It works just fine right after HA has been started but when the system has been up for a while (I really can’t tell when that starts to happen), the integration fails to trigger my switchbots.

Scenario:

HA has been up for a while I click on any of my switchbot curtains My switchbot curtains won't react I wait some time Nothing happens I then restart HA Click on the very same switchbot integration The switchbot integration woks and drapes are pulled correctly After a while (I can't really tell when this happens) the integration will not work any more And of course, as soon as restart the integration, it works again.

I'm just wondering if this is something which only happens on an intel NUC and the way it handles bluetooth. I would appreciate it if you could help me troubleshoot my system.

thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mcfarlde avatar Jul 18 '21 02:07 mcfarlde

I’ve got the same plus the integration always reports open. Closing with the app and then opening syncs it up.

Derek McFarland

On Jul 17, 2021, at 10:48 AM, marcgarciamarti @.***> wrote:

 Hello, I'm a happy user of this integration. It works just fine right after HA has been started but when the system has been up for a while (I really can’t tell when that starts to happen), the integration fails to trigger my switchbots.

Scenario:

HA has been up for a while I click on any of my switchbot curtains My switchbot curtains won't react I wait some time Nothing happens I then restart HA Click on the very same switchbot integration The switchbot integration woks and drapes are pulled correctly After a while (I can't really tell when this happens) the integration will not work any more And of course, as soon as restart the integration, it works again.

I'm just wondering if this is something which only happens on an intel NUC and the way it handles bluetooth. I would appreciate it if you could help me troubleshoot my system.

thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Same exact behavior?

marcgarciamarti avatar Jul 18 '21 16:07 marcgarciamarti

Not exactly but it does seem to work after a reboot for a while and then doesn’t

Derek McFarland

On Jul 18, 2021, at 10:22 AM, marcgarciamarti @.***> wrote:

 I’ve got the same plus the integration always reports open. Closing with the app and then opening syncs it up.

Derek McFarland

On Jul 17, 2021, at 10:48 AM, marcgarciamarti @.***> wrote:

 Hello, I'm a happy user of this integration. It works just fine right after HA has been started but when the system has been up for a while (I really can’t tell when that starts to happen), the integration fails to trigger my switchbots.

Scenario:

HA has been up for a while I click on any of my switchbot curtains My switchbot curtains won't react I wait some time Nothing happens I then restart HA Click on the very same switchbot integration The switchbot integration woks and drapes are pulled correctly After a while (I can't really tell when this happens) the integration will not work any more And of course, as soon as restart the integration, it works again.

I'm just wondering if this is something which only happens on an intel NUC and the way it handles bluetooth. I would appreciate it if you could help me troubleshoot my system.

thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Same exact behavior?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

mcfarlde avatar Jul 19 '21 16:07 mcfarlde

Check this https://community.home-assistant.io/t/switchbot-curtain/219837/129?u=kitus

marcgarciamarti avatar Jul 19 '21 22:07 marcgarciamarti

Adding some additional information

Logger: homeassistant.helpers.entity
Source: custom_components/switchbot-curtain/cover.py:164 
Integration: switchbot-curtain 
First occurred: July 20, 2021, 4:06:51 PM (34 occurrences) 
Last logged: July 21, 2021, 1:49:57 PM

Update for cover.cortina_3 fails
Update for cover.cortina_2 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
    raise exc
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/switchbot-curtain/cover.py", line 164, in update
    self._device.update()
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 189, in update
    devices = bluepy.btle.Scanner().scan(scan_timeout)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 853, in scan
    self.process(timeout)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 840, in process
    isNewData = dev._update(resp)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 696, in _update
    raise BTLEInternalError("Address type changed during scan, for address %s" % self.addr)

marcgarciamarti avatar Jul 25 '21 07:07 marcgarciamarti

I also have an Intel Nuc and for me it's not working at all. The Nuc is in the same room as the switchbot curtain, so range should not be an issue.

Logs:

2021-08-08 09:40:17 WARNING (MainThread) [homeassistant.components.cover] Updating switchbot-curtain cover took longer than the scheduled update interval 0:00:15
2021-08-08 09:40:31 WARNING (MainThread) [homeassistant.helpers.entity] Update of cover.movie_room_curtain_left is taking over 10 seconds

2021-08-08 09:40:58 WARNING (SyncWorker_13) [switchbot] Error talking to Switchbot.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 105, in _sendcommand
    self._connect()
  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 56, in _connect
    self._device = bluepy.btle.Peripheral(self._mac,
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral CF:2E:44:EA:2A:EA, addr type: random

isabellaalstrom avatar Aug 08 '21 07:08 isabellaalstrom

I also have an Intel Nuc and for me it's not working at all. The Nuc is in the same room as the switchbot curtain, so range should not be an issue.

Logs:


2021-08-08 09:40:17 WARNING (MainThread) [homeassistant.components.cover] Updating switchbot-curtain cover took longer than the scheduled update interval 0:00:15

2021-08-08 09:40:31 WARNING (MainThread) [homeassistant.helpers.entity] Update of cover.movie_room_curtain_left is taking over 10 seconds



2021-08-08 09:40:58 WARNING (SyncWorker_13) [switchbot] Error talking to Switchbot.

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 105, in _sendcommand

    self._connect()

  File "/usr/local/lib/python3.9/site-packages/switchbot/__init__.py", line 56, in _connect

    self._device = bluepy.btle.Peripheral(self._mac,

  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 391, in __init__

    self._connect(deviceAddr, addrType, iface)

  File "/usr/local/lib/python3.9/site-packages/bluepy/btle.py", line 439, in _connect

    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)

bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral CF:2E:44:EA:2A:EA, addr type: random

Did you add your devices in the yaml file?

marcgarciamarti avatar Aug 08 '21 08:08 marcgarciamarti

@marcgarciamarti Yes. Now I tried with an earlier version of the repo (as per these instructions) and got it to work.

isabellaalstrom avatar Aug 08 '21 08:08 isabellaalstrom

Quick update: I recently decided to disable Bluetooth presence tracking and so far I would say that the results are good.

marcgarciamarti avatar Sep 23 '21 19:09 marcgarciamarti