Closed royf007 closed 5 months ago
Hi @royf007,
Okay, then lets try to do this step by step. are
samsung_soundbar or Living Room Soundbar
The name of the first, second or third entries?
And was one of those Soundbars completely cut off from the powersource?
Hi @samuelspagl , so I confirmed that the Living Room soundbar is powered on and useable in SmartThings. What I just tried was deleting the integration and all associated entities, then re-installing the integration, and just trying to add the Living Room soundbar by itself. I'm still getting the same error:
Please let me know if there are any additional debugging steps you would like me do.
Hi @samuelspagl , so I did some more troubleshooting, and here is what I found:
In /config/custom_components/samsung_soundbar/api_extension/SoundbarDevice.py, the function at line 385 is used for status:
async def get_execute_status(self):
url = f"https://api.smartthings.com/v1/devices/{self._device_id}/components/main/capabilities/execute/status"
request_headers = {"Authorization": "Bearer " + self._api_key}
resp = await self.__session.get(url, headers=request_headers)
dict = await resp.json()
return dict["data"]["value"]["payload"]
For the other 2 Samsung Q990C soundbars that I have (Master Bedroom and Gym, the API call to the SmartThings API returns data. For the Living Room soundbar, the calls succeeds but it returns no data. This is where the setup for the Living Room soundbar is failing during setup in the HA Samsung Soundbar integration.
For the 2 working soundbars, the call to: https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/capabilities/execute/status returns the following:
For the Living Room soundbar, for the same call, the following is returned:
{
"data": {
"value": null
}
}
Question:
Can the code be modified to ignore the empty response, so that the soundbar setup can complete correctly? The Living Room soundbar is working perfectly and as I mentioned before, no issues in Home Assistant with the SmartThings integration.
Also, in the SmartThings API, there is an alternate method for status that I've used successfully for all 3 soundbars: https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/status
Nice, thanks for all of the information.
This would correspond with another issue, because in the end, I would probably make the config adjustable in a way that it possible to disable certain features like the EQ.
But I dunno how fast I can get it to work. I would hope to work on it tomorrow or on saturday a bit, but I also have other things on the ToDo list.
You're welcome. Really, it's no rush. I appreciate your quick response and all the work you've put into this integration!
Was it possible for you to retrieve the same data with:
https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/status
As with the other status call currently used?
For the https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/status
call, it returns a ton of information...practically everything.
The call that the integration is currently using returns a minimal amount of "supported" network audio supported modes, but these soundbars don't even have these sound program settings in the SmartThings app, so I would say the current https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/capabilities/execute/status
adds no additional value. For example, it returns ONLY:
{
"data": {
"value": {
"payload": {
"rt": [
"x.com.samsung.networkaudio.eq"
],
"if": [
"oic.if.rw",
"oic.if.baseline"
],
"x.com.samsung.networkaudio.supportedList": [
"NONE",
"POP",
"JAZZ",
"CLASSIC"
],
"x.com.samsung.networkaudio.EQname": "NONE",
"x.com.samsung.networkaudio.action": "setEQmode",
"x.com.samsung.networkaudio.EQband": [
"0",
"0",
"0",
"0",
"0",
"0",
"0"
]
}
},
"data": {
"href": "/sec/networkaudio/eq"
},
"timestamp": "2024-03-26T09:15:00.030Z"
}
}
and nothing can be done with these settings anyway.
Interesting because a call against
https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/status
returns a status_code 200
without any data for me. (Of course I used my own device-id ^^)
Can you show me what exactly this url is returning?
About the data of for example the eq in this case and the https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/capabilities/execute/status
api-call.
This is currently to my knowledge the only way I can retrieve the information of Soundmodes
, Subwoofer
, EQ
, and the switches (Nightmode etc.).
I'm still trying to figure my way in the SmartThings API because many things are a bit "not" straight-forward. Like for example retrieving the information of the Soundmode:
I need to first hit the https://api.smartthings.com/v1/devices/{deviceId}/commands
endpoint with a certain body:
If I understood it correctly (and those are just assumptions) then as this call does not return any useful information, it retrieves the in the argument
selected information from the soundbar and adds it to the status.
I do this "dance" for all of the above mentioned "extra" capabilities.
Changing the properties of one of those also uses the https://api.smartthings.com/v1/devices/{deviceId}/commands
endpoint with a slightly different body.
I did not find a way to retrieve the information of Soundmodes
, Subwoofer
, EQ
, and the switches (Nightmode etc.) all at once.
Is https://api.smartthings.com/v1/devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/components/main/status
retrieving all of those "extra" information for you?
Btw. I would edit some of your comments and hide the bigger code parts in a
Thanks for the tip on using the details markdown tag. So, the response that I'm getting from the call:
I've been combing through the SmartThings API, and there was another method which seems similar: https://api.smartthings.com/v1/devices/{deviceId}/status
.
It looks like for my Living Room soundbar, the following section is missing from the response (which I presume is what you are trying to get from your call for the extra capabilites):
I'm just puzzled because the 3 soundbars are identical, on the same firmware version. I've even removed the Living Room soundbar from SmartThings, and added it back. So at this point, I'm still not sure how to get the subwoofer, night mode, and other enhanced settings from this 1 soundbar.
Okay can you try one thing for me:
First again make your https://api.smartthings.com/v1/devices/{deviceId}/components/main/status
Then a call against
https://api.smartthings.com/v1/devices/{deviceId}/commands
with the following body
{
"commands": [
{
"component": "main",
"capability": execute,
"command": execture,
"arguments": ["/sec/networkaudio/eq"]
}
]
}
Then retrigger your https://api.smartthings.com/v1/devices/{deviceId}/components/main/status
In the response body under execute.data.value
should now hopefully be the eq section listed. (this section should be empty before, as it is in your upper response body)
And then can you call this endpoint https://api.smartthings.com/v1/devices/{deviceId}/components/main/capabilities/execute/status
It should be exactly the same as the execute
section.
Ok, please see the results from my testing below:
So, it appears that the execute
section is not being populated correctly:
"execute": {
"data": {
"value": null
}
And similarly, with the last call:
"execute": {
"data": {
"value": null
}
So, I'm now beginning to suspect that my soundbar itself is messed up. And maybe not a hardware issue, per se, but software / firmware (which cannot be re-flashed). This is based on the following facts:
I'm going to try something drastic. I'm still in my return period for this soundbar. I'm going to re-purchase an identical unit and see what happens.
What do you think?
Hmmn difficult question. I would first of all try, the same set of requests with another soundbar of yours which should (stated on the theory and on the proof that the other ones work quite fine) give different results.
If thats true then I would probably return it π
Dumb question, can you change the eq and "extra capabilites" from the smart things app in the failing soundbar?
So I tried the same set of API requests on the other 2 soundbars, and the EQ settings are returned correctly in the responses.
Also, in the SmartThings app, I can change the "eq" and "extra capability" settings for all 3 soundbars (including the failing one). Another observation is that the API response returns some sound programs, i.e. "NONE", "POP", "JAZZ", "CLASSIC", but there is no way to set these in the SmartThings app on these soundbars.
I will let you know what happens with the new soundbar! π
sound programs, i.e. "NONE", "POP", "JAZZ", "CLASSIC",
these are eq presets that you can set when your soundmode is set in Standard I think ;)
Interesting. So, I finally found the eq preset options in the SmartThings app, but the API calls we are currently using don't show the current eq preset, and then setting the preset it in the Samsung Soundbar integration has no effect (not changing in the SmartThings app).
Not a big deal, as I'm sure there may be some other API calls / commands get and set the current eq preset.
funny, I think it worked for me tho, when I implemented, but yeah, I also am not really using this feature :D The other things like, bassmode, nightmode etc. are more important ^^
Yeah the SmartThings API in itself is interesting, and also not that clear most of the time (from my point of view)
So, you're not going to believe this. I just installed a brand-new Q990C and it behaves the same way as the previous Living Room soundbar, i.e. no eq info returned from the API.
It makes me think that Samsung may have changed the behavior of their API, and new device registrations may start to behave the same way. I don't really feel like resetting the other 2 working soundbars to test this theory.
I'll be curious if anyone else reports this issue going forward. So, that being said, can the code be update to "ignore" the empty payload from the eq settings, so other functions can be used?
Interesting π .
I'd really love to fiddle around with your soundbars because it is incredibly fascinating.
But that's another topic. Ehmn yeah so the solution for another open issue is to reimplement the configuration process of the soundbar in a way where you can select the specific extra capabilities your soundbar supports and the integration adjusts itself based on that.
Hi, just made an account to also confirm this annoying issue, I've done the same steps as @royf007 I have a Q950A Samsung, previously it did slightly work for EQ but I had an overlap of integrations, I am now only able to get Source and Volume and the other non needed info, previously I had access to EQ and Sound Mode, I also do not get the status of advanced features either but I can send for example a command for it, I've done at least 3 resets even deleted the SmartThings app, I've tried to do an firmware upgrade using an USB in the hope it would reset the soundbar but it won't do that unless it's an actual update, I've also tried to remove my device profile since according to Samsung OCF devices have the "API Commands stored locally" the only thing I could try is to add a "capability" but I am not really familiar with the exact payload I should use, quite annoying I must say.
Please do note that before I've engaged into this "experimental" adventure my soundbar just simply stopped returned status for sound mode and advanced features and I thought it's just a SmartThings moment but it wasn't, so from this I can either assume Samsung did a Smart Opsie and messed up the OCF profile or me and @royf007 clearly we have no idea what we're doing, the only option I see here is to add an capability.
So @royf007 and @Coinficient, I can confirm the behaviour...
And honestly it drives me crazy because the obvious issue is that Samsung changed some things in the SmartThings API seemingly quite recently.
Can you both please write the more or less exact dates when it you setup your first devices?
Therefore I am honestly currently not quite sure how to tackle this.
So interestingly, once the integration is setup and populated with a set of for example "Sound Modes" I can still change Soundmodes with the integration. The "only" thing that failes is the update process of these "extra capabilities". And thats the main issue there.
I took a look at the official Changelog, but am not seeing anything that would explain why it is broken.
https://developer.smartthings.com/docs/getting-started/release-notes
@samuelspagl That's interesting, well upon some "long shot" inspection I can't 100% confirm my issue started on 26th but it was around that time, but it seems that the case is confirmed how a potential corruption could've happened, the soundbar does connect to an EC2 server, on the same date AWS had an small outage as you can see here, man that's like the stars aligned to mess up the soundbar π
@samuelspagl , I installed the new soundbar on on 3/25/2024, and probably tried to setup the integration on the same day or the next day. It's unfortunate that Samsung changed their API. I haven't found a way yet through the API to get to the extra capabilities, i.e. subwoofer volume, etc.
@samuelspagl I can't give you an exact date when I setup my soundbar but I think it was a year ago, so I've had my soundbar for some time now, on Home Assistant, but I can confirm to you that Woofer, EQ, Sound Mode and all of that we're working it was just a clash of integrations (or so I thought) because I was not getting the exact status but I was able to send commands, including the Woofer which I previously could not because only your integration offers that.
@samuelspagl , also the other 2 soundbars that are working were setup sometime in December 2023, and then in Home Assistant around February, 2024.
We might have to try to add a capability over the API because in the documentation we can do that, I just don't know what payload to use or how the capability looks in the JSON format to add it, because I don't think even Samsung themsevls can help here since OCF devices are a bit different they are like a hybrid.
But what is interestingly enough is that @royf007 has the 3rd soundbar "corrupted" profile device in the same manner as I do, including the inability to see the sound mode which I can confirm 100% that I was using this daily before, until one day around March 26th tha I stopped receiving the status for it, this was before I setup your integration, I thought the previous integration since it stopped recveing updates somehow "something happened"
I've noticed another user in another open issue I bet has the same problem as us, this is some Smart fishy going on here and I think that AWS API outage had to do something with it, but I can't support this theory without more information.
@royf007 if you do not mind, would you share some screenshots from my.smarrthings.com/advanced especially on the "execute" capability so I can at least see what we should've seen there? and what other potential info we might not see? here's how mine looks
https://my.smartthings.com/advanced/
Sure @Coinficient. Interesting, on the Living Room soundbar, the "execute" capability is empty, like yours.
The other interesting observation is that the way Samsung names the soundbars has changed. For the new Living Room soundbar (the one with missing capabilities, the "device name" and "device label" is what I named it. For the other 2 that are working, the "device name" is "Q-Series Soundbar". I don't think it has anything to do with the missing "extra capabilities", but does indicate some changes on the Samsung side.
Let me know if you need anything else.
@samuelspagl That's interesting, well upon some "long shot" inspection I can't 100% confirm my issue started on 26th but it was around that time, but it seems that the case is confirmed how a potential corruption could've happened, the soundbar does connect to an EC2 server, on the same date AWS had an small outage as you can see here, man that's like the stars aligned to mess up the soundbar π
Hmn interesting.
Sure @Coinficient. Interesting, on the Living Room soundbar, the "execute" capability is empty, like yours.
Mine isn't and also doesn't change at all. It still displays the eq settings from when it was set to display it there. I see that your first Soundbar is also displaying the eq
We might have to try to add a capability over the API because in the documentation we can do that, I just don't know what payload to use or how the capability looks in the JSON format to add it, because I don't think even Samsung themsevls can help here since OCF devices are a bit different they are like a hybrid.
If you want to see how the extra capabilities look like, then you can take a look at my documentation website. https://ha-samsung-soundbar.vercel.app/smartthings-api/extra_information
I also just opened an entry in the SmartThings forum. Not sure if anyone will read this, but still I kinda have to try π .
https://community.smartthings.com/t/bug-retrieve-custom-capabilities-files/280486
Edit: Also created a support request on their samsung developers site.
@royf007 That small name indication is very good observation, for example I have cleared my smartthings app, deleted my soundbar from it, when I open the smartthings app without logging in, it shows up my soundbar to connect it, the name I previously used as if the settings are saved on the soundbar as I thought it would, that means there's something corrupted on the OCF profile and I am not sure if it's related to my samsung account or not, I will try to create a new samsung account and connect my soundbar.
PS Another interesting observation I've noticed is that on my Samsung account it shows up "My TV" is connected not my soundbar I think on samsung servers my soundbar is being seen as a TV another indication of a potential corruption.
https://v3.account.samsung.com/dashboard/devices
Prolly this is the chip board the soundbar uses, unrelated but I will keep looking
So I can probably say the not exact but pretty exact time that it stopped working for me π This is from my online SmartThings Dashboard:
And I took a look at the screenshots of @royf007:
Both stopped working on the 26th π nice. Basically, the "update" process of the execute API could not write the result of its query in its status ever since π
In which timezone are you?
I'm in UK time zone, I wish I actually took a look at that but I kept deleting and adding I thought it was just another SmartThings issue never really did bother to look it up to this extent, but it looks like the theory is almost confirmed
I am curious, can any of you connect your soundbar to Alexa? Not that I use it but I did use it previously on Home Assistant to make TTS Announcements easier without the use of an external device, now when I try to login I just don't get anything.
I'm in UK time zone, I wish I actually took a look at that but I kept deleting and adding I thought it was just another SmartThings issue never really did bother to look it up to this extent, but it looks like the theory is almost confirmed
Did you completely remove it from your SmartThings Account? If you just removed it from HomeAssistant it should still be visible.
I am curious, can any of you connect your soundbar to Alexa? Not that I use it but I did use it previously on Home Assistant to make TTS Announcements easier without the use of an external device, now when I try to login I just don't get anything.
Nope π sorry. I'd love to get TTS also working in this integration at some point ^^
I've done full sweep, API Tokens, SmartThings, HA, my phone, so yeah if there was a trace it's gone, now 10 mins ago I even "deleted" my SmartThings account or data not sure to what extent Samsung does, but one thing is clear SmartThings consistently has the exact same capabilities as before but the API doesn't, I did a PCAP to see where the app connects and it's a mix of AWS, API and Samsung cloud connect. Domains such as these
ocfconnect-shard-eu02-euwest1.samsungiotcloud.com client.smartthings.com api.smartthings.com
but interestingly enough when I try to login to Amazon Alexa I get errors on api.smartthings.com which indicates that this is Samsung being sneaky, the OCF profile I believe is meant to slow down these issues as if, something doesn't work on the server right now you won't "feel" it right away it will be gradual, but I think someone really "fixed" the API too much π
While I cannot decrypt the payloads it's most likely to a CA certificate I am not sure as it doesn't really let me decrypt them.
As for the Soundbar it directly connects and only stays connected to AWS
ec2-52-210-126-103.eu-west-1.compute.amazonaws.com
I had some time this evening and created a new configuration setup and reconfigure steps, to enable / disable the custom capabilities. Pull Request: #28
https://github.com/samuelspagl/ha_samsung_soundbar/releases/tag/0.4.0b1
This is very raw and needs to be refactored quite a bit, but it should work.
I'm in UK time zone, I wish I actually took a look at that but I kept deleting and adding I thought it was just another SmartThings issue never really did bother to look it up to this extent, but it looks like the theory is almost confirmed
Did you completely remove it from your SmartThings Account? If you just removed it from HomeAssistant it should still be visible.
I am curious, can any of you connect your soundbar to Alexa? Not that I use it but I did use it previously on Home Assistant to make TTS Announcements easier without the use of an external device, now when I try to login I just don't get anything.
Nope π sorry. I'd love to get TTS also working in this integration at some point ^^
@samuelspagl , thanks for documenting the extra capabilities API commands on your site, and also for opening the issue on the SmartThings forum.
For Alexa, I've had no issues with getting Alexa to work when removing / adding back the soundbars (even with this current API issue). After setting up the soundbar in SmartThings, I usually have to delete the previous device in Alexa (even if it has the same name as the recently added one), and then in the SmartThings app, go into the soundbar and set it up again in the "Voice Assistant Settings", then do an "Alexa, discover devices" (if necessary).
So regarding TTS, it currently doesn't work from Home Assistant on these soundbars, since they use AirPlay 2, and the current Apple TV integration has a bug. With the Home Assistant Apple TV integration, the soundbar needs to be on the same network as Home Assistant, and then it shows as an Apple TV media player. When you go to do TTS from Home Assistant, it will appear as if the TTS is playing (via AirPlay on the soundbar), but no actual sound comes out. Please see: https://github.com/postlund/pyatv/issues/2351 . I'm waiting for this issue to be resolved.
In the meantime, for TTS from Home Assistant on the Samsung Soundbars, I'm currently using an external device, the WiiM Mini (https://a.co/d/3vjDAxQ) connected to the soundbar via the digital optical input (SPDIF). The catch with the Samsung soundbars is that if you have a TV connected to the HDMI1 (eArc) port, then you cannot select the DIN (optical input) on the soundbar, as the soundbar automatically switches back to HDMI1. My workaround (via an automation, is to turn off the TV prior to announcements, switch the input to DIN on the soundbar, set the volume as needed, make the announcement, and then restore the volume, and turn on the TV (if it was previously on). It's a royal pain. Two of my soundbars do not have a TV connected to them, so I'm using them for pure music, and leave the input setting on DIN (optical).
When the AirPlay issue gets resolved, we should be able to use TTS from the Apple TV integration to do TTS announcements.
Looking forward to your code updates!
I had some time this evening and created a new configuration setup and reconfigure steps, to enable / disable the custom capabilities.
Pull Request: #28
https://github.com/samuelspagl/ha_samsung_soundbar/releases/tag/0.4.0b1
This is very raw and needs to be refactored quite a bit, but it should work.
@samuelspagl I tried your new alpha release and I was able to add the Living Room soundbar minus the EQ configuration.
Thank you!
I had some time this evening and created a new configuration setup and reconfigure steps, to enable / disable the custom capabilities. Pull Request: #28 https://github.com/samuelspagl/ha_samsung_soundbar/releases/tag/0.4.0b1 This is very raw and needs to be refactored quite a bit, but it should work.
@samuelspagl I tried your new alpha release and I was able to add the Living Room soundbar minus the EQ configuration.
Thank you!
But is the "soundmode" select entity showing anything? I think it should also be empty and trigger some errors.
So while this this issue is unresolved I thought about creating services for each of those "custom capabilities", because changing the value is still possible, but retrieving it isn't. Therefore I'm thinking about adding some more settings to the reconfiguration part, that lets you enable / disable a service for a custom capability despite the entities (and therefore the update process) being disabled.
following up on issue #27 I was able to add my Q800A, but without enabling 'Advanced Audio Switches', 'EQ Selector' and 'Soundmode sector'... Unfortunately, I use mostly the Soundmode selector and Advanced Audio Switches in my automations. I hope you will find a solution soon!
I use mostly the Soundmode selector and Advanced Audio Switches in my automations.
The same goes for me. If I have some free time in the evening, I would create a workaround for these. The workaround would be either:
What would you prefer? I think the second option is a bit cleaner, even tho it will still leave broken automations.
I do not plan to remove any of the current functionality, but still hope that Samsung will sort these things out.
@samuelspagl Just do add some more info, commands for advanced capabilities and sound mode do work, but you cannot get the status for them at least for now, I am not quite sure how best you can tackle this issue as I am not sure how many are affected by this issue, for now it seems isolated although there may be others like me who don't actively engage in github.
Just do add some more info, commands for advanced capabilities and sound mode do work, but you cannot get the status for them at least for now,
Yeah I know thats what I was already stating being the current state with my Soundbar. Thanks for confirming it.
I am currently waiting for Samsungs reply (hopefully they do reply), and will try to implement services for the integration the next days.
@samuelspagl Sorry I must've word skipped π, you can also add the Woofer commands as well, they do work too and I was quite surprised how you managed to get it working, but that is the same no states, as for the EQ I didnt' get a chance to properly test them but I reckon they might be on the same case, quite a shame SmartThings didn't reply yet.
Keep up the good work, you're doing justice to our soundbars π
Hi @royf007,
If it would be fine with you, I would adjust your ticket description a bit, so that new users can read the details of the current issue without reading the whole thread. :)
So, I have been using this great integration with no issues on 2 Samsung Q990C soundbars for a few weeks.
I recently bought a 3rd Q990C. It's on the same network, same firmware version as the other 2. I'm able to use the Yamaha MusicCast API (api.smartthings.com) through Postman, obtain the device ID, send commands, etc. I'm also able to see it in the SmartThings integration in Home Assistant.
When I go to try to add the 3rd soundbar to this integration as a new "hub", it always fails to configure. I've even tried to remove and add back the other 2 soundbars that were previously working, and there are no issues adding them back.
I'm not really sure why I can't add this 3rd soundbar.
Any help would be appreciated. Here is the log entry:
Log Entry
``` Logger: homeassistant.config_entries Source: config_entries.py:504 First occurred: 12:13:07 AM (4 occurrences) Last logged: 12:15:29 AM Error setting up entry samsung_soundbar for samsung_soundbar Error setting up entry Living Room Soundbar for samsung_soundbar Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/samsung_soundbar/__init__.py", line 52, in async_setup_entry await soundbar_device.update() File "/config/custom_components/samsung_soundbar/api_extension/SoundbarDevice.py", line 52, in update await self._update_soundmode() File "/config/custom_components/samsung_soundbar/api_extension/SoundbarDevice.py", line 74, in _update_soundmode payload = await self.get_execute_status() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/samsung_soundbar/api_extension/SoundbarDevice.py", line 390, in get_execute_status return dict["data"]["value"]["payload"] ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ TypeError: 'NoneType' object is not subscriptable ```