question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: API Request: TypeError: Cannot read properties of undefined (reading 'deviceList')

See original GitHub issue

Describe The Bug

Device list is empty although configured

To Reproduce

install plugin v2.1.0, configure your devices

Expected behavior

devices should show and be exposed to homekit

Relevant log output

[14/10/2022, 13:02:26] [SwitchBot] Initializing SwitchBot platform...
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Using Config Logging: debug
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Finished initializing platform:
[14/10/2022, 13:02:26] [SwitchBot] Platform Config: {"logging":"debug"}
[14/10/2022, 13:02:26] [SwitchBot] The devices config section is missing the *Device ID* in the config. Please check your config.
[14/10/2022, 13:02:26] [SwitchBot] The devices config section is missing the *Device Type* in the config. Please check your config.
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Using Default Refresh Rate (2 minutes).
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Using Default Push Rate.
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Config OK
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] Executed didFinishLaunching callback
[14/10/2022, 13:02:26] [SwitchBot] [DEBUG] x9TVXSaYbPS3GI1/e3AVBdgFy5jgigI4REveOTLcgww=

[14/10/2022, 13:02:56] [SwitchBot] [DEBUG] statusCode: 401
[14/10/2022, 13:02:56] [SwitchBot] [DEBUG] headers: {"date":"Fri, 14 Oct 2022 10:02:56 GMT","content-type":"application/json","content-length":"26","connection":"close","x-amzn-requestid":"80b51f69-ace4-4d1e-abc0-837b3c2a21d6","x-amzn-errortype":"UnauthorizedException","x-amz-apigw-id":"Z_UIoFV7IAMF72g="}
[14/10/2022, 13:02:56] [SwitchBot] [DEBUG] d: {"message":"Unauthorized"}
[14/10/2022, 13:02:56] [SwitchBot] [DEBUG] devicesAPI: [Undefined]
[14/10/2022, 13:02:56] [SwitchBot] API Request: TypeError: Cannot read properties of undefined (reading 'deviceList'), Submit Bugs Here: https://tinyurl.com/SwitchBotBug

Config for homebridge-switchbot

{
            "name": "SwitchBot",
            "credentials": {
                "token": "XXX",
                "secret": "XXX",
                "notice": "Keep your token a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "XXX",
                        "configDeviceName": "Curtain Right",
                        "configDeviceType": "Curtain",
                        "connectionType": "BLE/OpenAPI"
                    },
                    {
                        "deviceId": "XXX",
                        "configDeviceName": "Bathroom",
                        "configDeviceType": "Bot",
                        "connectionType": "BLE/OpenAPI"
                    }
                ],
                "irdevices": [
                    {
                        "logging": "standard"
                    }
                ],
                "logging": "debug"
            },
            "platform": "SwitchBot"
        },

Screenshots

image image

Device & Model

Raspberry Pi Zero WH

Node.js Version

v16.18.0

NPM Version

v8.19.2

Homebridge Version

v1.5.0

Homebridge Switchbot Plugin Version

v2.1.0

Homebridge Config UI X Plugin Version

v4.50.1

Operating System

Raspbian

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
idanyccommented, Oct 15, 2022

works now, what did the trick eventually was deleting the plugin json config and configuring only from UI

0reactions
SSutherland94commented, Oct 24, 2022

I’m having the same issue and wiping the config and recreating everything didn’t resolve. Any assistance would be definitely appreciated!

Open new issue and fill out all the info

Will do, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

API call in React "TypeError: Cannot read properties of ...
I am sure this is something simple I still haven't learned yet. TypeError: Cannot read properties of undefined (reading 'map') const ...
Read more >
TypeError: Cannot read properties of undefined (reading 'post ...
Describe the bug. I use the latest version of axios to make backend requests (please see code snippet below).
Read more >
power bi api javascript 'TypeError: Cannot read pr...
if i run 'npm start' in javascript, i see the 'TypeError: Cannot read properties of undefined (reading 'get')'.
Read more >
1948556 – Cannot read property 'apiGroup' of undefined error ...
Actual results: 3. it throws 'Oh no! Something went wrong.' error TypeError Description: Cannot read property 'apiGroup' of undefined at je ...
Read more >
Hubspot Timeline event API Node.JS "TypeError: Cannot read ...
Solved: I'm trying to use the Hubspot Timeline event API to ... "TypeError: Cannot read properties of undefined (reading 'eventsApi')".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found