Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Great Project. U8G partially works. #19

Closed
mannyman opened this issue Mar 9, 2022 · 10 comments
Closed

Great Project. U8G partially works. #19

mannyman opened this issue Mar 9, 2022 · 10 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@mannyman
Copy link
Contributor

mannyman commented Mar 9, 2022

U8G
AndroidTV
Python 3.7-64 / 3.9-64
hisensetv-0.2.0.tar.gz

[--key {,exit,ok,volume_up,volume_down,channel_up,channel_down,fast_forward,rewind,stop,play,pause,mute,home,subtitle,,0,1,2,3,4,5,6,7,8,9,source_1,source_2,source_3,source_4,source_5,source_6,source_7}]

Steps to Reproduce

The following does not work , (the TV stays on the home screen):
--key netflix
--key youtube
--key amazon

Other commands such as power, back, etc. work fine

PS C:\WINDOWS\system32> hisensetv 192.168.86.98 --key youtube
[2022-03-08 12:11:27,082] [INFO ] sending keypress: youtube <--- Does nothing

PS C:\WINDOWS\system32> hisensetv 192.168.86.98 --key back
[2022-03-08 11:50:26,050] [INFO ] sending keypress: back <--- Works as expected

@newAM newAM added the bug Something isn't working label Mar 10, 2022
@newAM
Copy link
Owner

newAM commented Mar 10, 2022

Yikes. I am not sure what steps to take with debugging this. This is probably something going wrong in the TV, and that's pretty much a black box.

@mannyman
Copy link
Contributor Author

mannyman commented Mar 10, 2022 via email

@newAM
Copy link
Owner

newAM commented Mar 11, 2022

Opening apps uses launchapp mqtt message instead of sendkey.

Yup. That is the current behaviour:

@_check_connected
def send_key_netflix(self):
""" Sends a keypress of the Netflix key to the TV. """
self._launch_app("netflix")

def _launch_app(self, app: str):
"""
Sends a launch command to the TV, as if it had been pressed on the
"remoteNOW" app.
Args:
app: Name of the app to launch
"""
if app == "amazon":
launch = {"name": "Amazon", "urlType": 37, "storeType": 0, "url": "amazon"}
elif app == "netflix":
launch = {
"name": "Netflix",
"urlType": 37,
"storeType": 0,
"url": "netflix",
}
elif app == "youtube":
launch = {
"name": "YouTube",
"urlType": 37,
"storeType": 0,
"url": "youtube",
}
else:
raise ValueError(f"{app} is not a known app.")

Is that not what you expected?

@mannyman
Copy link
Contributor Author

the mqtt topic
/remoteapp/tv/remote_service/XX:XX:XX:XX:XX:XY$normal/actions/launchapp
with message
{
"name": "Netflix",
"urlType": 37,
"storeType": 0,
"url": "netflix",
}
Does not work for me in hisensetv nor testing it in MQTT Explorer

But, the following works in MQTT Explorer when I change message to:
/remoteapp/tv/remote_service/XX:XX:XX:XX:XX:XY$normal/actions/launchapp
{"appIcon":"","appId":"","has_detail_page":0,"isLocalApp":1,"name":"Netflix","storeType":0,"type":0,"url":"com.netflix.ninja","urlType":0}

When I use RemoteNow app on Note 10+ android phone and press the Netflix logo it also works:
MQTT Explorer shows:
launchapp = {"appIcon":"","appId":"","has_detail_page":0,"isLocalApp":1,"name":"Netflix","storeType":0,"type":0,"url":"com.netflix.ninja","urlType":0}

@mannyman
Copy link
Contributor Author

This home assistant community post looks accurate for the latest Hisense AndroidTVs in case that's the difference between our TVs:
The author and I believe your code uses ui_service instead of remote_service (which also worked for me).
https://community.home-assistant.io/t/hisense-tv-control/97638/95

"For app launching, here’s an example MQTT publish and the JSON for it. This launches the app immediately, from every screen and input I could try.

/remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XY$normal/actions/launchapp

{
  "appIcon": "",
  "appId": "",
  "has_detail_page": 0,
  "isLocalApp": 1,
  "name": "Plex",
  "storeType": 0,
  "type": 0,
  "url": "com.plexapp.android",
  "urlType": 0
}

"
I also think this would be useful for your code:
"
This will return a JSON response with all installed apps, makes it easy to format the app changing commands above.

/remoteapp/mobile/XX:XX:XX:XX:XX:XY$normal/ui_service/data/applist

"

@newAM newAM added the enhancement New feature or request label Mar 11, 2022
@newAM
Copy link
Owner

newAM commented Mar 11, 2022

Ah, that makes sense - they changed the API. I originally accepted a pull-request for the netflix/youtube/amazon keys - I never got those to work on my TV myself.

If you want to send in a pull-request for that update I am happy to review it, but I would rather not develop features myself without a mechanism to test them.

@mannyman
Copy link
Contributor Author

Sound good, But I've never done that before.
Do I just replace

{
"name": "Netflix",
"urlType": 37,
"storeType": 0,
"url": "netflix",
}

with

{
  "appIcon": "",
  "appId": "",
  "has_detail_page": 0,
  "isLocalApp": 1,
  "name": "Netflix",
  "storeType": 0,
  "type": 0,
  "url": "com.netflix.ninja",
  "urlType": 0
}

and then click save or something?
Going to click on Pull request button and see what happens.

@mannyman
Copy link
Contributor Author

OK tried pulling and forking. Not sure what to do now.
added the following to init and main:
Added more apps
"disney+",
"hulu",
"peacock_tv",
"tubi",
"pluto_tv",
"vudu",
"hbo_max",
"youtube_music",
"iheartradio",
"pandora",
"TIDAL",
"Spotify",
"TuneIn Radio",
"Plex",
"MrMC",
"Stadia",

@mannyman
Copy link
Contributor Author

mannyman commented Mar 11, 2022

Holy moly. It worked!
Thanks for this project.
Here's video of it.
https://youtu.be/v3QqIyN58ns

@ersan
Copy link

ersan commented May 28, 2023

Sorry to revive this, but does this project still work on the U8H? Trying to decide if I should buy one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants