aangert / homebridge-musiccast-tv

Homebridge plugin for Yamaha MusicCast devices
GNU General Public License v3.0
15 stars 3 forks source link

Speaker action crashes Homebridge #7

Closed souleh closed 4 years ago

souleh commented 4 years ago

I have Homebridge running inside homebridge-docker. Homebridge is usually stable, but I have set up the homebridge-musiccast-tv plugin (v1.6.0) to use with my Yamaha NX-N500 speakers, and I find when I ask Siri to turn the speakers on, it causes Homebridge to crash.

I am running Homebridge in insecure mode to also control it via google home, but in this case I am controlling it via Siri on an Apple TV / Homekit hub via the local network.

Below is a log excerpt showing me turning the speakers off (successfully), and then on again (causes the crash). This happens every time, it is not intermittent. The action does however succeed before the crash occurs:

[5/14/2020, 7:10:45 PM] [Speakers] Active to 0 [5/14/2020, 7:10:53 PM] [Speakers] Active to 1 [5/14/2020, 7:10:53 PM] [Speakers] powerOnInput: optical [5/14/2020, 7:10:53 PM] [Speakers] Switch to 15: optical [5/14/2020, 7:10:53 PM] [Speakers] powerOnVolume: 50 [5/14/2020, 7:10:53 PM] [Speakers] Volume to 50 [5/14/2020, 7:10:53 PM] Error: This callback function has already been called by someone else; it can only be called one time. at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/util/once.js:11:19 at MusicCastTV.setVolume (/homebridge/node_modules/homebridge-musiccast-tv/index.js:625:3) at MusicCastTV.setActive (/homebridge/node_modules/homebridge-musiccast-tv/index.js:490:10) at Active.emit (events.js:310:20) at Active.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:59:38) at Active.Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:349:23) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:940:36 at Array.forEach (:null:null) at Bridge.Accessory._this._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:808:18) at HAPServer.emit (events.js:310:20) at HAPServer.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:59:38) at HAPServer._this._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:851:23) at IncomingMessage. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:240:39) at IncomingMessage.emit (events.js:310:20) at endReadableNT (_stream_readable.js:1187:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

[5/14/2020, 7:10:53 PM] Got SIGTERM, shutting down Homebridge... [5/14/2020, 7:10:58 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null [5/14/2020, 7:11:03 PM] [HB Supervisor] Restarting Homebridge... [5/14/2020, 7:11:03 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules [5/14/2020, 7:11:03 PM] [HB Supervisor] Started Homebridge v1.0.4 with PID: 1831 [5/14/2020, 7:11:04 PM] Loaded config.json with 1 accessories and 2 platforms. [5/14/2020, 7:11:04 PM] --- [5/14/2020, 7:11:06 PM] Loaded plugin: homebridge-dummy [5/14/2020, 7:11:06 PM] Registering accessory 'homebridge-dummy.DummySwitch' [5/14/2020, 7:11:06 PM] --- [..] [5/14/2020, 7:11:07 PM] Loaded plugin: homebridge-musiccast-tv [5/14/2020, 7:11:07 PM] Registering accessory 'homebridge-musiccast-tv.MusicCastTV' [5/14/2020, 7:11:07 PM] --- [..] [5/14/2020, 7:11:07 PM] Loading 2 platforms... [..] [5/14/2020, 7:11:07 PM] Loading 1 accessories... [5/14/2020, 7:11:07 PM] [Speakers] Initializing MusicCastTV accessory... [5/14/2020, 7:11:07 PM] [Speakers] Initialized 'Speakers' [..] [5/14/2020, 7:11:07 PM] Homebridge is running on port 51631. [5/14/2020, 7:11:07 PM] [Speakers] volume: 68 maxVol: 100 [5/14/2020, 7:11:07 PM] [Speakers] Input: optical


Thanks!

aangert commented 4 years ago

Looks like the crash is caused by powerOnInput and powerOnVolume being used at the same time. I will hopefully fix it this weekend

aangert commented 4 years ago

This is fixed in v1.6.1