Closed munskey closed 3 years ago
Can you share your homebridge configuration? This is happening as the plugin is reading in your settings.
To help isolate the issue, I reset to factory defaults my Hoob install. No plugins, brand new installation. Then tried the below methods.
1) Installed Pico plugin, automatic homebridge reboot, SIGTERM, homebridge crash, log below.
1/10/2021, 7:42:57 PM Plugin "homebridge-pico" installed. 1/10/2021, 7:42:58 PM Got SIGINT, shutting down Bridge... 1/10/2021, 7:43:02 PM Loaded plugin 'homebridge-pico' 1/10/2021, 7:43:02 PM [1/10/2021, 7:43:02 PM] Registering platform 'homebridge-pico.Pico' 1/10/2021, 7:43:02 PM Loading 1 platforms... 1/10/2021, 7:43:02 PM [Pico] Initializing Pico platform... 1/10/2021, 7:43:02 PM [Pico] Pico Plugin Loaded - Version 1.0.2 1/10/2021, 7:43:02 PM [Pico] Bus Logging set to off 1/10/2021, 7:43:02 PM TypeError: config.servers is not iterable at new Pico (/home/hoobs/.hoobs/node_modules/homebridge-pico/index.js:39:31) at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:346:30 at Array.forEach (<anonymous>) at Server.loadPlatforms (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:320:31) at Server.start (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:152:35) at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/cli.js:94:16 at processTicksAndRejections (internal/process/task_queues.js:97:5)
*Note above is freshly installed, non-configured plugin (no host, port, switches).
2) Next, configured the plugin with server "host" and "port" settings, per the guide, reboot, SIGTERM, homebridge crash. "not iterable error..."
[ { "host": "192.168.86.13", "port": 23, "switches": [] } ]
3) Final step, configured plugin with complete "switches" details, reboot, Pico plugin WORKS.
[ { "host": "192.168.86.13", "port": 23, "switches": [ { "name": "Master Bedroom", "pico": 15, "type": "PJ2-2B" }, { "name": "Front Foyer", "pico": 16, "type": "PJ2-2B" }, { "name": "Living Room", "pico": 21, "type": "PJ2-4B-XXX-L31" } ] } ]
Other plugins I've installed don't crash homebridge when not fully configured. This led me down the path of incorrectly assuming that an incompatibility existed as the plugin crashed homebridge on initial install and crashed homebridge after configuring my host and port, so I did not pursue it further; "why setup a plugin that crashes on initial install?".
An improvement to the plugin design could be handling those exceptions gracefully (don't crash when they don't exist) or populating host, port and switches with filler/template data to mitigate the "not iterable error" and aid in the user populating/replacing the data in the config file.
Thank you for creating/enhancing such an immensely useful and underutilized plugin, been enjoying it since yesterday and your willingness to chase down my ticket is appreciated!
I'm glad this is now working for you!
When I do my next updates I'll look at making it more graceful when it isn't configured, or is partially configured.
Sounds good, thanks again for the immensely useful plugin. Closing the ticket.
Pico plugin fails to initialize, generates SIGTERM error and crashes Homebridge.
How to Recreate: Install Pico plugin. Restart homebridge. Plugins initialize
Unexpected: Pico plugin initializing fails and generates homebridge crash with log "TypeError: config.servers is not iterable...PMcGot SIGTERM, shutting down Bridge..."
Expected Pico plugin initializes successfully
Log capture:
Environment__ Server: Raspberry Pi 4, 8GB
Homebridge: HOOBS v3.3.1 Node v12.16.3
Installed Plugins: Vivint 1.3.1 published 10/14/2020 myQ 2.4.1 published 1/1/2021 Nest 4.5.1 published 11/20/2020 Pico 1.0.2 published 12/22/2020
Thanks for the help and creating the plugin; excited to get my Lutron Pico keypads implemented!