Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

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

Open
marcgarciamarti opened this issue Jul 17, 2021 · 9 comments

Comments

@marcgarciamarti
Copy link

marcgarciamarti commented Jul 17, 2021

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 marcgarciamarti changed the title Switchbot integration working well in HA on an Intel NUC freshly booted but failing later Switchbot integration working well in a freshly booted HA on an Intel NUC but failing later Jul 17, 2021
@mcfarlde
Copy link

mcfarlde commented Jul 18, 2021 via email

@marcgarciamarti
Copy link
Author

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?

@mcfarlde
Copy link

mcfarlde commented Jul 19, 2021 via email

@marcgarciamarti
Copy link
Author

@marcgarciamarti
Copy link
Author

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)

@isabellaalstrom
Copy link

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

@marcgarciamarti
Copy link
Author

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?

@isabellaalstrom
Copy link

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

@marcgarciamarti
Copy link
Author

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

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

No branches or pull requests

3 participants