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

Bug: BLE Device does not work #1161

Open
FgPy93 opened this issue Jan 7, 2025 · 3 comments
Open

Bug: BLE Device does not work #1161

FgPy93 opened this issue Jan 7, 2025 · 3 comments
Assignees
Labels
bug Something isn't working pinned

Comments

@FgPy93
Copy link

FgPy93 commented Jan 7, 2025

Describe the Bug

Got a Switchbot Bot. Wether it was declared as switch or press mode neither works.

The prerequisites for the BLE mode were met as far as I can tell from the docs. Identification of the switchbot works with the bluetooth of the raspi. But the communication via the plug-in does not work.

To Reproduce

Add Switchbot Bot to Homebridge Setup on Raspberry Pi.

Expected Behavior

Depends: When declared as switch an error code is espected. Declared in "press" mode nothing happens.

Relevant Log Output

[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür Switch Mode, On: false
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür BatteryLevel: 100
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür StatusLowBattery: 0
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateHomeKitCharacteristics
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic BatteryLevel: 100
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic StatusLowBattery: 0
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic On: false
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateHomeKitCharacteristics
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic BatteryLevel: 100
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic StatusLowBattery: 0
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic On: false
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateHomeKitCharacteristics
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic BatteryLevel: 100
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic StatusLowBattery: 0
[07/01/2025, 17:46:15] [SwitchBot] [DEBUG] Bot: Haustür updateCharacteristic On: false
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Bot: Haustür value: true
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Bot: Haustür BLEpushChanges
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Bot: Haustür BLEpushChanges On: true OnCached: false
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Bot: Haustür bleMac: ce:2a:44:06:3f:49
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Bot: Haustür Bot Mode: switch
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] [parseAdvertising.ce2a44063f49.H] return {"id":"ce2a44063f49","address":"ce:2a:44:06:3f:49","rssi":-67,"serviceData":{"model":"H","modelName":"WoHand","modelFriendlyName":"Bot","mode":true,"state":false,"battery":100}}
[07/01/2025, 17:46:19] [SwitchBot] [DEBUG] Stopped Scanning for SwitchBot BLE devices.
[07/01/2025, 17:46:19] [SwitchBot] Bot: Haustür On: true
[07/01/2025, 17:46:19] [SwitchBot] Bot: Haustür failed BLEpushChanges with BLE Connection, Error Message: "Converting circular structure to JSON\n    --> starting at object with constructor 'Timeout'\n    |     property '_idlePrev' -> object with constructor 'TimersList'\n    --- property '_idleNext' closes the circle"

Config for homebridge-switchbot

{
    "name": "SwitchBot",
    "credentials": {
        "notice": "Keep your Token & Secret a secret!"
    },
    "options": {
        "devices": [
            {
                "configDeviceName": "Haustür",
                "deviceId": "ce:2a:44:06:3f:49",
                "configDeviceType": "Bot",
                "connectionType": "BLE",
                "type": "switch",
                "mode": "switch",
                "external": false,
                "logging": "debug"
            }
        ],
        "discoverBLE": true,
        "logging": "debug",
        "allowInvalidCharacters": true
    },
    "platform": "SwitchBot"
}

Screenshots

No response

Device and Model

Raspberry Pi 3

Node.js Version

v23.5.0

NPM Version

10.9.2

Homebridge Version

1.8.5

Homebridge Switchbot Plugin Version

4.1.7

Homebridge Config UI X Plugin Version

No response

Operating System

Raspbian

@ddiaz914
Copy link

ddiaz914 commented Jan 27, 2025

I bought the switchbot a few months ago and was really excited to add this to homebridge, and this plugin has not worked once. There have been updates to the app and I have gotten different error messages, but I am now receiving this same error as well when trying to connect through BLE.

{
    "name": "SwitchBot",
    "credentials": {
        "notice": "Keep your Token & Secret a secret!"
    },
    "options": {
        "devices": [
            {
                "configDeviceName": "Sconces",
                "deviceId": "D7343130293B",
                "configDeviceType": "Bot",
                "connectionType": "BLE",
                "scanDuration": 5,
                "type": "switch",
                "mode": "switch",
                "disableCaching": true,
                "logging": "debug"
            }
        ],
        "BLE": true,
        "discoverBLE": true,
        "logging": "debug"
    },
    "platform": "SwitchBot"
}

@olthme
Copy link

olthme commented Feb 19, 2025

FYI: This error was already mentioned in #980 and #977. Im Running into the same error.

@lukashaenjes
Copy link

Hi there. Running into the same error with Switchbot plugin v4.3.1 on Homebridge v1.9.0 on a Raspberry Pi 3B today.

The connection itself seems to work fine: The Pi can find the BLE MAC of the Switchbot when running bluetoothctl via the Homebridge Terminal, and the device also shows up in my Apple Home app with (seemingly correct) metadata.

However, nothing happens when I click on the device button in either the Homebridge UI or the Home App on my phone.

I started some live logs while clicking on the device in the Home App and discovered the same error:

pi@homebridge:/var/lib/homebridge $ tail -f homebridge.log
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS StatusLowBattery: 0
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateHomeKitCharacteristics
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic BatteryLevel: 87
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic StatusLowBattery: 0
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic On: false
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateHomeKitCharacteristics
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic BatteryLevel: 87
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic StatusLowBattery: 0
[05/03/2025, 13:13:52] [SwitchBot] [DEBUG] Bot: UPWARDS updateCharacteristic On: false
[05/03/2025, 13:15:06] [Homebridge UI] Starting terminal session.
## ---------------- THIS IS WHERE I CLICKED "ON" IN THE HOME APP ----------------
[05/03/2025, 13:15:13] [SwitchBot] [DEBUG] Bot: UPWARDS value: true
[05/03/2025, 13:15:13] [SwitchBot] [DEBUG] Bot: UPWARDS BLEpushChanges
[05/03/2025, 13:15:13] [SwitchBot] [DEBUG] Bot: UPWARDS BLEpushChanges On: true OnCached: false
[05/03/2025, 13:15:13] [SwitchBot] [DEBUG] Bot: UPWARDS bleMac: XX:XX:XX:XX:XX:XX [redacted]
[05/03/2025, 13:15:13] [SwitchBot] [DEBUG] Bot: UPWARDS Bot Mode: switch
[05/03/2025, 13:15:13] [SwitchBot] Bot: UPWARDS On: true
[05/03/2025, 13:15:13] [SwitchBot] Bot: UPWARDS failed BLEpushChanges with BLE Connection, Error Message: "Converting circular structure to JSON\n    --> starting at object with constructor 'Timeout'\n    |     property '_idlePrev' -> object with constructor 'TimersList'\n    --- property '_idleNext' closes the circle"
## ---------------- THIS IS WHERE I CLICKED "OFF" IN THE HOME APP ----------------
[05/03/2025, 13:15:15] [SwitchBot] [DEBUG] Bot: UPWARDS value: false
[05/03/2025, 13:15:15] [SwitchBot] [DEBUG] Bot: UPWARDS BLEpushChanges
[05/03/2025, 13:15:15] [SwitchBot] [DEBUG] Bot: UPWARDS No Changes (BLEpushChanges), On: false OnCached: false
[05/03/2025, 13:15:28] [SwitchBot] [DEBUG] Bot: UPWARDS BLERefreshStatus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

9 participants