torandreroland / homebridge-sony-audio-control

Sony Audio Control of STR-DN1080 for Homebridge: https://github.com/nfarina/homebridge
ISC License
12 stars 10 forks source link

Unable to configure for Sony HT-ST5000 #3

Closed 6MH89F3j closed 4 years ago

6MH89F3j commented 4 years ago

I know your plugin is not tested with the HT-ST5000, but I checked on the URI terms and confirmed on the Sony Developer that the HT-ST5000 is supported.

I am attempting to install the plugin on a hoobs box.

This is my config:

{
        "accessory": "receiver",
        "plugin_map": {
            "plugin_name": "homebridge-sony-audio-control",
            "index": 0
        },
        "name": "Soundbar",
        "enableNetworkStandby": true,
        "ip": "192.168.4.125",
        "inputs": [
            {
                "name": "Input TV",
                "uri": "extInput:tv"
            }
        ]
    }

This is the issue I am seeing in the logs after trying to save the plugin.

7/17/2020, 5:14:19 PM Loaded plugin "homebridge-sony-audio-control". 7/17/2020, 5:14:19 PM [Soundbar] Creating receiver services! 7/17/2020, 5:14:19 PM [Soundbar] Creating information service! 7/17/2020, 5:14:19 PM [Soundbar] Creating volume service! 7/17/2020, 5:14:19 PM [Soundbar] Creating power service! 7/17/2020, 5:14:19 PM [Soundbar] Creating input services! 7/17/2020, 5:14:19 PM [Soundbar] Creating input service Input TV! 7/17/2020, 5:14:19 PM [Soundbar] Creating soundfield service Surround Mode! 7/17/2020, 5:14:19 PM [Soundbar] Creating soundfield service Stereo Mode! 7/17/2020, 5:14:20 PM [Soundbar] WebSocket client connected on endpoint ws://192.168.4.125:10000/sony/audio 7/17/2020, 5:14:20 PM [Soundbar] WebSocket client connected on endpoint ws://192.168.4.125:10000/sony/avContent 7/17/2020, 5:14:20 PM [Soundbar] Network standby is currently on 7/17/2020, 5:14:39 PM TypeError: Cannot read property 'mute' of undefined at SonyAudioControlReceiver. (/home/hoobs/.hoobs/node_modules/homebridge-sony-audio-control/index.js:365:59) at Request._callback (/home/hoobs/.hoobs/node_modules/homebridge-sony-audio-control/index.js:662:9) at Request.self.callback (/home/hoobs/.hoobs/node_modules/request/request.js:185:22) at Request.emit (events.js:310:20) at Request. (/home/hoobs/.hoobs/node_modules/request/request.js:1154:10) at Request.emit (events.js:310:20) at IncomingMessage. (/home/hoobs/.hoobs/node_modules/request/request.js:1076:12) at Object.onceWrapper (events.js:416:28) at IncomingMessage.emit (events.js:322:22) at endReadableNT (_stream_readable.js:1187:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) 7/17/2020, 5:14:40 PM Got SIGTERM, shutting down Bridge...

I am planning to add soundfield options that I looked up on the Sony developer site. However, I wanted to see if I could get the basic functionality of the plugin running first.

Any ideas what might be happening? Is the mute feature on the HT-ST5000 different than the receiver you created the plugin for?

6MH89F3j commented 4 years ago

It's also worth noting that I have the soundbar connected via the eARC HDMI port to the eARC HDMI port on my TV. Then I have my Apple TV 4K connected directly to my TV.

6MH89F3j commented 4 years ago

FWIW, I installed the Sony Music Center app, and that seemed to enable some network standby mode. I then tried again, and seemed to get a little further with the plugin. Now its failing to find the Volume property.

7/18/2020, 11:56:50 AM TypeError: Cannot read property 'volume' of undefined
at SonyAudioControlReceiver. (/home/hoobs/.hoobs/node_modules/homebridge-sony-audio-control/index.js:629:57)
at Request._callback (/home/hoobs/.hoobs/node_modules/homebridge-sony-audio-control/index.js:662:9)
at Request.self.callback (/home/hoobs/.hoobs/node_modules/request/request.js:185:22)
at Request.emit (events.js:310:20)
at Request. (/home/hoobs/.hoobs/node_modules/request/request.js:1154:10)
at Request.emit (events.js:310:20)
at IncomingMessage. (/home/hoobs/.hoobs/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:416:28)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) 7/18/2020, 11:56:50 AM Got SIGTERM, shutting down Bridge...

torandreroland commented 4 years ago

Hi and thank you for your interest in my plugin. Although it's difficult to say why the plugin doesn't work with a HT-ST5000, I have a suspicion that it could be because the soundbar doesn't support multiple zone (see Device URI, my plugin is hardcoded to extOutput:zone?zone=1).

6MH89F3j commented 4 years ago

Thank you for the response! Got it, that makes sense. What are the chances you could make zones and extoutput:zone?zone=1 optional? Or does the plugin need to make that assumption too often?

I really like the concept of your plugin, and mostly just need the ability to switch sound fields with HomeKit/Siri.

torandreroland commented 4 years ago

I think it should be doable, but the problem for me is the lack of device to test with. Can you try and change the following curl-command (i.e. change IP-address and omit the zone information (maybe params just should be "[]")) so that you get a proper response from your soundbar?

curl -d '{ "method": "getVolumeInformation", "id": 127, "params": [ { "output": "extOutput:zone?zone=1" } ], "version": "1.1" }' -X POST http://10.0.0.138:10000/sony/audio

6MH89F3j commented 4 years ago

I’m more than happy to help test!

Where do I change that curl command? Or are you saying I just update the IP and omit the zone info, and execute that curl command from my homebridge terminal, while the plugin is running?

And for the IP, I should update the POST command to use the IP of my soundbar?

torandreroland commented 4 years ago

Yes, basically omit the output part, since I believe that isn't correct parameteres for your soundbar, and change the IP-address. You can execute the command on a machine with curl installed. That probably includes doing it from the homebridge terminal, yes. Executing the command is not dependant on the plugin.

You must use the IP of your soundbar.

6MH89F3j commented 4 years ago

Cool, thanks for the help.

I was able to execute this command:

curl -d '{ "method": "getVolumeInformation", "id": 127, "params": [ { "output": "" } ], "version": "1.1" }' -X POST http://192.168.4.125:10000/sony/audio

And this is the response I got:

{"id":127,"result":[[{"maxVolume":50,"minVolume":0,"mute":"off","output":"","step":1,"volume":14}]]}

I tried setting params to [] and some other formats, but all were giving an error. When I set the output to "", that gave me what at least looks like a reasonable response.

Happy to try other formats as well. I will also look a little deeper at this function later today when I have more time. https://developer.sony.com/develop/audio-control-api/api-references/api-overview-2#_getvolumeinformation_v1_1

6MH89F3j commented 4 years ago

Yeah, even though the docs for getVolumeInformation say "Omit this field or use "" to affect all outputs for the device", Im not sure what they mean by "omit."

I tried sending just [] for params, but it returns error code 5, which is:

"The request body is empty, or the request has no ID or an invalid ID, or the request is for an undefined method, or the request has no params value or the params value is not an array."

I wonder if getVolumeInformation requires output as a param. So, setting it to "" is the right thing to do, which basically means "affect all outputs for the device", which is probably fine since only DN1080 supports Zones, and the rest of the support devices do not.

6MH89F3j commented 4 years ago

Hope you are doing well! Is there anything further I can do to help with this? I would love to help you get this working for other soundbars.

torandreroland commented 4 years ago

Hi again! I have in https://github.com/torandreroland/homebridge-sony-audio-control/commit/a68ac7b0bdb51a32e91a805c0e7879ef60fbc314 made the zone configurable and I hope this will help the plugin support the soundbar. Can you try with the updated index.js available here https://raw.githubusercontent.com/torandreroland/homebridge-sony-audio-control/master/index.js ?

6MH89F3j commented 4 years ago

Oh wow, thanks for working on this!

Sorry for my ignorance. How do I use the updated index.js? I’m still new to my hoobs box. Do I somehow replace the index.js on my hoobs instance? Or is there way to “install” it?

Thanks again for adding this feature, much appreciated. I’m super excited to get it working.

6MH89F3j commented 4 years ago

I did find the index file in my system node_modules/homebridge-sony-audio-control/index.js

Do I just replace that file with the one you provided? If so, any tips on the best way to do that? I dont want copy/paste, etc to make any issues.

torandreroland commented 4 years ago

Sorry, I don’t have any experience with Hoobs. I guess you just overwrite the file and restart homebridge.

6MH89F3j commented 4 years ago

Fair enough. I will work on that tonight and get back to you as soon as I can.

6MH89F3j commented 4 years ago

Quick update: Victory!

I was able to get it working! Woohoo!

Volume control works.

The soundfields are working too! :-)

Thanks for your support on this.

Let me know if I can help test any further.

torandreroland commented 4 years ago

Very good to hear! I will push this as a new version on NPM then and close this issue.

torandreroland commented 3 years ago

@6MH89F3j: Version 2.40 is a major rewrite courtesy of @MaxiHuHe04. I haven' had the chance to test if it works for a device without zone support, but please let me know if you have any problems with the new version.

6MH89F3j commented 3 years ago

Hey sorry I missed this. I tried to install the latest plugin, but can't get it to install on my hoobs box. I filed this issue with the details of the error I'm seeing. I'll also post it on the hoobs reddit to see if they can help.