homebridge-switchbot: Bug: Switchbot Bot always return error "Cannot read properties of undefined (reading 'turnOn')" when press from homekit or homebridge accessories
Describe the Bug
I’ve integrated the version 3.6.0 of the plugin to my homebridge environment and my switchbot bot has been detected correctly in the plugin. But every time I try to trigger the press, whether from homekit or homebridge accessories page, it will always return error Cannot read properties of undefined (reading 'turnOn').
I’ve already tried upgrading the plugin to 3.6.1 beta version and it still happening. I’ve also tried to downgrade it to version 3.4.0, the bug is missing, but nothing happen on my bot.
To Reproduce
- Integrate version 3.6.0 (already follow the prerequisite step needed)
- tap the accessories
Expected Behavior
The bot should act correctly when pressed
Relevant Log Output
7/13/2024, 11:57:54 AM] [SwitchBot] Initializing SwitchBot platform...
[7/13/2024, 11:57:54 AM] [SwitchBot] Initializing child bridge 0E:96:3E:B4:61:58
[7/13/2024, 11:57:54 AM] Loading 13 accessories...
[7/13/2024, 11:57:58 AM] [SwitchBot] Launched child bridge with PID 138710
[7/13/2024, 11:58:06 AM] [SwitchBot] Loaded @switchbot/homebridge-switchbot v3.6.0 child bridge successfully
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Using Config Logging: debug
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Platform Config: {"logging":"debug"}
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Plugin Version: 3.6.0
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Finished initializing platform: SwitchBot
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Verifying Config
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Config OK
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Executed didFinishLaunching callback
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Retry Count: 0
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Using Default Refresh Rate (2 minutes).
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Using Default Push Rate.
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Using Default Max Retries.
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Using Default Delay Between Retries.
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Max Retries: 3
[7/13/2024, 11:58:06 AM] [SwitchBot] [DEBUG] Delay Between Retries: 3000
[7/13/2024, 11:58:07 AM] Homebridge v1.8.3 (HAP v0.12.2) (SwitchBot) is running on port 54502.
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] statusCode: 200
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] devicesAPI: {"statusCode":100,"body":{"deviceList":[{"deviceId":"C53635302723","deviceName":"Main bedroom air purifier","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}],"infraredRemoteList":[]},"message":"success"}
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] devicesAPI Body: {"deviceList":[{"deviceId":"C53635302723","deviceName":"Main bedroom air purifier","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}],"infraredRemoteList":[]}
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] devicesAPI StatusCode: 100
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] statusCode: 200 & devicesAPI StatusCode: 100
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] DeviceLists: [{"deviceId":"C53635302723","deviceName":"Main bedroom air purifier","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}]
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] DeviceLists Length: 1
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] SwitchBot Device Config Set: [{"deviceId":"C5:36:35:30:27:23","configDeviceName":"Main bedroom air purifier","configDeviceType":"Bot","connectionType":"BLE","bot":{"mode":"switch","deviceType":"switch"},"logging":"debug"}]
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] SwitchBot Devices: [{"deviceId":"C53635302723","configDeviceName":"Main bedroom air purifier","configDeviceType":"Bot","connectionType":"BLE","bot":{"mode":"switch","deviceType":"switch"},"logging":"debug","deviceName":"Main bedroom air purifier","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}]
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Discovered Bot: C53635302723
[7/13/2024, 11:58:08 AM] [SwitchBot] Total SwitchBot Devices Found: 1
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] IR Device Config Not Set: undefined
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Total IR Devices Found: 0
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Device: Main bedroom air purifier registerDevice: true
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Device: Main bedroom air purifier connectionType: BLE, will display in HomeKit
[7/13/2024, 11:58:08 AM] [SwitchBot] Adding new accessory: Main bedroom air purifier deviceId: C53635302723
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Device Config Logging: debug
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Platform Config refreshRate: 120, Default updateRate: 5, Platform Config pushRate: 0.1
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Default Max Retries: 5, Default Delay Between Retries: 3000
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Config: {"logging":"debug","connectionType":"BLE","mode":"switch","deviceType":"switch"}
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Model: SwitchBot S1, BLE Model: H, BLE Model Name: WoHand, BLE Model Friendly Name: Bot
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Default scanDuration: 5
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Default MQTT URL: , Default mqttOptions: {}, Default mqttPubOptions: {}
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Displaying as Switch
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Retrieve initial values and update Homekit
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLERefreshStatus
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Registering Webhook Event Handler
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier is not listening webhook.
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot uuid: C53635302723-Bot, (fe7993b8-de39-40cb-a39c-66a5309e661e)
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Device Type: switch
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Fan Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Lock Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Door Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Faucet Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Outlet Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Window Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Garage Door Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Window Covering Service
[7/13/2024, 11:58:08 AM] [SwitchBot] Bot: Main bedroom air purifier Removing any leftover Stateful Programmable Switch Service
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Firmware Version: 3.6.0
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier version: 3.6.0
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Main bedroom air purifier External Accessory Mode: undefined
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Using Bot Mode: switch
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier No Double Press Set, Using default Double Press: 1
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier No Push Rate Press Set, Using default Push Rate Press: 15
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier No Allow Push Set, Using default Allow Push: false
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Multi Press Count: 0
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier 'node-switchbot' found: [object Object]
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLE Address: c5:36:35:30:27:23
[7/13/2024, 11:58:08 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Scanning for WoHand devices...
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLEparseStatus
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier (power, battery, deviceMode) = BLE:(undefined, undefined, undefined), current:(undefined, 100, switch)
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Press Mode, mode: undefined, On: false
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BatteryLevel: undefined
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier StatusLowBattery: 0
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier updateCharacteristic On: false
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BatteryLevel: undefined
[7/13/2024, 11:58:13 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier updateCharacteristic StatusLowBattery: 0
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Set ProgrammableSwitchOutputState: true
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLEpushChanges
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLEpushChanges On: true OnCached: false
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier 'node-switchbot' found: [object Object]
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier BLE Address: c5:36:35:30:27:23
[7/13/2024, 11:59:55 AM] [SwitchBot] [DEBUG] Bot: Main bedroom air purifier Press Mode: switch
[7/13/2024, 12:00:00 PM] [SwitchBot] Bot: Main bedroom air purifier On: true
[7/13/2024, 12:00:00 PM] [SwitchBot] Bot: Main bedroom air purifier TypeError: Cannot read properties of undefined (reading 'turnOn')
[7/13/2024, 12:00:00 PM] [SwitchBot] Bot: Main bedroom air purifier Retrying
[7/13/2024, 12:00:01 PM] [SwitchBot] Bot: Main bedroom air purifier TypeError: Cannot read properties of undefined (reading 'turnOn')
[7/13/2024, 12:00:01 PM] [SwitchBot] Bot: Main bedroom air purifier Retrying
[7/13/2024, 12:00:02 PM] [SwitchBot] Bot: Main bedroom air purifier TypeError: Cannot read properties of undefined (reading 'turnOn')
[7/13/2024, 12:00:02 PM] [SwitchBot] Bot: Main bedroom air purifier Retrying
[7/13/2024, 12:00:03 PM] [SwitchBot] Bot: Main bedroom air purifier TypeError: Cannot read properties of undefined (reading 'turnOn')
[7/13/2024, 12:00:03 PM] [SwitchBot] Bot: Main bedroom air purifier Retrying
[7/13/2024, 12:00:04 PM] [SwitchBot] Bot: Main bedroom air purifier TypeError: Cannot read properties of undefined (reading 'turnOn')
[7/13/2024, 12:00:04 PM] [SwitchBot] Bot: Main bedroom air purifier Retrying
[7/13/2024, 12:00:05 PM] [SwitchBot] Bot: Main bedroom air purifier failed BLEpushChanges with BLE Connection, Error Message: "Cannot read properties of undefined (reading 'turnOn')"
Config for homebridge-switchbot
-
Screenshots
No response
Device and Model
Switchbot bot S1
Node.js Version
v18.19.0
NPM Version
v9.2.0
Homebridge Version
v1.8.3
Homebridge Switchbot Plugin Version
v3.6.0
Homebridge Config UI X Plugin Version
v4.56.4
Operating System
Debian
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 33
Thanks for the update, I completely understand, lets hope someone more experience then regular user will dive into it or we will wait until you will have time… sometime 😃 Enjoy your sumer.
Having the same issue with my newly purchased Bot.