Martvvliet/homebridge-denon-heos

plugin crashes homekit on boot when receiver is offline

ledhed2222 opened this issue · 1 comments

If:

  • you have a receiver configured in homebridge with this plugin
  • you unplug that receiver (or otherwise make it unavailable on the network)
  • you restart homebridge

then the plugin crashes along with homebridge. This is not something I noticed until I moved, but it is really annoying and is not the same behavior I see in other plugins.

Here's the relevant part of my config:

      {
            "platform": "DenonAVR",
            "pollInterval": 3,
            "devices": [
                {
                    "name": "Marantz NR1200",
                    "ip": "192.168.50.123",
                    "zone": 1,
                    "switchInfoMenu": false,
                    "inputs": [
                        {
                            "inputID": "MPLAY",
                            "name": "Apple TV",
                            "defaultVolume": 0
                        },
                        {
                            "inputID": "GAME",
                            "name": "Retro Pi"
                        }
                    ]
                }
            ],
            "switches": [
                {
                    "name": "Denon Receiver Input",
                    "zone": 1,
                    "pollAllInput": false
                }
            ],
            "volumeControl": [
                {
                    "name": "Receiver Volume",
                    "ip": "192.168.50.123",
                    "zone": 1,
                    "controlType": "fan",
                    "volumeLimit": 85
                }
            ]
        }

Here's the logs:

291b2330f] [HomeBridge ID: 277fba84-5dc3-47a7-8b4f-c1cff4cac242]
[1/28/2022, 2:37:45 AM] TypeError: telnet is not a constructor
    at receiver.connectTelnet (/usr/lib/node_modules/homebridge-denon-heos/index.js:579:27)
    at receiver.startConfiguration (/usr/lib/node_modules/homebridge-denon-heos/index.js:350:9)
    at Request._callback (/usr/lib/node_modules/homebridge-denon-heos/index.js:326:11)
    at self.callback (/usr/lib/node_modules/homebridge-denon-heos/node_modules/request/request.js:185:22)
    at Request.emit (node:events:390:28)
    at Request.onRequestError (/usr/lib/node_modules/homebridge-denon-heos/node_modules/request/request.js:877:8)
    at ClientRequest.emit (node:events:390:28)
    at Socket.socketErrorListener (node:_http_client:447:9)
    at Socket.emit (node:events:390:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1/28/2022, 2:37:45 AM] Got SIGTERM, shutting down Homebridge...
[1/28/2022, 2:37:50 AM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

A really good workaround for this is to run this plugin as a child Bridge. That really solves all the issues.