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: Failed to Discover Devices, Error Message: "Cannot read properties of undefined (reading 'map') #769

Closed francescosabia closed 1 year ago

francescosabia commented 1 year ago

Describe the Bug

can t discover devices

To Reproduce

stopped working so i deleted and readded the plugin and reconfigured

Expected Behavior

discover devices as before!

Relevant Log Output

24/7/2023, 22:50:14 Switchbot Switchbot starting
24/7/2023, 22:50:18 Switchbot [ ERROR ] The plugin "homebridge-switchbot" requires a Homebridge version of ^1.6.1 which does not satisfy the current Homebridge version of 1.6.0. You may need to update this plugin (or Homebridge) to a newer version. You may face unexpected issues or stability problems running this plugin.
24/7/2023, 22:50:21 Switchbot Loaded plugin '@switchbot/homebridge-switchbot'
24/7/2023, 22:50:21 Switchbot [ DEBUG ] Registering platform '@switchbot/homebridge-switchbot.SwitchBot'
24/7/2023, 22:50:21 Switchbot Loading 1 platforms...
24/7/2023, 22:50:21 Switchbot SwitchBot [ WARNING ] [DEBUG] Using Config Logging: debug
24/7/2023, 22:50:21 Switchbot SwitchBot [DEBUG] Finished initializing platform:
24/7/2023, 22:50:21 Switchbot SwitchBot Platform Config: {"logging":"debug","refreshRate":6}
24/7/2023, 22:50:21 Switchbot SwitchBot [ WARNING ] [DEBUG] Using Default Push Rate.
24/7/2023, 22:50:21 Switchbot SwitchBot [DEBUG] Config OK
24/7/2023, 22:50:21 Switchbot SwitchBot [DEBUG] Executed didFinishLaunching callback
24/7/2023, 22:50:22 Switchbot Bridge is running on port 51836.
24/7/2023, 22:50:22 Switchbot SwitchBot [DEBUG] Devices: {}
24/7/2023, 22:50:22 Switchbot SwitchBot [DEBUG] Request successful, statusCode: 200
24/7/2023, 22:50:22 Switchbot SwitchBot [DEBUG] Headers: {"date":"Mon, 24 Jul 2023 20:50:22 GMT","content-type":"application/json","content-length":"73","connection":"keep-alive","x-amzn-requestid":"c5cd7458-9e2b-4036-9c22-433f998144c8","x-amz-apigw-id":"IliSUFAxoAMFcEQ=","x-amzn-trace-id":"Root=1-64bee40e-5116cac62c6e1c11258f4308;Sampled=0;lineage=c8c2b0f2:0|bf95bacf:0"}
24/7/2023, 22:50:22 Switchbot SwitchBot [DEBUG] SwitchBot Device Config Set: [{"bot":{"deviceType":"switch","mode":"switch"},"configDeviceName":"camino","connectionType":"OpenAPI","configDeviceType":"Bot","history":false,"deviceId":"C9458FF3656E","logging":"debug"},{"connectionType":"OpenAPI","refreshRate":6,"configDeviceType":"Smart Lock","lock":{"hide_contactsensor":true},"configDeviceName":"porta scala","bot":{"deviceType":"lock"},"deviceId":"C77C293BEB59","logging":"debug"},{"deviceId":"C9725E019932","configDeviceName":"sensore temperatura lavanderia","configDeviceType":"Meter","connectionType":"OpenAPI","history":true,"logging":"debug"}]
24/7/2023, 22:50:22 Switchbot SwitchBot [ ERROR ] [DEBUG] Failed to Discover Devices, Error Message: "Cannot read properties of undefined (reading 'map')", Submit Bugs Here: https://tinyurl.com/SwitchBotBug
24/7/2023, 22:50:22 Switchbot SwitchBot [ ERROR ] [DEBUG] Failed to Discover Devices, Error: TypeError: Cannot read properties of undefined (reading 'map')

Config for homebridge-switchbot

{
    "accessories": [],
    "platforms": [
        {
            "name": "SwitchBot",
            "options": {
                "refreshRate": 6,
                "devices": [
                    {
                        "bot": {
                            "deviceType": "switch",
                            "mode": "switch"
                        },
                        "configDeviceName": "camino",
                        "connectionType": "OpenAPI",
                        "configDeviceType": "Bot",
                        "history": false,
                        "deviceId": "C945***656E"
                    },
                    {
                        "connectionType": "OpenAPI",
                        "refreshRate": 6,
                        "configDeviceType": "Smart Lock",
                        "lock": {
                            "hide_contactsensor": true
                        },
                        "configDeviceName": "porta scala",
                        "bot": {
                            "deviceType": "lock"
                        },
                        "deviceId": "C77***3BEB59"
                    },
                    {
                        "deviceId": "C9725E**9932",
                        "configDeviceName": "sensore temperatura lavanderia",
                        "configDeviceType": "Meter",
                        "connectionType": "OpenAPI",
                        "history": true
                    }
                ]
            },
            "credentials": {
                "token": "03f58aeffb******cc10************f7dcb",
                "secret": "4c********57b89552a6"
            },
            "platform": "SwitchBot"
        }
    ]
}

Screenshots

No response

Device and Model

hoobs

Node.js Version

16.20.1

NPM Version

i think latest

Homebridge Version

1.6.0

Homebridge Switchbot Plugin Version

2.6.3 beta 7

Homebridge Config UI X Plugin Version

No response

Operating System

raspbian

donavanbecker commented 1 year ago

This plugin isn't developed for HOOBs.

I would recommend moving to homebridge.

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

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 supported.

francescosabia commented 1 year ago

@francescosabia HOOBs isn't supported.

ok i understand. now can u please tell me why also people with homebridge have same problem than mine? thanks. so we can understand if there is something wrong

donavanbecker commented 1 year ago

I am on homebridge and I am not having this issue.

francescosabia commented 1 year ago

I am on homebridge and I am not having this issue.

ok cmon. you are not very kindly. you won't help. you said no hoobs compatibility but the plugin appears in hoobs plugin list. so an user how can know if the plugin works or not?? it worked good since yesterday. i asked for help maybe together a fix can be found. you simply won't help. OK

donavanbecker commented 1 year ago

@francescosabia Do you see any HOOBs logos on the plugin readme? No you don't.

HOOBs puts plugins in the list and marks it as "certified" without the okay from the plugin developer.

Potentially could be an issue with the plugin, but will not look into it if you confirm you are using HOOBs, because I don't support HOOBs and it could potentially be a HOOBs issue.

francescosabia commented 1 year ago

@francescosabia Do you see any HOOBs logos on the plugin readme? No you don't.

HOOBs puts plugins in the list and marks it as "certified" without the okay from the plugin developer.

Potentially could be an issue with the plugin, but will not look into it if you confirm you are using HOOBs, because I don't support HOOBs and it could potentially be a HOOBs issue.

What do you have against hoobs? Every plugin works good with it. You will need 5 minutes to see if it s a plugin issue or not. I don t understand why you won’t. Good work

francescosabia commented 1 year ago

Just to let you know, with new version 2.7.0 it started working again.. I hope it will continue working. Thanks 🙏🏻