PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 43 forks source link

edomoticz plugin is causing homebridge service to exit #119

Closed jeylites closed 6 years ago

jeylites commented 6 years ago

Hi - The edomoticz plugin is causing my homebridge service to exit when it can’t find a valid config entry. Is this normal behaviour?

This is my problem. I'm trying to setup two instances on the Raspberry Pi3, homebridge 1 - running Domoticz, broadlink plugin,hue, tasmota & homebridge 2 running IP cameras

I'm unable to run the second instance without including the plugin from the first in the config file. Otherwords, the edomoticz plugin won't allow the second homebridge to run if it's not in the config.

I have few other plugins installed in RPI that is not being used, however, they don't seem to cause homebridge to exit if it can't find a valid entry. In case your wondering the edomoticz plugin and domoticz are up to date.

Homebridge 1 Directory /var/homebridge

Homebridge 2 Directory /var/homecam

The Logs `pi@raspberrypi:~ $ homebridge -U ~/.homecam WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister [10/26/2017, 9:37:58 AM] Loaded plugin: homebridge-broadlink-rm [10/26/2017, 9:37:58 AM] Registering platform 'homebridge-broadlink-rm.BroadlinkRM' [10/26/2017, 9:37:58 AM] --- [10/26/2017, 9:37:58 AM] Loaded plugin: homebridge-camera-ffmpeg-omx [10/26/2017, 9:37:58 AM] Registering platform 'homebridge-camera-ffmpeg-omx.Camera-ffmpeg-omx' [10/26/2017, 9:37:58 AM] --- [10/26/2017, 9:37:59 AM] Loaded plugin: homebridge-edomoticz [10/26/2017, 9:37:59 AM] Registering platform 'homebridge-edomoticz.eDomoticz' [10/26/2017, 9:37:59 AM] --- [10/26/2017, 9:37:59 AM] Loaded config.json with 0 accessories and 1 platforms. [10/26/2017, 9:37:59 AM] --- [10/26/2017, 9:37:59 AM] Loading 1 platforms... [10/26/2017, 9:37:59 AM] Initializing Camera-ffmpeg-omx platform... [10/26/2017, 9:37:59 AM] Loading 0 accessories... Load homebridge-edomoticz.eDomoticz /usr/lib/node_modules/homebridge-edomoticz/index.js:96 this.server = config.server; ^

TypeError: Cannot read property 'server' of null at eDomoticzPlatform (/usr/lib/node_modules/homebridge-edomoticz/index.js:96:23) at Server._loadDynamicPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:315:30) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:82:8) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3)`

jeylites commented 6 years ago

Anyone?

harmjanr commented 6 years ago

@jeylites I had the same error, it was caused by a faulty config.json. Copy your content and check on jsonlint.com if it is valid. Or paste it here, so I can take a look too :)

jeylites commented 6 years ago

@appetitebv @harmjanr the config file is valid. But what I'm trying to point out here is let's say I have the edomoticz plugin installed on the device but I don't intend to use it and it's not listed in the config. Homebridge would not start.

This shouldn't happen. All the other plugins even though its installed on the device and not being listed in the config it would not stall homebridge unless it's listed in config wrong.

harmjanr commented 6 years ago

Ahh okay.. Yep agreed, if you don't list the plugin in the config it shouldn't break your Homebridge. Can't really help out with this, you'll need the plugin developer for this and it seems that he isn't very active anymore..

jeylites commented 6 years ago

@xTheRamon @PatchworkBoy hope the developer could look into this problem.

jcwlim commented 6 years ago

This is due to the index.js calling the server parameters problem. there are 2 ways to solve this.

  1. Create a edomoticz json at both your instance and one of them set the roomid to a empty roomid. This should work fine.
  2. modify the index.js file, look for this.server = config.server and change it to try{ this.server = config.server; }catch (e){ return; }
jeylites commented 6 years ago

@lily148

Currently, Both of my instances are set up as "room id= 0"

so do I have to exclude the 0 from on one of the instances?

jcwlim commented 6 years ago

You can set for both but you will get duplicate home device if you do that. Just set it to other roomid

PatchworkBoy commented 6 years ago

modify the index.js file, look for this...

Github latest pushed to npm including @lily148’s fix...