OpenWonderLabs / homebridge-switchbot

The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit. Homebridge.
https://www.switch-bot.com/
ISC License
229 stars 47 forks source link

Bug: v3.5.0-beta crashes on restart #971

Closed nyjklein closed 1 month ago

nyjklein commented 1 month ago

Describe the Bug

file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/dist/platform.js:36
import { EveHomeKitTypes } from 'homebridge-lib';
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module 'homebridge-lib' does not provide an export named 'EveHomeKitTypes'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at Plugin.load (/var/lib/homebridge/node_modules/homebridge/src/plugin.ts:227:40)
    at ChildBridgeFork.loadPlugin (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:110:5)
[15/05/2024, 08:46:57] [SwitchBot] Child bridge process ended
[15/05/2024, 08:46:57] [SwitchBot] Process Ended. Code: 1, Signal: null
[15/05/2024, 08:47:04] [SwitchBot] Restarting Process...
[15/05/2024, 08:47:05] [SwitchBot] Launched child bridge with PID 228482

To Reproduce

Just try installing beta

Expected Behavior

Don't crash

Relevant Log Output

[15/05/2024, 08:46:46] [SwitchBot] Process Ended. Code: 143, Signal: null
[15/05/2024, 08:46:53] [SwitchBot] Restarting Process...
[15/05/2024, 08:46:53] [SwitchBot] Launched child bridge with PID 228468
file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/dist/platform.js:36
import { EveHomeKitTypes } from 'homebridge-lib';
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module 'homebridge-lib' does not provide an export named 'EveHomeKitTypes'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at Plugin.load (/var/lib/homebridge/node_modules/homebridge/src/plugin.ts:227:40)
    at ChildBridgeFork.loadPlugin (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:110:5)
[15/05/2024, 08:46:57] [SwitchBot] Child bridge process ended
[15/05/2024, 08:46:57] [SwitchBot] Process Ended. Code: 1, Signal: null
[15/05/2024, 08:47:04] [SwitchBot] Restarting Process...
[15/05/2024, 08:47:05] [SwitchBot] Launched child bridge with PID 228482
file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/dist/platform.js:36
import { EveHomeKitTypes } from 'homebridge-lib';
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module 'homebridge-lib' does not provide an export named 'EveHomeKitTypes'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at Plugin.load (/var/lib/homebridge/node_modules/homebridge/src/plugin.ts:227:40)
    at ChildBridgeFork.loadPlugin (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:110:5)
[15/05/2024, 08:47:05] [SwitchBot] Child bridge process ended
[15/05/2024, 08:47:05] [SwitchBot] Process Ended. Code: 1, Signal: null
[15/

Screenshots

No response

Device and Model

not needed

Node.js Version

v20.13.1

NPM Version

x

Homebridge Version

x

Homebridge Switchbot Plugin Version

x

Homebridge Config UI X Plugin Version

x

Operating System

Debian GNU/Linux Bullseye (11)

donavanbecker commented 1 month ago

Yeah sorry, not ready for testing just yet. Working through a few things.

Doing a big refactoring

nyjklein commented 1 month ago

OK. Thanks.

Also had to fall back to prod version. I couldn't select the prior beta.

donavanbecker commented 1 month ago

Getting close, sorry

donavanbecker commented 1 month ago

@nyjklein Try the latest beta

nyjklein commented 1 month ago

Still NG. Different error:

[15/05/2024, 18:09:53] [SwitchBot] Curtain: Living Room Curtain Config: {"set_minStep":10,"set_min":5,"set_max":96,"setOpenMode":"0","setCloseMode":"0","hide_lightsensor":true}
TypeError: Cannot read properties of undefined (reading 'Service')
    at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:73:35)
    at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1274:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[15/05/2024, 18:09:54] [SwitchBot] Child bridge process ended
[15/05/2024, 18:09:54] [SwitchBot] Process Ended. Code: 1, Signal: null
[15/05/2024, 18:09:58] [Homebridge UI] Running Command: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/plugin-upgrade-install.sh @switchbot/homebridge-switchbot 3.4.0 /var/lib/homebridge/node_modules
[15/05/2024, 18:10:01] [SwitchBot] Restarting Process...
[15/05/2024, 18:10:02] [SwitchBot] Launched child bridge with PID 257414
Error: Cannot find package 'undici' imported from /var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/dist/platform.js
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36)
[15/05/2024, 18:10:02] [SwitchBot] Child bridge process ended
[15/05/2024, 18:10:02] [SwitchBot] Process Ended. Code: 1, Signal: null
kellery82 commented 1 month ago

Exact same issue, rolled back to Prod version

donavanbecker commented 1 month ago

Okay I pushed out 2 new betas. Try the latest and please report back.

kellery82 commented 1 month ago

Just tried Beta 30 and crashes Homebridge again :(

[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeFanService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1112:22)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:361:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeLockService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1094:23)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:362:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeDoorService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1085:23)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:363:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeFaucetService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1103:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:364:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeSwitchService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1148:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:365:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeWindowService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1121:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:366:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeGarageDoorService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1076:29)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:367:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeWindowCoveringService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1130:33)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:368:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeStatefulProgrammableSwitchService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1139:45)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:369:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeFanService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1112:22)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:361:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeLockService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1094:23)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:362:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeDoorService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1085:23)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:363:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeFaucetService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1103:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:364:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeSwitchService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1148:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:365:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeWindowService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1121:25)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:366:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeGarageDoorService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1076:29)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:367:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeWindowCoveringService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1130:33)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:368:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[5/17/2024, 1:18:04 PM] TypeError: Cannot set properties of undefined (setting 'Service')
    at Bot.removeStatefulProgrammableSwitchService (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:1139:45)
    at new Bot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/bot.ts:369:12)
    at SwitchBotPlatform.createBot (file:///volume1/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:917:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
donavanbecker commented 1 month ago

Please try again, with the latest beta

kellery82 commented 1 month ago

Tried latest beta and it doesn’t crash homebridge. Thanks 🤩

nyjklein commented 1 month ago

I tried the latest beta-44. Crashes mine:

[17/05/2024, 09:53:22] [SwitchBot] Restarting child bridge...
[17/05/2024, 09:53:22] Got SIGTERM, shutting down child bridge process...
[17/05/2024, 09:53:28] [SwitchBot] Child bridge process ended
[17/05/2024, 09:53:28] [SwitchBot] Process Ended. Code: 143, Signal: null
[17/05/2024, 09:53:35] [SwitchBot] Restarting Process...
[17/05/2024, 09:53:36] [SwitchBot] Launched child bridge with PID 347188
[17/05/2024, 09:53:41] Registering platform '@switchbot/homebridge-switchbot.SwitchBot'
[17/05/2024, 09:53:41] [SwitchBot] Loaded @switchbot/homebridge-switchbot v3.5.0-beta.44 child bridge successfully
[17/05/2024, 09:53:41] Loaded 9 cached accessories from cachedAccessories.0E524B5C18A9.
[17/05/2024, 09:53:41] Homebridge v1.8.2 (HAP v0.12.1) (SwitchBot) is running on port 55335.
[17/05/2024, 09:53:41] [SwitchBot] Total SwitchBot Devices Found: 11
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Outdoor Meter SwB DeviceID: CFD41B916DA3
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Dining Room SwB DeviceID: E0C8750159BB
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Bedroom SwBP DeviceID: E3D163DE2E31
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Motion Sensor 2E DeviceID: EBA08112E12E
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Small Bathroom SwB DeviceID: F1BAF4B4E58E
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Main Bathroom SwB DeviceID: F3745EADBBFE
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Living Room SwBP DeviceID: F4B27AC3DF57
[17/05/2024, 09:53:41] [SwitchBot] Restoring existing accessory from cache: Office SwBP DeviceID: FA500E1417E8
[17/05/2024, 09:53:42] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:42] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:43] [SwitchBot] Restoring existing accessory from cache: Living Room Curtain DeviceID: FD1E6D06B532
[17/05/2024, 09:53:43] [SwitchBot] WoIOSensor: Outdoor Meter SwB failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] Meter: Dining Room SwB failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] MeterPlus: Bedroom SwBP failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] Motion Sensor: Motion Sensor 2E failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] Meter: Small Bathroom SwB failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] Meter: Main Bathroom SwB failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] MeterPlus: Living Room SwBP failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:43] [SwitchBot] MeterPlus: Office SwBP failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:44] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Configured Name': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:44] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Serial Number': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:44] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Firmware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:44] [@switchbot/homebridge-switchbot] This plugin generated a warning from the characteristic 'Hardware Revision': characteristic value expected string and received undefined. See https://homebridge.io/w/JtMGR for more info.
[17/05/2024, 09:53:44] [SwitchBot] Curtain: Living Room Curtain failed openAPIRefreshStatus with OpenAPI Connection, Error Message: "Cannot read properties of null (reading 'json')"
[17/05/2024, 09:53:44] [SwitchBot] WoIOSensor: Outdoor Meter SwB Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] Meter: Dining Room SwB Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] MeterPlus: Bedroom SwBP Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] Motion Sensor: Motion Sensor 2E Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] Meter: Small Bathroom SwB Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] Meter: Main Bathroom SwB Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] MeterPlus: Living Room SwBP Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] MeterPlus: Office SwBP Config: {"connectionType":"OpenAPI"}
[17/05/2024, 09:53:44] [SwitchBot] Curtain: Living Room Curtain Config: {"refreshRate":30,"connectionType":"OpenAPI","set_minStep":10,"set_min":5,"set_max":96,"setOpenMode":"0","setCloseMode":"0","hide_lightsensor":true}
TypeError: Cannot set properties of undefined (setting 'Service')
    at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:76:33)
    at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1280:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[17/05/2024, 09:53:44] [SwitchBot] Child bridge process ended
nyjklein commented 1 month ago

And same error on beta-45:

[17/05/2024, 10:51:55] [SwitchBot] Curtain: Living Room Curtain Config: {"refreshRate":30,"connectionType":"OpenAPI","set_minStep":10,"set_min":5,"set_max":96,"setOpenMode":"0","setCloseMode":"0","hide_lightsensor":true}
TypeError: Cannot set properties of undefined (setting 'Service')
    at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:76:33)
    at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1280:9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[17/05/2024, 10:51:55] [SwitchBot] Child bridge process ended
nyjklein commented 1 month ago

Just noting that initializing my curtains still crashes with beta-53: TypeError: Cannot set properties of undefined (setting 'Service') at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:59:33) at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1284:9) at processTicksAndRejections (node:internal/process/task_queues:95:5)

donavanbecker commented 1 month ago

Just noting that initializing my curtains still crashes with beta-53:

TypeError: Cannot set properties of undefined (setting 'Service')

at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:59:33)

at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1284:9) at processTicksAndRejections (node:internal/process/task_queues:95:5)

This is happening from your Motion Sensor, not your Curtain.

nyjklein commented 1 month ago

OK. Misunderstood since the curtain was the last device I saw in the log.

Still shouldn't be crashing.

Anything more I can provide to help?

donavanbecker commented 1 month ago

OK. Misunderstood since the curtain was the last device I saw in the log.

Still shouldn't be crashing.

Anything more I can provide to help?

No, I will test locally and see what I can find

donavanbecker commented 1 month ago

OK. Misunderstood since the curtain was the last device I saw in the log.

Still shouldn't be crashing.

Anything more I can provide to help?

Okay this should be resolved in v3.5.0-beta.57

nyjklein commented 1 month ago

Nope. Still the same crash in beta-57:

TypeError: Cannot set properties of undefined (setting 'Service')
    at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:59:33)
    at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1284:
9)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
donavanbecker commented 1 month ago

okay try the next beta

nyjklein commented 1 month ago

Beta-58: TypeError: Cannot set properties of undefined (setting 'Service') at new Motion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/motion.ts:59:33) at SwitchBotPlatform.createMotion (file:///var/lib/homebridge/node_modules/@switchbot/homebridge switchbot/src/platform.ts:1284: 9) at processTicksAndRejections (node:internal/process/task_queues:95:5)

nyjklein commented 1 month ago

okay try the next beta

Any further progress? I tried beta-62 earlier today. Still crashes.

donavanbecker commented 1 month ago

@nyjklein try the latest beta.

nyjklein commented 1 month ago

@nyjklein try the latest beta.

Nope. Beta-68:
TypeError: Cannot set properties of undefined (setting 'Service')
at new Curtain (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/device/curtain.ts:152:32)
at SwitchBotPlatform.createCurtain (file:///var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/src/platform.ts:1463:9)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
donavanbecker commented 1 month ago

@nyjklein, can you post your config? also try the latest beta

nyjklein commented 1 month ago

@nyjklein, can you post your config? also try the latest beta

    {
        "name": "SwitchBot",
        "credentials": {
            "token": "xxx",
            "secret": "yyy",
            "notice": "Keep your Token & Secret a secret!"
        },
        "options": {
            "devices": [
                {
                    "deviceId": "C3C22D5491D3",
                    "configDeviceName": "Living Room Hub 2",
                    "hide_device": true
                },
                {
                    "deviceId": "FD1E6D06B532",
                    "configDeviceName": "Living Room Curtain",
                    "hide_device": false,
                    "configDeviceType": "Curtain",
                    "connectionType": "OpenAPI",
                    "curtain": {
                        "set_minStep": 10,
                        "set_min": 5,
                        "set_max": 96,
                        "setOpenMode": "0",
                        "setCloseMode": "0",
                        "hide_lightsensor": true
                    },
                    "refreshRate": 30,
                    "logging": "standard"
                }
            ],
            "maxRetries": 15,
            "logging": "standard"
        },
        "_bridge": {
            "username": "0E:52:4B:5C:18:A9",
            "port": 55335
        },
        "platform": "SwitchBot"
    },
nyjklein commented 1 month ago

@nyjklein, can you post your config? also try the latest beta

OK! Beta-70 no longer crashes!!!

I do get these errors though:
[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 3.223.166.242:443)
[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 34.237.189.57:443)
[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 34.237.189.57:443)
[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 50.19.170.87:443)
donavanbecker commented 1 month ago

@nyjklein, can you post your config? also try the latest beta

OK! Beta-70 no longer crashes!!!


I do get these errors though:

[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 3.223.166.242:443)

[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 34.237.189.57:443)

[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 34.237.189.57:443)

[21/05/2024, 08:50:55] [SwitchBot] Error making request: Connect Timeout Error (attempted addresses: 50.19.170.87:443)

Where there more logs around this? It seems to be network related

nyjklein commented 1 month ago

Where there more logs around this? It seems to be network related

Haven't seen any more. And since they seem to trying to reach Amazon's EC2 infrastructure, best to ignore the error for now.

Thanks!

donavanbecker commented 1 month ago

Good to close this issue then?

nyjklein commented 1 month ago

Good to close this issue then?

Yes! Thanks for your support of this plugin.