AMoo-Miki / homebridge-tuya-lan

Homebridge plugin for IoT devices that use Tuya Smart's platform
MIT License
204 stars 52 forks source link

Having Multiple Instances crashes instance. #104

Closed iRayanKhan closed 4 years ago

iRayanKhan commented 5 years ago

Hello, I have a separate homebridge instance for each plugin just incase something happens to a plugin, but if this plugin in not defined in an instances config.json it shuts homebridge down. The output will be pasted below. The only suggestion I have to fix this, is for the plugin to not require anything to be defined in the config.json file. To fix this, I uninstall the plugin, then re-install to restart it which isn't ideal as I use PM2 to manage auto-restarts.

Output Error:

pi@raspberrypi:~ $ homebridge -U ~/TvBridge/
[10/18/2019, 01:25:44] Loaded config.json with 0 accessories and 2 platforms.
[10/18/2019, 01:25:44] ---
[10/18/2019, 01:25:46] Loaded plugin: homebridge-bond
[10/18/2019, 01:25:46] Registering platform 'homebridge-bond.Bond'
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:46] Plugin /usr/lib/node_modules/homebridge-bravia-tvos requires Node version of ^8.9.1 which does not satisfy the current Node version of v12.11.1. You may need to upgrade your installation of Node.
[10/18/2019, 01:25:46] Loaded plugin: homebridge-bravia-tvos
[10/18/2019, 01:25:46] Registering platform 'homebridge-bravia-tvos.BraviaOSPlatform'
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:46] Loaded plugin: homebridge-chamberlain
[10/18/2019, 01:25:46] Registering accessory 'homebridge-chamberlain.Chamberlain'
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:46] Loaded plugin: homebridge-dummy
[10/18/2019, 01:25:46] Registering accessory 'homebridge-dummy.DummySwitch'
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:46] Loaded plugin: homebridge-magichome-platform
[10/18/2019, 01:25:46] Registering platform 'homebridge-magichome-platform.MagicHome-Platform'
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:46] Loaded plugin: homebridge-raspberrypi-temperature
[10/18/2019, 01:25:46] ---
[10/18/2019, 01:25:48] Loaded plugin: homebridge-roomba-stv
[10/18/2019, 01:25:48] Registering accessory 'homebridge-roomba.Roomba'
[10/18/2019, 01:25:48] ---
[10/18/2019, 01:25:48] Loaded plugin: homebridge-tplink-smarthome
[10/18/2019, 01:25:48] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[10/18/2019, 01:25:48] ---
[10/18/2019, 01:25:48] Loaded plugin: homebridge-tuya-lan
[10/18/2019, 01:25:48] Registering platform 'homebridge-tuya-lan.TuyaLan'
[10/18/2019, 01:25:48] ---
[10/18/2019, 01:25:48] Loading 2 platforms...
[10/18/2019, 01:25:48] [TplinkSmarthome] Initializing TplinkSmarthome platform...
[10/18/2019, 01:25:48] [TplinkSmarthome] homebridge-tplink-smarthome v4.0.1, node v12.11.1, homebridge v0.4.50
[10/18/2019, 01:25:48] [BraviaOSPlatform] Initializing BraviaOSPlatform platform...
[10/18/2019, 01:25:48] [BraviaOSPlatform] **************************************************************
[10/18/2019, 01:25:48] [BraviaOSPlatform] BraviaOSPlatform v3.0.6 by SeydX
[10/18/2019, 01:25:48] [BraviaOSPlatform] GitHub: https://github.com/SeydX/homebridge-bravia-tvos
[10/18/2019, 01:25:48] [BraviaOSPlatform] Email: seyd55@outlook.de
[10/18/2019, 01:25:48] [BraviaOSPlatform] **************************************************************
[10/18/2019, 01:25:48] [BraviaOSPlatform] start success...
Load homebridge-bond.Bond
[10/18/2019, 01:25:48] [homebridge-bond.Bond] ERR: Bond platform not defined in config.json
Load homebridge-magichome-platform.MagicHome-Platform
Load homebridge-tuya-lan.TuyaLan
[10/18/2019, 01:25:48] TypeError: Cannot read property 'devices' of null
    at new TuyaLan (/usr/lib/node_modules/homebridge-tuya-lan/index.js:55:43)
    at Server._loadDynamicPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:358:30)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:92:8)
    at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:945:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
    at Module.load (internal/modules/cjs/loader.js:798:32)
    at Function.Module._load (internal/modules/cjs/loader.js:711:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10)
    at internal/main/run_main_module.js:17:11
[10/18/2019, 01:25:48] Got SIGTERM, shutting down Homebridge...
codyc1515 commented 5 years ago

I have suggested a fix for this.

iRayanKhan commented 4 years ago

The PR fixed this, it should be merged as it saved a lot of pain lol. Closing this and thanks again for your patch!

timmills commented 4 years ago

This problem seems to still be present in 1.4.0