homebridge-switchbot: Bug: SwitchBot not working with BLE and keep rebooting the child bridge
Describe the Bug
Hello, I am experiencing an issue with the plugin when attempting to use the bot in BLE mode. The plugin is not working correctly and keeps causing the child bridge to reboot.
To Reproduce
- Install Homebridge on a Raspberry Pi.
- Install the plugin.
- Configure the plugin to use BLE mode.
Expected Behavior
The plugin should be able to control the SwitchBot devices in BLE mode without causing the child bridge to reboot.
Relevant Log Output
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Max Retries Not Set, Using: 5
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Delay Between Retries Not Set, Using: 3000
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Config: {"logging":"debug","scanDuration":10,"maxRetry":7,"connectionType":"BLE","mode":"switch","deviceType":"switch","allowPush":true,"doublePress":1}
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Model: SwitchBot S1, BLE Model: H
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot 3 FirmwareRevision: 3.5.0
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Firmware Version: 3.5.0
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot deviceVersion: 3.5.0
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Using Device Config scanDuration: 10
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Accessory Cache: switch
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Using Device Type: switch
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Using Bot Mode: switch
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Using Default Bot pushRatePress: 15
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Allowing Push Changes: true
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot Displaying as Switch
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot BLERefreshStatus
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot updateCharacteristic On: false
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot is not listening webhook.
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot updateCharacteristic BatteryLevel: 100
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot updateCharacteristic StatusLowBattery: 0
[27/05/2024, 09:24:58] [SwitchBot] [DEBUG] Bot: SwitchBot BLE Address: d3:35:xx:xx:xx:xx
[27/05/2024, 09:25:02] [SwitchBot] Bot: SwitchBot Set ProgrammableSwitchOutputState: true
[27/05/2024, 09:25:02] [SwitchBot] [DEBUG] Bot: SwitchBot BLEpushChanges
[27/05/2024, 09:25:02] [SwitchBot] [DEBUG] Bot: SwitchBot BLEpushChanges On: true OnCached: false
[27/05/2024, 09:25:02] [SwitchBot] [DEBUG] Bot: SwitchBot BLE Address: d3:35:xx:xx:xx:xx
[27/05/2024, 09:25:02] [SwitchBot] [DEBUG] Bot: SwitchBot Press Mode: switch
[27/05/2024, 09:25:07] [SwitchBot] Bot: SwitchBot On: true
[27/05/2024, 09:25:07] [SwitchBot] TypeError: Cannot read properties of undefined (reading 'turnOn')
[27/05/2024, 09:25:07] [SwitchBot] Bot: SwitchBot Retrying
[27/05/2024, 09:25:08] [SwitchBot] [DEBUG] Bot: SwitchBot BLEparseStatus
TypeError: Cannot read properties of undefined (reading 'mode')
at Bot.BLEparseStatus (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:510:21)
at file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:629:18
[27/05/2024, 09:25:08] [SwitchBot] Child bridge process ended
[27/05/2024, 09:25:08] [SwitchBot] Process Ended. Code: 1, Signal: null
[27/05/2024, 09:25:15] [SwitchBot] Restarting Process...
Config for homebridge-switchbot
{
"name": "SwitchBot",
"credentials": {
"token": "xxxx",
"secret": "xxxx",
"notice": "Keep your Token & Secret a secret!"
},
"options": {
"devices": [
{
"deviceId": "D3:35:xx:xx:xx:xx",
"configDeviceName": "SwitchBot",
"configDeviceType": "Bot",
"connectionType": "BLE",
"scanDuration": 10,
"bot": {
"mode": "switch",
"deviceType": "switch",
"allowPush": true,
"doublePress": 1
},
"maxRetry": 7,
"logging": "debug"
}
]
},
"_bridge": {
"username": "0E:xx:xx:xx:xx:xx",
"port": 550xx
},
"platform": "SwitchBot"
}
Screenshots
No response
Device and Model
SwitchBot V6.6
Node.js Version
v20.13.1
NPM Version
v8.19.4
Homebridge Version
v1.8.2
Homebridge Switchbot Plugin Version
v3.5.0
Homebridge Config UI X Plugin Version
No response
Operating System
Raspbian
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 29 (1 by maintainers)
I have found part of the issue, just need to figure out a fix and resolve it. I will do it as quick as I can as life allows.
+1 Same issue here.
I rolled back 3.4.0, and everything is working as intended.
I’ve tried using 3.8.1, and so far it appears to be working!
Issue is still occurring.
I don’t believe this is stale; I’m still on 3.4. In case it helps, I’m running on a Raspberry Pi.
Hi, idk if can be of any help, I think the error is also present for hubs, or at least I have a similar error for the humidity retrieving of hub2, the error message seems the same, so it could be related.