Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Request: The Bot does not get triggered despite being connected to BLE #425

Closed
Lazza opened this issue Jul 19, 2022 · 6 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@Lazza
Copy link

Lazza commented Jul 19, 2022

Describe Your Problem

I am trying to activate a SwitchBot Bot via Homebridge. The device is connected correctly via BLE and shows the battery level (it seems). Nevertheless, when triggering the Bot, nothing is performed.

Relevant log output

[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco BLE refreshStatus
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco BLE Address: _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] Bot: SwitchBot bianco BLE Address Found: _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] Bot: SwitchBot bianco Config BLE Address: _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco serviceData: {"model":"H","modelName":"WoHand","mode":false,"state":false,"battery":99}
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco, model: H, modelName: WoHand, mode: false, state: false, battery: 99
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco connected: true
[7/19/2022, 11:14:19 AM] [SwitchBot] _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] Bot: SwitchBot bianco BLE Address Found: _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] Bot: SwitchBot bianco Config BLE Address: _MAC ADDRESS REDACTED_
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco serviceData: {"model":"H","modelName":"WoHand","mode":false,"state":false,"battery":99}
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco, model: H, modelName: WoHand, mode: false, state: false, battery: 99
[7/19/2022, 11:14:19 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco connected: true
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco BLE parseStatus
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco Press Mode, mode: false, On: false
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco BatteryLevel: 99
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco updateCharacteristic On: false
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco updateCharacteristic BatteryLevel: 99
[7/19/2022, 11:14:20 AM] [SwitchBot] [DEBUG] Bot: SwitchBot bianco updateCharacteristic StatusLowBattery: 0

Config for homebridge-switchbot

{
    "bridge": {
        "name": "Homebridge ____",
        "username": "REDACTED",
        "port": 51154,
        "pin": "REDACTED"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "SwitchBot",
            "credentials": {
                "openToken": "REDACTED",
                "notice": "Keep your token a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "C03F________",
                        "configDeviceName": "SwitchBot bianco",
                        "configDeviceType": "Bot",
                        "ble": true,
                        "bot": {
                            "mode": "press",
                            "deviceType": "switch"
                        },
                        "logging": "debug"
                    }
                ]
            },
            "platform": "SwitchBot"
        }
    ],
    "disabledPlugins": []
}

Screenshots

Dockerfile

FROM oznu/homebridge:2022-05-21-debian-raspberry-pi
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y bluetooth bluez libbluetooth-dev libudev-dev && rm -rf /var/cache/apt/*

Device & Model

SwitchBot Bot

Node.js Version

v16.15.0

NPM Version

8.5.5

Homebridge Version

v1.5.0

Homebridge SwitchBot Plugin Version

v1.14.1 (2022-06-28)

Homebridge Config UI X Plugin Version

No response

Operating System

Raspbian + Docker image (See Dockerfile)

@Lazza Lazza added the question Further information is requested label Jul 19, 2022
@Lazza
Copy link
Author

Lazza commented Jul 20, 2022

Solution for Raspberry Pi - Raspbian

Finally, after days of trying I solved the issue.

This is due to the configuration of the host system (not the Docker container).

According to this Stack Overflow answer, one has to disable a plugin called pnat. This is done by adding the following line at the bottom of /etc/bluetooth/main.conf:

DisablePlugins=pnat

After doing this and restarting the bluetooth service, everything is working perfectly.

@francescosabia
Copy link

Solution for Raspberry Pi - Raspbian

Finally, after days of trying I solved the issue.

This is due to the configuration of the host system (not the Docker container).

According to this Stack Overflow answer, one has to disable a plugin called pnat. This is done by adding the following line at the bottom of /etc/bluetooth/main.conf:

DisablePlugins=pnat

After doing this and restarting the bluetooth service, everything is working perfectly.

how can we edit the file? with filezilla i can't. it says i have no root access

@Lazza
Copy link
Author

Lazza commented Feb 18, 2023

You can connect via SSH and use sudo to gain root access, then edit the file with nano.

@francescosabia
Copy link

francescosabia commented Feb 19, 2023 via email

@francescosabia
Copy link

francescosabia commented Feb 19, 2023 via email

@Lazza
Copy link
Author

Lazza commented Feb 19, 2023

I don't use this plugin anymore, so I don't know. I have switched to Home Assistant.

Please do not include my full name and messages in your comments here on GitHub, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants