ACDR / homebridge-yamaha-avr

homebridge-plugin for Yamaha AVR. Audio Receiver Accessory with Power, Input, Volume & Remote Control
Apache License 2.0
45 stars 6 forks source link

Error in log: "This plugin slows down Homebridge. The read handler for the characteristic 'Active Identifier' didn't respond at all!. #71

Closed knikkabokka closed 2 years ago

knikkabokka commented 2 years ago

Describe The Bug: First of all: Thanx for fixing the "Unexpected Input bug" so fast! 😊👍🏻

Next error in log is: "This plugin slows down Homebridge. The read handler for the characteristic 'Active Identifier' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info."

I had this error also in older versions of the plug in.

To Reproduce:

Expected behavior:

Logs:

[1.9.2022, 12:19:40] [homebridge-yamaha-avr] This plugin slows down Homebridge. The read handler for the characteristic 'Active Identifier' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.

Plugin Config:

{ "ip": "xxx.xxx.xxx.xxx", "name": "Wohnzimmer", "cacheDirectory": "/var/lib/homebridge/.yamahaAVR", "platform": "yamaha-avr" },

Environment:

ACDR commented 2 years ago

Please try 2.1.2-beta.0

knikkabokka commented 2 years ago

And, in Homekit-App I first got the "Audio-device" as "not responding ...

After deleting it and re-adding it, it is responding, I can turn it on and off, but there are no inputs listed.

ACDR commented 2 years ago

Try quitting the Home app and opening again.

Home app seems to get confused sometimes when Homebridge is restarted whilst it's open.

knikkabokka commented 2 years ago

Please try 2.1.2-beta.0

OK, I will ... Just a minute! 😁

Restarting Home.App and installing 2.1.2-beta.0 helped - at least a bit.

I still get errors (see below), but no "red ones" anymore, in the log.

And: I can chose the most inputs via HomeKit, but a few are faulty: If I try to change input to "V-Aux", "NET RADIO" or "Tuner" via the Home.App, it simply won't change the Input, and stick to the one I had chosen before ... In the log I nevertheless can read "Set Input to ..." without any error. But it doesn't change in reality.

...

--->>>>> with 2.1.2-beta0 I now get the following:

[1.9.2022, 13:16:39] [Wohnzimmer] Current input: AV5 (AV5) Unhandled rejection Error: This callback function has already been called by someone else; it can only be called one time. at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:7:13 at /usr/lib/node_modules/homebridge-yamaha-avr/src/accessory.ts:501:18 at Array.filter () at /usr/lib/node_modules/homebridge-yamaha-avr/src/accessory.ts:499:25 at tryCatcher (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:673:18) at Promise._resolveCallback (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:466:57) at Promise._settlePromiseFromHandler (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:559:17) at Promise._settlePromise (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/usr/lib/node_modules/homebridge-yamaha-avr/node_modules/bluebird/js/release/promise.js:673:18) [1.9.2022, 13:16:52] [Wohnzimmer] Set input: Deezer (Deezer) [1.9.2022, 13:16:54] [Wohnzimmer] Set input: Blu-ray (HDMI1) [1.9.2022, 13:16:55] [Wohnzimmer] Set input: Fire-TV Stick (HDMI2) [1.9.2022, 13:17:02] [Wohnzimmer] Set input: Wii (HDMI3) [1.9.2022, 13:17:05] [Wohnzimmer] Set input: HDMI4 (HDMI4) [1.9.2022, 13:17:05] [Wohnzimmer] Set input: HDMI5 (HDMI5) [1.9.2022, 13:17:06] [Wohnzimmer] Set input: AV2 (AV2) [1.9.2022, 13:17:08] [Wohnzimmer] Set input: AV6 (AV6) [1.9.2022, 13:17:09] [Wohnzimmer] Set input: V-AUX (VAUX) [1.9.2022, 13:17:15] [Wohnzimmer] Set input: AV5 (AV5) [1.9.2022, 13:17:19] [Wohnzimmer] Set input: AV6 (AV6) [1.9.2022, 13:17:22] [Wohnzimmer] Set input: V-AUX (VAUX) [1.9.2022, 13:17:24] [Wohnzimmer] Set input: AUDIO1 (AUDIO1) [1.9.2022, 13:17:25] [Wohnzimmer] Set input: V-AUX (VAUX) [1.9.2022, 13:17:26] [Wohnzimmer] Set input: AUDIO2 (AUDIO2) [1.9.2022, 13:17:31] [Wohnzimmer] Set input: AUDIO1 (AUDIO1) [1.9.2022, 13:17:32] [Wohnzimmer] Set input: V-AUX (VAUX)

knikkabokka commented 2 years ago

Oh, wait, now I get at least red error for "Tuner":

[1.9.2022, 13:22:05] [Wohnzimmer] Unexpected input: "TUNER" [ { id: 'Tuner', name: 'Tuner' }, { id: 'Napster', name: 'Napster' }, { id: 'Spotify', name: 'Spotify' }, { id: 'JUKE', name: 'JUKE' }, { id: 'Qobuz', name: 'Qobuz' }, { id: 'TIDAL', name: 'TIDAL' }, { id: 'Deezer', name: 'Deezer' }, { id: 'SERVER', name: 'SERVER' }, { id: 'NETRADIO', name: 'NET RADIO' }, { id: 'Bluetooth', name: 'Bluetooth' }, { id: 'USB', name: 'USB' }, { id: 'AirPlay', name: 'AirPlay' }, { id: 'PHONO', name: 'PHONO' }, { id: 'HDMI1', name: 'Blu-ray' }, { id: 'HDMI2', name: 'Fire-TV Stick' }, { id: 'HDMI3', name: 'Wii' }, { id: 'HDMI4', name: 'HDMI4' }, { id: 'HDMI5', name: 'HDMI5' }, { id: 'AV1', name: 'AV1' }, { id: 'AV2', name: 'AV2' }, { id: 'AV3', name: 'AV3' }, { id: 'AV4', name: 'AV4' }, { id: 'AV5', name: 'AV5' }, { id: 'AV6', name: 'AV6' }, { id: 'VAUX', name: 'V-AUX' }, { id: 'AUDIO1', name: 'AUDIO1' }, { id: 'AUDIO2', name: 'AUDIO2' } ] [1.9.2022, 13:22:10] [Wohnzimmer] Unexpected input: "TUNER" [ { id: 'Tuner', name: 'Tuner' }, { id: 'Napster', name: 'Napster' }, { id: 'Spotify', name: 'Spotify' }, { id: 'JUKE', name: 'JUKE' }, { id: 'Qobuz', name: 'Qobuz' }, { id: 'TIDAL', name: 'TIDAL' }, { id: 'Deezer', name: 'Deezer' }, { id: 'SERVER', name: 'SERVER' }, { id: 'NETRADIO', name: 'NET RADIO' }, { id: 'Bluetooth', name: 'Bluetooth' }, { id: 'USB', name: 'USB' }, { id: 'AirPlay', name: 'AirPlay' }, { id: 'PHONO', name: 'PHONO' }, { id: 'HDMI1', name: 'Blu-ray' }, { id: 'HDMI2', name: 'Fire-TV Stick' }, { id: 'HDMI3', name: 'Wii' }, { id: 'HDMI4', name: 'HDMI4' }, { id: 'HDMI5', name: 'HDMI5' }, { id: 'AV1', name: 'AV1' }, { id: 'AV2', name: 'AV2' }, { id: 'AV3', name: 'AV3' }, { id: 'AV4', name: 'AV4' }, { id: 'AV5', name: 'AV5' }, { id: 'AV6', name: 'AV6' }, { id: 'VAUX', name: 'V-AUX' }, { id: 'AUDIO1', name: 'AUDIO1' }, { id: 'AUDIO2', name: 'AUDIO2' } ] [1.9.2022, 13:22:10] [Wohnzimmer] Set input: Tuner (Tuner) [1.9.2022, 13:22:14] [Wohnzimmer] Set input: Qobuz (Qobuz) [1.9.2022, 13:22:17] [Wohnzimmer] Set input: Tuner (Tuner)

knikkabokka commented 2 years ago

Could this have something to do with the fact that the IDs in the error message are written differently than the name of the respective input in the receiver's display?

On the display of the receiver:

For all other - thus the working - inputs, the notations in the error message match 100% with the notation on the display of the Yamaha RX-V781.

ACDR commented 2 years ago

How about with 2.1.2-beta.2

knikkabokka commented 2 years ago

Not better ...

Wait a minute, I'll ask my Yamaha RX-V781 via "IP-OF-THE-RECEIVER/YamahaExtendedControl/v1/system/getFeatures" which features are available in the latest firmware 2.86 and how they are called ... And paste the output here.

The Inputs are written differently in this list ... All lowercase and v_aux and net_radio with an underscore?

Maybe that helps?

Here is the function list:

{"response_code":0,"system":{"func_list":["wired_lan","wireless_lan","wireless_direct","network_standby","network_standby_auto","bluetooth_standby","bluetooth_tx_setting","hdmi_out_1","hdmi_out_2","airplay","disklavier_settings","network_reboot","party_mode"],"zone_num":2,"input_list":[{"id":"napster","distribution_enable":true,"rename_enable":false,"account_enable":true,"play_info_type":"netusb"},{"id":"spotify","distribution_enable":true,"rename_enable":false,"account_enable":false,"play_info_type":"netusb"},{"id":"juke","distribution_enable":true,"rename_enable":false,"account_enable":true,"play_info_type":"netusb"},{"id":"qobuz","distribution_enable":true,"rename_enable":false,"account_enable":true,"play_info_type":"netusb"},{"id":"tidal","distribution_enable":true,"rename_enable":false,"account_enable":true,"play_info_type":"netusb"},{"id":"deezer","distribution_enable":true,"rename_enable":false,"account_enable":true,"play_info_type":"netusb"},{"id":"airplay","distribution_enable":false,"rename_enable":false,"account_enable":false,"play_info_type":"netusb"},{"id":"mc_link","distribution_enable":false,"rename_enable":true,"account_enable":false,"play_info_type":"netusb"},{"id":"server","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"netusb"},{"id":"net_radio","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"netusb"},{"id":"bluetooth","distribution_enable":true,"rename_enable":false,"account_enable":false,"play_info_type":"netusb"},{"id":"usb","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"netusb"},{"id":"tuner","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"tuner"},{"id":"hdmi1","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"hdmi2","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"hdmi3","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"hdmi4","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"hdmi5","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av1","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av2","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av3","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av4","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av5","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"av6","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"audio1","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"audio2","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"phono","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"v_aux","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"},{"id":"main_sync","distribution_enable":true,"rename_enable":true,"account_enable":false,"play_info_type":"none"}]},"zone":[{"id":"main","func_list":["power","sleep","volume","mute","sound_program","pure_direct","enhancer","tone_control","dialogue_level","signal_info","prepare_input_change","link_control","link_audio_delay","link_audio_quality","scene","cursor","menu","surr_decoder_type","contents_display","actual_volume"],"input_list":["napster","spotify","juke","qobuz","tidal","deezer","airplay","mc_link","server","net_radio","bluetooth","usb","tuner","hdmi1","hdmi2","hdmi3","hdmi4","hdmi5","av1","av2","av3","av4","av5","av6","audio1","audio2","phono","v_aux"],"sound_program_list":["munich","vienna","chamber","cellar_club","roxy_theatre","bottom_line","sports","action_game","roleplaying_game","music_video","standard","spectacle","sci-fi","adventure","drama","mono_movie","2ch_stereo","7ch_stereo","surr_decoder","straight"],"surr_decoder_type_list":["toggle","dolby_surround","dts_neural_x","dts_neo6_cinema","dts_neo6_music"],"tone_control_mode_list":["manual"],"link_control_list":["speed","standard","stability"],"link_audio_delay_list":["audio_sync","lip_sync"],"link_audio_quality_list":["compressed","uncompressed"],"range_step":[{"id":"volume","min":0,"max":161,"step":1},{"id":"tone_control","min":-12,"max":12,"step":1},{"id":"dialogue_level","min":0,"max":3,"step":1},{"id":"actual_volume_db","min":-80.5,"max":16.5,"step":0.5}], "scene_num":4,"cursor_list":["up","down","left","right","select","return"],"menu_list":["on_screen","top_menu","menu","option","display"],"actual_volume_mode_list":["db"]},{"id":"zone2","zone_b":false,"func_list":["power","sleep","volume","mute","prepare_input_change","actual_volume"],"input_list":["napster","spotify","juke","qobuz","tidal","deezer","airplay","mc_link","server","net_radio","bluetooth","usb","tuner","av5","av6","audio1","audio2","phono","main_sync"],"range_step":[{"id":"volume","min":0,"max":161,"step":1},{"id":"actual_volume_db","min":-80.5,"max":10.0,"step":0.5}],"actual_volume_mode_list":["db"]}],"tuner":{"func_list":["am","fm","rds"],"range_step":[{"id":"am","min":531,"max":1611,"step":9},{"id":"fm","min":87500,"max":108000,"step":50}],"preset":{"type":"common","num":40}},"netusb":{"func_list":["recent_info","play_queue","mc_playlist","streaming_service_use"],"preset":{"num":40},"recent_info":{"num":40},"play_queue":{"size":200},"mc_playlist":{"size":200,"num":5},"net_radio_type":"airable","pandora":{"sort_option_list":["date","alphabet"]},"siriusxm":{"api_type":"everest"}},"distribution":{"version":2.00,"compatible_client":[2],"client_max":9,"server_zone_list":["main"]},"ccs":{"supported":true}}

ACDR commented 2 years ago

In short, this is caused by inconsistencies with the input IDs on initialisation vs. state/change checks in the current interface implementation.

I've been working on interfacing directly with the YamahaExtendedControl API in 3.0.0 which eliminates this problem.

ACDR commented 2 years ago

Have published a beta release for v3, 3.0.0-beta.2 - if you could give that one a shot and report back that would be great!

https://github.com/ACDR/homebridge-yamaha-avr/releases/tag/v3.0.0-beta.2

knikkabokka commented 2 years ago

OK, with v3.0.0-beta.2 all inputs except one (new?), called "Main Sync", seem fine and even the "slows down" error seems also to be gone. 😁

When choosing "Main Sync" the log says:

[1.9.2022, 14:59:07] [Wohnzimmer] Failed to set zone input

ACDR commented 2 years ago

Great!

Yeah, "main_sync" seems to be an input option returned by the API. Not sure why, as the setInput endpoint clearly doesn't accept it.

I'll filter it out in future, looks like its hidden in the Yamaha AV Controller App too.

knikkabokka commented 2 years ago

Yes, I guess you are right. MainSync is an "on-off" function, not an input. To sync the actual input of the main zone as well to the second zone. So it should be solved as a button, and not appear in the input list.

BTW: It's not hidden in the Yamaha AC Controller App. 😉

But it only appears in the input-options of the second zone, so you have to turn on the second zone and then chose the input for the second zone. There, in the input options of the second zone, you'll find it as "Main Zone Sync". As it only makes sense that way round. 😉😁

Another great improvement would be to be able to change the volume via voice. In a range from 0%-100%. Like: "Hey, Siri! Set Yamaha to 80%". 😁

ACDR commented 2 years ago

Ah, explains why I couldn't see it. I never touch Zone 2 - makes sense it would be there. 😄

/zone2/setInput accepts main_sync. I may experiment a bit with adding support for other zones & handling additional functionality (e.g. Pure Direct) with button devices.

I had been avoiding adding additional devices (especially workaround devices like fans for volume) to keep this plug-in clean & specifically focused on the HomeKit receiver device and its functionality. When I decided on this approach years ago I had expected the HomeKit receiver device functionality would expand... hasn't really been the case.

The more I think of it, the value of these bits of functionality may be worth the additional messy devices...

As for volume control via Siri in the meantime - you could look into a shortcut, similar to what I commented here: https://github.com/ACDR/homebridge-yamaha-avr/issues/31#issuecomment-1232472306