OpenWonderLabs / homebridge-switchbot

The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit. Homebridge.
https://openwonderlabs.github.io/homebridge-switchbot/
ISC License
236 stars 47 forks source link

Bug: [SwitchBot] [DEBUG] Failed to Discover Devices #757

Closed secj-eng closed 11 months ago

secj-eng commented 1 year ago

Describe the Bug

After installing plugin on Homebridge on raspberry pi zero, I add the device (bot) to the config using the

I receive the following errors in the boot log of Homebridge: Failed to Discover Device

Cloud Services are enabled and I can control the device through Amazon Echo without issue.

I've reinstalled plugin and device to no avail. Do I have to do anything special with the mini hub?

To Reproduce

  1. Install as normal and add device to plugin configuration page

Expected Behavior

I would expect the device to register

Relevant Log Output

[SwitchBot] [DEBUG] Executed didFinishLaunching callback

[SwitchBot] [DEBUG] Failed to Discover Devices, Error Message: "Connect Timeout Error", Submit Bugs Here: https://tinyurl.com/SwitchBotBug

[SwitchBot] [DEBUG] Failed to Discover Devices, Error: ConnectTimeoutError: Connect Timeout Error

Config for homebridge-switchbot

xxxx is substituted for pasting
{
            "name": "SwitchBot",
            "credentials": {
                "token": "xxxxxxxxxxxxxxxx",
                "secret": "xxxxxxxxx",
                "notice": "Keep your Token & Secret a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "CA011Axxxxxx",
                        "configDeviceName": "Button",
                        "configDeviceType": "Bot",
                        "connectionType": "OpenAPI",
                        "bot": {
                            "mode": "press",
                            "deviceType": "switch",
                            "doublePress": 1
                        },
                        "logging": "debug"
                    }
                ],
                "logging": "debug"
            },
            "platform": "SwitchBot"
        }

Screenshots

No response

Device and Model

Switchbot Bot and mini hub

Node.js Version

v18.16.1

NPM Version

v9.5.1

Homebridge Version

v1.6.1

Homebridge Switchbot Plugin Version

v2.6.2

Homebridge Config UI X Plugin Version

v4.50.4

Operating System

Raspbian

donavanbecker commented 1 year ago

Seems like a network issue

secj-eng commented 1 year ago

Seems like a network issue

Maybe, but I can't find one. Homebridge and SwitchBot Mini are on the same WiFi and network. The other service (Amazon) does not have a problem. Open to any other checks you can suggest

secj-eng commented 1 year ago

Fwiw - I tried changing to BLE and am getting the same error. I can still control the switchbot through Alexa but not through Homebridge. I'm happy to troubleshoot if you have any ideas

Niklas31 commented 1 year ago

I am having the same issues! Tried cleaning my cache and nothing. Hero is the debug log: 13/07/2023, 11:08:27Switchbot PonteSwitchBotWARNING[DEBUG] Using Config Logging: debug 13/07/2023, 11:08:27Switchbot PonteSwitchBot[DEBUG] Finished initializing platform: 13/07/2023, 11:08:27Switchbot PonteSwitchBotPlatform Config: {"logging":"debug"} 13/07/2023, 11:08:27Switchbot PonteSwitchBotWARNING[DEBUG] Using Default Refresh Rate (2 minutes). 13/07/2023, 11:08:27Switchbot PonteSwitchBotWARNING[DEBUG] Using Default Push Rate. 13/07/2023, 11:08:27Switchbot PonteSwitchBot[DEBUG] Config OK 13/07/2023, 11:08:27Switchbot PonteSwitchBot[DEBUG] Executed didFinishLaunching callback 13/07/2023, 11:08:31Switchbot PonteSwitchBot[DEBUG] Devices: undefined 13/07/2023, 11:08:31Switchbot PonteSwitchBotUnknown statusCode, statusCode: 401, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug 13/07/2023, 11:08:31Switchbot PonteSwitchBot[DEBUG] Headers: {"date":"Thu, 13 Jul 2023 14:51:20 GMT","content-type":"application/json","content-length":"26","connection":"keep-alive","x-amzn-requestid":"b8843cec-e185-435d-8d38-9f0695ff54b6","x-amzn-errortype":"UnauthorizedException","x-amz-apigw-id":"IAdYWHQ5IAMFWSA="} 13/07/2023, 11:08:31Switchbot PonteSwitchBotERRO[DEBUG] Failed to Discover Devices, Error Message: "Cannot read properties of undefined (reading 'deviceList')", Submit Bugs Here: https://tinyurl.com/SwitchBotBug 13/07/2023, 11:08:31Switchbot PonteSwitchBotERRO[DEBUG] Failed to Discover Devices, Error: TypeError: Cannot read properties of undefined (reading 'deviceList')

donavanbecker commented 1 year ago

Are your devices enabled for Cloud? In the SwitchBot app

Niklas31 commented 1 year ago

Yes! Everything was working fine and nothing changed. Looking trough the other opened bugs, 4 of them are the same #757 #756 #753 #742

Niklas31 commented 1 year ago

log.txt Here is the DEBUG log. Hope it helps, if it seems to be a firewall issue on my side, please let me know.

Here is my config:

    "platform": "SwitchBot",
    "name": "SwitchBot",
    "credentials": {
        "token": "xxx",
        "secret": "xxx"
    },
    "options": {
        "logging": "debug",
        "devices": [
            {
                "deviceId": "C8:F1:15:DC:06:0C",
                "configDeviceName": "Cortina ",
                "configDeviceType": "Curtain",
                "connectionType": "BLE",
                "curtain": {
                    "set_min": 5,
                    "set_max": 95,
                    "setOpenMode": "0",
                    "setCloseMode": "0",
                    "hide_lightsensor": true
            },
            {
                "deviceId": "CE:51:38:BF:D6:3E",
                "configDeviceName": "Dedinho",
                "configDeviceType": "Bot",
                "connectionType": "BLE",
                "bot": {
                    "mode": "press"
                }
            }
        ]
    }
}
francescosabia commented 1 year ago

having same bug. all stopped working so i deleted and readded from scratch the plugin and re configured all but hoobs wont find my switchbot devices anymore. nothing appens in log

donavanbecker commented 1 year ago

HOOBs isn’t supported. So that could be your issue.

francescosabia commented 1 year ago

But it worked since yesterday!

francescosabia commented 1 year ago

Now magically it starts working again! All device are in my hoobs instance. Maybe network issue?

francescosabia commented 1 year ago

Now doesn’t work again! I don t think it s hoobs related. There is something wrong with the plugin itself! Because hoobs is the same than homebridge

donavanbecker commented 1 year ago

@francescosabia I am not going to continue to go back and forth on this but HOOBs is different then Homebridge.

If you choose to use HOOBs, I will not support.

francescosabia commented 1 year ago

@francescosabia I am not going to continue to go back and forth on this but HOOBs is different then Homebridge.

If you choose to use HOOBs, I will not support.

sorry, don't get nervous. i don' t understand why the plugin worked good since yesterday also in hoobs... i think that also people with homebridge are having problems.

donavanbecker commented 1 year ago

@francescosabia, HOOBs isn't support

donavanbecker commented 1 year ago

@secj-eng can you try the latest beta?

@Niklas31 please open your own issue.

secj-eng commented 11 months ago

@donavanbecker Sorry for the delay. I've moved switchbot from Raspberry PI to another Homebridge instance. It works there without issue, but I'll go back and test on Raspberry platform when I get a chance. I'm running v2.7.1 on the new instance, is that what you want me to try or the latest beta?

donavanbecker commented 11 months ago

@secj-eng Latest beta

secj-eng commented 11 months ago

I decided to flash and rebuild homebridge with the latest fresh raspberry pi homebridge installer.

I immediately get the following errors after installing switchbot using BLE.

[SwitchBot] Bot: Ent failed BLERefreshStatus with BLE Connection, Error Message: "Adapter is not ready: unknown" [SwitchBot] Bot: Ent wasn't able to establish BLE Connection, node-switchbot: [object Object]

running hcitool lescan I can see the bot

donavanbecker commented 11 months ago

v2.8.0 is released