jaruba / ha-samsungtv-tizen

📺 HomeAssistant - For Samsung TVs 2016+, Includes SmartThings API and Channel List Support
Apache License 2.0
288 stars 64 forks source link

Unable to open app through HA #82

Open josiamichael opened 4 years ago

josiamichael commented 4 years ago

Hi there,

I recently discovered this custom component for HA and I installed it through HACS to control my samsung TU8500 since I'm making automation to open Netfix on my TV automatically. The problem I encountered is whenever I changed my source through HA to an app (YouTube, Netflix or Spotify) it won't change to that app but if I change the source to HDMI1 (ST_HDMI1), HDMI3 (ST_HDMI3) or TV it will work.

As a side note I have followed the instructions to enable smartthings api and I have configured the configuration.yaml accordingl and also all apps have been configured manually through app_list just as instructed in the guide.

If there anything I should attach let me know.

Thanks in advance

jaruba commented 4 years ago

Are you setting both the numerical ID and alphanumerical ID for each app? (example: 11101200001/org.tizen.netflix-app)

If so, you could try the possible fix from this issue: https://github.com/jaruba/ha-samsungtv-tizen/issues/77

bbrendon commented 4 years ago

I'm having the same issue. I can open TV apps using the SmartThings app on my phone but not from HASS.

Things I tried...

jaruba commented 3 years ago

@bbrendon @josiamichael

I received another complaint about this from someone with a 2020 TV, in order to solve this we need to somehow find the common link between the people that complain about it. (as there are very few that complained about it)

So my question is, are both your TVs fabricated in 2020 also?

jaruba commented 3 years ago

Also, please mention the Tizen version your TVs are using.

bbrendon commented 3 years ago

I just purchased my TV a few weeks ago. How about people post the output of

curl -s http://10.5.0.81:8001/api/v2/ | jq .|grep -viE '(mac|uuid)'

Does that include everything? I deleted the UUIDs. No idea what they are or if they can ID me somehow.

https://pastebin.com/jQsBRMLc

bbrendon commented 3 years ago

Oh, I'm currently using the other integration though it seems like development of it is going to stop? I got it working finally. I'm not sure if that would have solved it with this one. I'll probably at some point switch back to this one, but for now "If it ain't broke, dont fix it" :)

my possible solution : https://github.com/ollo69/ha-samsungtv-smart/issues/27#issuecomment-728647880

jaruba commented 3 years ago

@bbrendon We're trying to merge the changes of that fork into samsungtv-tizen, it's good to know what worked for u, but I doubt that there's something specific to that integration that made it work. (because the SmartThings integration from it is pretty much unchanged)

aribasadme commented 3 years ago

Hi, I tried what @bbrendon did in his solution (remove everything from Device Connect Manager and then restart smart things on the phone and restart HASS). When I change the input of the TV to any of the apps, on the TV screen I see a message that asks me to connect to an external device but even if I accept it doesn't change to the app I'm trying to set.

My TV: mnmo: QE50Q60TAUXZT mnmn: Samsung Electronics mnos: Tizen mnpv: 5.5 st: 2020-11-23T10:32:21Z

JeffSteinbok commented 3 years ago

I have two Samsung TVs - one I can run Apps via HA, and one I can't: This one does NOT work: QN49Q7DRAFXZA This one DOES work: QN65Q65F - It's a year older

Anything else I can do to provide more info?

alexisteleco commented 3 years ago

Same problem here. Also tried to reset Smarthings and even changed API key, with no luck.

Here the response to curl -s "http://172.16.0.39:8001/api/v2/"

{
  "device": {
    "FrameTVSupport": "false",
    "GamePadSupport": "true",
    "ImeSyncedSupport": "true",
    "Language": "es_ES",
    "OS": "Tizen",
    "PowerState": "on",
    "TokenAuthSupport": "true",
    "VoiceSupport": "false",
    "WallScreenRatio": "0",
    "WallService": "false",
    "countryCode": "ES",
    "description": "Samsung DTV RCR",
    "developerIP": "0.0.0.0",
    "developerMode": "0",
    "duid": "*****",
    "firmwareVersion": "Unknown",
    "id": "*******",
    "ip": "172.16.0.39",
    "model": "20_KANTSU2_UHD_BASIC",
    "modelName": "UE50TU7072UXXH",
    "name": "[TV] Tele",
    "networkType": "wireless",
    "resolution": "3840x2160",
    "smartHubAgreement": "true",
    "ssid": "*****",
    "type": "Samsung SmartTV",
    "udn": "******",
    "wifiMac": "*******"
  },
  "id": "*******",
  "isSupport": {
    "DMP_DRM_PLAYREADY": "false",
    "DMP_DRM_WIDEVINE": "false",
    "DMP_available": "true",
    "EDEN_available": "true",
    "FrameTVSupport": "false",
    "ImeSyncedSupport": "true",
    "TokenAuthSupport": "true",
    "remote_available": "true",
    "remote_fourDirections": "true",
    "remote_touchPad": "true",
    "remote_voiceControl": "false"
  },
  "name": "[TV] Tele",
  "remote": "1.0",
  "type": "Samsung SmartTV",
  "uri": "http://172.16.0.39:8001/api/v2/",
  "version": "2.0.25"
}

EDIT: Just for completeness, I want to point out that running this command in some laptop/server in the same network starts the app as desired:

curl -XPOST "http://172.16.0.39:8080/ws/app/Netflix" -H "Content-Length: 0"

On the other hand, if you use GET method, the status is shown.

Maybe this can be added to the functionality as a second option.

EDIT 2: I was trying other ways to connect HomeKit with Samsung TV and found this plugin for homebridge, and it states that in newer models (>2020) the codes for the apps have changed.

I tried the new code for Netflix and it is working like a charm in the homebridge plugin, however, it is not working in home assistant.

rowysock commented 3 years ago

I'm also unable to change the apps from HA on qe65q77tat. I've used the Tizen Studio method from https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications to extract the application list.

I've observed that this request changes the app to Spotify as desired: http://192.168.0.150:8001/api/v2/applications/3201606009684/

So I replaced this line: https://github.com/jaruba/ha-samsungtv-tizen/blob/a49e349e59b87d875eb7f8a2ec95f442991a7c5c/custom_components/samsungtv_tizen/media_player.py#L515 with requests.post('http://192.168.0.150:8001/api/v2/applications/{value}'.format(value=payload), timeout=0.5) and to my surprise, it's working!

I don't know the difference between those two APIs and I'm afraid of making a PR with mentioned replacement because It may break integration for someone else, but it may be some hint for the @jaruba

funkyfisch commented 3 years ago

@rowysock @alexisteleco I guess we can create an optional parameter defined in configuration.yml to select app invocation method, and based on that we either use the current implementation or your alternative. Both can be defined inside a "run_app" method that chooses between http requests and websockets

One drawback of doing it purely replacing the line with the requests command is that it takes time to refresh the state of the "media_player" entity to the app that is actually running right now

freenetwork commented 3 years ago

https://pastebin.com/zU5APiT3 i have this problem too

freenetwork commented 3 years ago

I'm also unable to change the apps from HA on qe65q77tat. I've used the Tizen Studio method from https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications to extract the application list.

I've observed that this request changes the app to Spotify as desired: http://192.168.0.150:8001/api/v2/applications/3201606009684/

So I replaced this line: https://github.com/jaruba/ha-samsungtv-tizen/blob/a49e349e59b87d875eb7f8a2ec95f442991a7c5c/custom_components/samsungtv_tizen/media_player.py#L515

with requests.post('http://192.168.0.150:8001/api/v2/applications/{value}'.format(value=payload), timeout=0.5) and to my surprise, it's working! I don't know the difference between those two APIs and I'm afraid of making a PR with mentioned replacement because It may break integration for someone else, but it may be some hint for the @jaruba

This working for me. i'm take fork. And add config variable for year tv

aribasadme commented 3 years ago

I'm also unable to change the apps from HA on qe65q77tat. I've used the Tizen Studio method from https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications to extract the application list.

I've observed that this request changes the app to Spotify as desired: http://192.168.0.150:8001/api/v2/applications/3201606009684/

So I replaced this line: https://github.com/jaruba/ha-samsungtv-tizen/blob/a49e349e59b87d875eb7f8a2ec95f442991a7c5c/custom_components/samsungtv_tizen/media_player.py#L515

with requests.post('http://192.168.0.150:8001/api/v2/applications/{value}'.format(value=payload), timeout=0.5) and to my surprise, it's working! I don't know the difference between those two APIs and I'm afraid of making a PR with mentioned replacement because It may break integration for someone else, but it may be some hint for the @jaruba

That worked for me also! I have a 2020 model, it's a 50 inch Q60T. First I tried just replacing the values of app IDs for my TV (they correspond to those of the list in the GitHub link) but it didn't work still. Then I made the change on the code of media_player.py and it finally worked!

Thank you so much for the suggestion!

EDIT: I have noticed that the port you used is 8001 but the default port in the code is set to 8002. Does this influence the behavior of the app?

stan69b commented 3 years ago

Hi, you may find a workaround in this issue https://github.com/jaruba/ha-samsungtv-tizen/issues/124

Hop it helps in the meantime

Cyril0000 commented 2 years ago

Hi, I am currently facing kind of the same problem. My TV is from 2020, and I am not using smart things. When I add Netflix to the config with the numerical and the alphanumerical number, I can see it in the drop list but when I click on it, my TV just ask me if I accept to link, and then nothing happen. It's been a week now and I am out of any idea. Other app doesn't work as well. Any help would be appreciated and maybe help other people to sort it out !

stan69b commented 2 years ago

I use the rest commands and it works like a charm Just change the ip

*add to configuration.yaml Then call in a script


rest_command:
  netflix:
    url: "http://192.168.0.X:8001/api/v2/applications/3201907018807"
    method: post
    content_type: "application/x-www-form-urlencoded"
  prime_video:
    url: "http://192.168.0.X:8001/api/v2/applications/3201910019365"
    method: post
    content_type: "application/x-www-form-urlencoded"
  youtube:
    url: "http://192.168.0.X:8001/api/v2/applications/111299001912"
    method: post
    content_type: "application/x-www-form-urlencoded"
  spotify:
    url: "http://192.168.0.X:8001/api/v2/applications/3201606009684"
    method: post
    content_type: "application/x-www-form-urlencoded"
  steam_link:
    url: "http://192.168.0.X:8001/api/v2/applications/3201702011851"
    method: post
    content_type: "application/x-www-form-urlencoded"
Cyril0000 commented 2 years ago

OK your solution is working and is really simple ! For people that have the same issue I just add exactly the code shown above in my config.yaml and then created a script that call the service RESTful. Thank you stan69b !

wasif-2000 commented 1 year ago

I'm also unable to change the apps from HA on qe65q77tat. I've used the Tizen Studio method from https://github.com/tavicu/homebridge-samsung-tizen/wiki/Applications to extract the application list. I've observed that this request changes the app to Spotify as desired: http://192.168.0.150:8001/api/v2/applications/3201606009684/ So I replaced this line: https://github.com/jaruba/ha-samsungtv-tizen/blob/a49e349e59b87d875eb7f8a2ec95f442991a7c5c/custom_components/samsungtv_tizen/media_player.py#L515

with requests.post('http://192.168.0.150:8001/api/v2/applications/{value}'.format(value=payload), timeout=0.5) and to my surprise, it's working! I don't know the difference between those two APIs and I'm afraid of making a PR with mentioned replacement because It may break integration for someone else, but it may be some hint for the @jaruba

This working for me. i'm take fork. And add config variable for year tv

I had multiple TVs so I changed it to

requests.post('http://'+self._host+':8001/api/v2/applications/{value}'.format(value=payload), timeout=0.5)

it changes the channels from HA now but fails to switch on TV. will update if it gets resloved.