Switchbot Curtain

I added this to volumes:

      - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket

Basically the docker container needs permissions to dbus to be able to use bluetooth.
If you need more let me know and I’ll share more of my config

1 Like

my compose file shows the following:

  homeassistant:
    image: homeassistant/home-assistant:latest
    hostname: HomeAssistant
    mem_limit: 4g
    network_mode: host
    container_name: homeassistant
    cap_add:
      - net_admin
#      - sys_admin
    environment:
      - TZ=${TZ}
    logging:
      driver: json-file
      options:
        max-file: ${DOCKERLOGGING_MAXFILE}
        max-size: ${DOCKERLOGGING_MAXSIZE}
    privileged: true
    restart: ${HOMEASSISTANT_RESTART}
    volumes:
      - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${DOCKERCONFDIR}/homeassistant:/config
      - ${DOCKERSTORAGEDIR}:/storage

It shows the following error:

Unable to fetch switchbot services data

hmm, interesting. It looks OK to me, but I’ll admit I’m not a docker expert, I’m just good at following steps. haha. So I guess I would check
log on to the host and cd to /var/run/dbus/ and see if system_bus_socket is there?
I’m running a NUC, what hardware are you running?

Also I did remove my switch bot and re add, maybe the new bluetooth driver needed to connect/pair again?

Will try to do this tomorrow, will let you know

Doesn’t seem to work. I’m not a docker expert either, i can, like you, read stuff but it just doesn’t work for me unfortunately.

I’m using a Pi4 and checked, the path is correct to system_bus_socket.

I surely cannot be the only one using a Switchbot curtain with a Pi4 and docker. Hopefully someone can help!

… mmm I really really regret upgrading to 2022.7.x. That being said, when I remove the dbus line I’m getting:

Logger: homeassistant.components.switchbot.config_flow
Source: components/switchbot/config_flow.py:34
Integration: SwitchBot ([documentation](https://www.home-assistant.io/integrations/switchbot), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switchbot%22))
First occurred: 19:54:47 (1 occurrences)
Last logged: 19:54:47

Unexpected exception

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/switchbot/config_flow.py", line 89, in async_step_user self._discovered_devices = await self._get_switchbots() File "/usr/src/homeassistant/homeassistant/components/switchbot/config_flow.py", line 55, in _get_switchbots _btle_adv_data = await _btle_connect() File "/usr/src/homeassistant/homeassistant/components/switchbot/config_flow.py", line 34, in _btle_connect switchbot_devices = await GetSwitchbotDevices().discover() File "/usr/local/lib/python3.10/site-packages/switchbot/__init__.py", line 162, in discover await devices.start() File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 88, in start self._bus = await MessageBus(bus_type=BusType.SYSTEM).connect() File "/usr/local/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 122, in __init__ super().__init__(bus_address, bus_type, ProxyObject) File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 85, in __init__ self._setup_socket() File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 575, in _setup_socket raise err File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 548, in _setup_socket self._sock.connect(filename) FileNotFoundError: [Errno 2] No such file or directory

So for sure the dbus mount does do something. Except it doesnt work. At all. When the line is active it just doesn’t seem to be doing anything. Trying to add results in a ‘can’t connect’ message. I was 99% sure they are in range because they have always worked just fine at the exact same position. Nothing physically has changed. But to be 100% I placed the switchbot right next to the pi4 , same message.

The weird thing is there is no log entry anywhere. No error, no nothing. it just doesn’t work. I can control them by mobile phone and through my old Homey.

I have now installed switchbot-mqtt in a dockercontainer as an alternative. Was a bit of a pain in the butt, but it works. Unfortunately now the curtains get presented by the covers. At least they now work. Hopefully HA will sort their BLE missery.


2022.8 will solve it all, at least, that’s what they are promising. Fingers crossed and see what happens the 3th of aug.

sup guys
love this community, and this discussion is just another good example of it :slight_smile:

need some assistance. for some reason my “open” and “close” buttons are not working properly if the blinds are completely “close” or “open”.
let me elaborate.
buttons, sensor, and even the slider to control the switchbot - works great. however, if the blinds are 100% “open”, for some reason the “open” button on the dashboard is the only one that stays “pressable” (yet pressing it does nothing) while the “close” button is grayed out, and cant be pressed.
the “stop” button is useable as “close” button.
for now, i “reversed” the actions of the buttons - (close button actually open the blinds, and vice versa) but that cant be the “right” way to go…

i’d love some help, if anyone have any experience with this, or knows whats need to be done to fix it…
cheers

Just a heads-up; With 2022.8.0 everything works great! With my compose file mentioned above.

I see in the release note / blog post about 2022.8 they mentioned the direct support of bluetooth, and as such Switchbot integration is now part of the core integration.

SwitchBot - Home Assistant (home-assistant.io)
2022.8: You can fix it! - Home Assistant (home-assistant.io)

So do we still need the container (via mqtt) or any 3rd party integration now that we have 2022.8?
And do we still need the Switchbot hub?

No and no, direct means really direct :muscle::muscle::muscle: love it.

“Really direct” is great however depending where your HA-server and curtain bots are located the distance might be too far for BT. But definitely worth a try!

Agreed! There are solutions for that too. But for now it woekering for me

I’m using the ESP32/Wifi/BLE/MQTT-solution with the code from @devWaves
This works excellent, too, has hardly any delay and can be placed close to the BLE-devices.

With the new HA release I can now find my curtainbots (oddly finding it twice) and it shows the status correct. But, any commands send to it (open/close) it’s not responding. Presume this is a distance thing.

(was using the API before)

There is a default disabled rssi sensor, what happens it that is enabled, or doesn’t it report at all?

I see there is a new specific topic about the HA first party Bluetooth integration that mentions my issue. I will move over to that one: SwitchBot Curtain via Bluetooth - no Security and read only?

Hi everyone, I also bought them switchbot curtain but don’t get them visible in HA. Have put the following in configuration.yaml

cover:
  - platform: switchbot
    mac: CA:D9:7D:68:4B:1B
    name: Test Curtain

and if I enter this code

cover:
  - platform: switchbot-curtain
    mac: CA:D9:7D:68:4B:1B
    name: Test Curtain

I get the following error when checking configuration: Platform error cover.switchbot-curtain - Integration ‘switchbot-curtain’ not found.

Can anyone help me with this?
Thanks for every response.

Sounds like you have not added the Switchbot integration. Best remove all above mentioned edits from the YAML-files, restart HA and then add the Switchbot integration. Then configure your bots in the gui of the integration.

1 Like

Thank you for your comment, but if I want to install the integration, I get the following message: “No unconfigured devices found.”