-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for devices without getSupportedApiInfo (Sony BDV-N5200, HAP-S1, BDV-N9200W) #29
Comments
The error code (12) indicates a non-existing method which is documented here: https://developer.sony.com/develop/audio-control-api/api-references/api-overview-2#_getsupportedapiinfo_v1_0 -- Unfortunately I don't really have a quick solution for that at this point, as this call is used to locate what services is being provided and where their endpoints are. Maybe it is using websockets also instead of xhrpost? What is the output from discovery? Does it list services? You could try I think you best bet would be capturing the network traffic and trying to see how the songpal app is calling that method. |
Error out in CLI if unable to fetch the API information as seen in #29
Thanks for your fast reply! Discovery is listing some services, i recall at least audio and system tot be among them. i'll post the full output and XML-code when i'm back home tomorrow. |
Hi, Bit later than expected, but i managed to pull some info from my home cinema system. The output of
Below are the output of songpal -dd discover and the XML-file i pulled from my system: I tried to use Wireshark to get more info on the system control trough songpal, but it didn't gave any clues yet. But i'll keep digging! |
Ok, those look perfectly fine to me. So I suppose you'll really need to do some wireshark sniffing to see what the official app does to find out what's wrong there. Btw, could you also run |
hello, I've got the same problem with this BDV-N5200 device. But running
I'll see if i can find some more clues using wireshark |
What does the discovery say or is this coming from it? Looks like there is no URL at all, so that's why it fails. |
I used following command:
as output |
You have to use the endpoint URL as shown by discover. So |
running running the same command without BDV-N5200.json gives following output:
|
You can try to run it with |
Running with the -d flag doesnt give many useful output, so I tried running the app while logging with wireshark. I attached the resulting pcapng file. |
After looking into the sourcecode I noticed there is a higher debug lvl, so I tried running with
According to sony's api reference error code 12 means "no such method". So it looks like this device doesnt support the "getSupportedApiInfo" call. |
Indeed, it looks like there is no way to automatically obtain the API information, but that even the app uses some hardcoded information. I'll try to find some time during the holidays to look into if I can somehow easily add support for using hardcoded interfaces. |
Another device without getSupportedApiInfo:
|
I'm having the same issue with BDV-N9200W - BDV-2014. Would it be possible to use the existing devinfos files when getSupportedApiInfo is not available? |
The plan was to allow injecting an existing api info manually, but alas I haven't found any time to implement that. I got sidetracked on refactoring the codebase to improve the API to consist of separate services (to follow structure used by devices) to make it more testable and my plan was to include this there (as it could be useful for tests, too), and alas, I didn't find time to finish that. Considering that there are some potential users for this feature, I'll give it a second shot to see if I can find an easy way to implement it without any major refactoring. |
@rytilahti pretty sure yes. Maybe has a newer firmware version that does not support that method anymore? here is a trace I did capture
I did try Sony | Music Center app, and it allows to control the device, but did not yet have time to capture the communication between app and the sony device
|
Some devices do not support the ability to obtain information about available APIs. This PR adds new --devinfo-file option that allows using an existing devinfo file to feed the list of available services, which may be helpful for such devices as long as they implement getMethodTypes() call for the services. Potential fix for #29
I just created a PR to potentially fix this, to use, simply call I think I could also add |
@rytilahti great thanks. I did try it out. I get one step further, but looks like my BDV-N9200W is actually different compared to the devinfo in this repo. E.g. the method
|
Good news is that it has the Try |
👍 I'll dig a bit deeper tomorrow and try out the different things. And probably try to get a trace on what the sony app is doing to figure out what has changed sound output looks like this:
and list-all
|
Yeah, looks like no volume control there, so the best approach is to look what the app is doing... Maybe the Looking at the I think I have to adapt the PR simply to allow defining edit: one other thing you could do is to try what |
yes maybe they are not returning everything, or it somehow moved elsewhere here is the output for the disvoer
getSettringsTree returns slightl different format than the code expects:
|
I did have a chance today to capture what the sony app is doing. regarding songpal it is doing the following for discovery:
Volume and input is controlled via UPnP. Probably they are shifting functionality towards UPnP and remove their custom songpal solution. It appears that they are using AVTransport SetAVTransportURI to switch between the different inputs, but I could not figure out the details. |
I suppose this is to figure out if the device should be spoken over websocket vs. xhr post.
For api compatibility, the current python-songpal implementation takes one of the versions (maybe the first one?), but most of it is hardcoded at the moment so...
This will give the method signatures incl. return values. This is what gets done on all services by python-songpal to populate the internal structures.
Hmm. There are some cases in other models that are controlled via the UPnP APIs, but using it for volume controls & changing sources (and sinks) is new. Now I'm wondering if that 2014 in the model is for the build year? Could it be that some previous generations used UPnP and they converted away from it to the new API? Anycase, that's not so good news as it makes supporting this much more complicated as there is not much UPnP related code outside the group handling in this library, and there hasn't really been that much interest in contributing to UPnP implementation (see #23). |
I did dig a bit deeper. Input is indeed controlled via UPnP. There is an Input element in the content directory that list the different input together with special uri
That url is then used in the SetAVTransportURI
Yeah, sound plausible. The UPnP way feels hackish, I guess more likely to moved to songpal from UPnP instead the other way around Is adding UPnP support even in the scope of this project? I can invest some time to get the input selection to work, but feels like adding it here is the wrong place |
I did wonder if I’m having an old firmware version, but the device is using version M21.R.0182 which seems to be newest version, it is from 03-19-2019 |
I have working UPnP code that can control the volume and input (using the async_upnp_client). Now my question is how best to integrate that. My end goal is to have home assistant media player that can control the device. I see two options:
Approach 1) makes this project a bit more complex and would rather turn it into a sony audio devices controlling project. When controlling a BDV-N9200W via home assistant you would essentially not using any of songpal api and do everything via UPnP. @rytilahti Would be interested in your opinion on what the scope of this project should be and what options you see & prefer |
I think the question is can we detect when the UPnP should be used for controlling? Could you post the response for the
Considering that there is some support for the songpal api (e.g., sound settings & others you tested earlier), we want to have some support in this library for devices without the Wrt. refactoring, I have a local WIP branch to refactor the code base to be more service (
The aim of this project is to allow controlling all devices implementing the "ScalarWebAPI", that's why there is also an open issue for supporting televisions, so having this integrated wouldn't be an issue from my point of view :-) However, if your goal is to just have homeassistant support for your device, perhaps |
I could not find anything that would hint at using UPnP directly unfortunately. getServiceProtocols:
SCD (extract)
(full content can be found here: https://pastebin.com/h42vzREg) maybe a potential candidate is server headers (the 2.0 part maybe?):
Regarding dlna_dmr, yes, the integration works out of the box for most parts, but not the input selection, which is what I need :-) Now that the scope is clear, I can try to add support for UPnP is in this project. If you feel it would be good to base my work on your WIP refactor code base, feel free to share your code regardless of the WIP status |
The description file looks odd, as it doesn't even contain Here's the server header from my device:
so looks like that's not an usable choice. I think this leaves the lack of
I just created a PR, just in case you want to see what I had planned: #83 . It's based on awfully out-of-date master at the moment, but if you think you'd prefer to base your UPnP enhancements on top of it, I can try to do rebasing at some point. Either way, I think the UPnP controls will live in a separate implementation file (much like the group controls), so it doesn't really matter on which you would base the changes. Btw, could you check out what methods your |
Btw: did find https://forum.developer.sony.com/topic/131/bdv-n9200w-no-volume, that hints at your theory @rytilahti that the device is using very early songpal api implementation
|
Ah, that makes sense, forgot about that...
Ah, that explains a bit. So, the UPnP access could then be used as a fallback for those older devices (and there may also be some cases where UPnP could be useful for newer implementations, too: #5 and #23). re: illumination, what settings are being offered if you call |
Hi all. Could you tell me if this is a compatibility problem? Home assistant discovers the computer but the media player object does not appear. If I use it from the command line I have this error. C:\Users\Milena>songpal -dd --endpoint http://192.168.0.49:10000/sony dump-devinfo Unable to get supported methods: Got an error for getSupportedApiInfo: NoSuchMethod (12): getSupportedApiInfo |
It looks like you have a older device which currently isn't supported by python-songpal.
afaik this means python-songpal cant receive all the needed information from your device the regular way. there might be other ways (see above posts) but those aren't implemented yet |
Hi, I have a sony BDV-N9200W home theater. It turns on but no setup menu appears on the screen and I can't open the blue ray disc cover either. It won't let me change the function with the remote or anything, I've tried pressing play and eject for a few seconds and it doesn't do anything except a small clack but I still can't access to update firmware or anything. Can anybody help me? |
Hi,
For the past few days, i'm trying to get your project to control my Sony BDV-N5200. But somehow, i can't get it to work. Installation on my Raspberry Pi and discovering the endpoint was all straightforward, but actually trying to control my device got me stuck on an error message i can't figure out:
Whichever command i try, i get the same error message. Any help or a guide in the right direction is highly appreciated!
The text was updated successfully, but these errors were encountered: