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: Missing Device ID causes homebridge to go on a restart loop #1176

Open
guialbuquerque opened this issue Feb 7, 2025 · 0 comments
Open
Assignees
Labels
bug Something isn't working pinned

Comments

@guialbuquerque
Copy link

Describe the Bug

When setting up the plugin, if you finish the configuration without entering any device ID, it will cause the error on the log, which makes homebridge restart, repeating the error, restarting again, and goes into a loop.

Adding a Device ID to the configurations stops the error.
Not sure if related, but I had to restart my device too for Homebridge to work.

To Reproduce

  1. Start/install the plugin with a new configuration.
  2. Enter SwitchBot credentials.
  3. Skip adding any device.
  4. Press "Done" on the plugin configuration.
  5. Homebridge restarts with the error.

Expected Behavior

When the user skips adding any device ID and presses "Done" on the configuration should produce a Warning, maybe the plugin isn't going to work but Homebridge and other plugins are unaffected.

Relevant Log Output

(node:36521) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[07/02/2025, 10:54:21] Error: The devices config section is missing the *Device ID* in the config. Please check your config.
    at SwitchBotPlatform.verifyConfig (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:372:21)
    at new SwitchBotPlatform (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:132:12)
    at /var/lib/homebridge/node_modules/homebridge/src/server.ts:462:40
    at Array.forEach (<anonymous>)
    at Server.loadPlatforms (/var/lib/homebridge/node_modules/homebridge/src/server.ts:389:27)
    at Server.start (/var/lib/homebridge/node_modules/homebridge/src/server.ts:164:29)
[07/02/2025, 10:54:21] Got SIGTERM, shutting down Homebridge...

Config for homebridge-switchbot

{
    "name": "SwitchBot",
    "credentials": {
        "token": "-",
        "secret": "-",
        "notice": "Keep your Token & Secret a secret!"
    },
    "options": {
        "devices": [
            {
                "configDeviceName": "Corridor Light",
                "deviceId": "-",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "type": "switch",
                "mode": "switch",
                "allowPush": true,
                "logging": "standard"
            },
            {
                "configDeviceName": "Intercom",
                "deviceId": "-",
                "configDeviceType": "Bot",
                "connectionType": "OpenAPI",
                "type": "door",
                "mode": "press",
                "allowPush": true,
                "doublePress": 1,
                "logging": "standard"
            }
        ],
        "logging": "standard"
    },
    "platform": "SwitchBot"
}

Screenshots

No response

Device and Model

Raspberry Pi 5

Node.js Version

v22.13.1

NPM Version

v10.9.2

Homebridge Version

v1.8.5

Homebridge Switchbot Plugin Version

v4.3.1-beta.3

Homebridge Config UI X Plugin Version

v4.69.0

Operating System

Raspibian

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

6 participants