Skip to content
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

[New App Shortcut]: Crave tv app #13

Closed
1 task done
PRProd opened this issue Nov 16, 2022 · 25 comments
Closed
1 task done

[New App Shortcut]: Crave tv app #13

PRProd opened this issue Nov 16, 2022 · 25 comments
Assignees
Labels
enhancement New feature or request New App Shortcut Request for a new Firemote app shortcut

Comments

@PRProd
Copy link
Owner

PRProd commented Nov 16, 2022

App Name

Crave tv app

Can this app be freely downloaded through official means?

  • Yes

Optional Comments

Requested by @clinds34 on Nov 11, 2022 in #6

@PRProd PRProd added enhancement New feature or request New App Shortcut Request for a new Firemote app shortcut labels Nov 16, 2022
@PRProd PRProd self-assigned this Nov 16, 2022
@PRProd
Copy link
Owner Author

PRProd commented Nov 16, 2022

@clinds34 - Maybe it's because I'm in the US, but when I try installing the "Crave TV" app on my device, the download page says "Unavailable". Without being able to download it for myself, it might take a while to get this added. Would you be willing to help me with some testing?

If we are lucky, I'll only need you to do this:

  • Launch the app on your device
  • In Home Assistant, click on Developer Tools -> States
  • Find your Fire TV entity by scrolling, or clicking the "set state" bar, and searching for it
  • Reply to this post with the contents found in the Attributes column or the "State attributes (YAML, optional)" box

@clinds34
Copy link

Hi - Can verify that the Bell Fibe TV works like a charm. Thank you.

Here are the attributes as requested. I have removed the token. I assume that you can't access due to licensing issues. I hope I haven't created a nightmare for you.

source_list: Crave
app_id: ca.bellmedia.cravetv
source: Crave
adb_response: Starting: Intent { cmp=ca.bell.tv.firetv/ca.bell.fiberemote.tv.MainTvActivity }
Warning: Activity not started, its current task has been brought to the front
hdmi_input: null
device_class: tv
entity_picture: /api/media_player_proxy/media_player.fire_tv?
token=xxxxxxxx
friendly_name: Fire TV
supported_features: 22961

PRProd added a commit that referenced this issue Nov 16, 2022
Added Crave TV button for testing - #13
@PRProd
Copy link
Owner Author

PRProd commented Nov 16, 2022

Pre-release v1.8.1 is available for testing now. @clinds34 - please let me know how the testing goes.

@clinds34
Copy link

It is not working on the v1.8.1 version. I get the updated crave button but no action on tv when pressed.

attributes rechecked and same as above if load from screen.

@PRProd
Copy link
Owner Author

PRProd commented Nov 16, 2022

Pre-release v1.8.2 is available for testing now. @clinds34 - please let me know how the testing goes.

@clinds34
Copy link

1.8.2 is not working either

@PRProd
Copy link
Owner Author

PRProd commented Nov 16, 2022

Bummer. Thanks for the feedback. I'll see if I can figure out something else on my end.

@PRProd
Copy link
Owner Author

PRProd commented Nov 16, 2022

Pre-release v1.8.3 is available for testing now. @clinds34 - please let me know how the testing goes. Hopefully third time's a charm.

@clinds34
Copy link

sorry not yet. but there was this in the attibutes

adb_response: >-
Starting: Intent { cmp=ca.bellmedia.cravetv/awl.application.MainActivity }

Error type 3

Error: Activity class {ca.bellmedia.cravetv/awl.application.MainActivity} does
not exist.
hdmi_input: null
device_class: tv
friendly_name: Fire TV 192.168.1.198
supported_features: 22961
source: Crave
entity_picture: >-
/api/media_player_proxy/media_player.fire_tv?
token=xxxxxxxx
source_list:

  • Crave
    app_id: ca.bellmedia.cravetv

If there is some enhanced bugging I can do (I have been digging around in ADB app but no luck yet), I would be happy to try to help.

@PRProd
Copy link
Owner Author

PRProd commented Nov 17, 2022

If you have an easy way to send ADB commands to your device, that would help A LOT! We can make this happen!

Ultimately, we need to come up with a command that causes the crave app to open and/or come to the top. We have tried two different methods that HA uses to talk to media player devices which didn't work in this case. On the third attempt, we tried to use the following ADB command:

adb shell am start -n ca.bellmedia.cravetv/awl.application.MainActivity

This command actually works for me on my sideloaded version of the crave app... well... sort of. It launches the app, and then the app crashes right away. Sideloading is a dangerous practice, but if you happen to have a copy of the .apk file for the crave app that your device is using, I could take it from there... I'm sure you didn't sideload it to begin with, so I'd assume you don't have the .apk file. Not a problem at all.

Since that didn't work on my end, here's how you can help out: First, open the crave app on your device, and then prepare your ADB tool to send a command to it. run the following command:

adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mInputMethodTarget|mSurface'

In that response, you will see a few clues that might help assemble the final working command. You are specifically looking for something that likely begins with "ca.bellmedia...." then a slash, and then some more. In my testing, I found "ca.bellmedia.cravetv/awl.application.MainActivity" (yours will be different)

The next step will be to send a command containing the thing that you found. You can test this command in two different ways. You can either use your ADB tool that you were talking about, or you can use the Developer Tools inside HA to directly send ADB commands to your device. ( Developer Tools -> Services -> Android TV: ADB command ) You'll ultimately want to send a command that begins with adb shell am start -n and then append the "clue" that you found to the end of the command.

For example: adb shell am start -n ca.bellmedia.cravetv/awl.application.MainActivity (yours will be different)

If you have something that works, then HOORAY! Let me know! If not, you might have to do a little more detective work.

In some more frustrating cases, I've needed to run the adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mInputMethodTarget|mSurface' command over and over and over again while I use my other hand and launch the application on the Fire device. If you're lucky, you might happen to catch one or more intermediate activities that you can try to use in your launch command. It's not always an easy process, but it is satisfying when you finally nail it down. :-)

Let me know if I can clarify anything, if you need help, or if you have some amazing success that we can celebrate together! Good luck!

@clinds34
Copy link

got it. I was halfway there, but your post put the second part together. I dropped

adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mInputMethodTarget|mSurface'
returned

127|kara:/ $ am start -n ca.bellmedia.cravetv/axis.androidtv.sdk.app.MainActivity
Starting: Intent { cmp=ca.bellmedia.cravetv/axis.androidtv.sdk.app.MainActivity }
Warning: Activity not started, its current task has been brought to the front
kara:/ $ 

Next I ran the following command in shell and Crave loaded on the Fire
adb shell $ am start -n ca.bellmedia.cravetv/axis.androidtv.sdk.app.MainActivity

I would note for anyone else down the road that this command was the one that worked

adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mInputMethodTarget|mSurface'

Interesting rabbit hole for me. I appreciate your help.

@PRProd
Copy link
Owner Author

PRProd commented Nov 17, 2022

EXCELLENT NEWS! Thank YOU for YOUR help!

I'll push this out in an official release soon. I have a couple of other tasks to attend to first.

PRProd added a commit that referenced this issue Nov 17, 2022
Fixed launch command for Crave TV App #13 @clinds34

Added app launch shortcut for Twitch

Minor config UI cleanup
@PRProd
Copy link
Owner Author

PRProd commented Nov 17, 2022

Release v1.8.4 is now available, which incorporates the correct command for launching the Crave TV app. Enjoy! Thanks again!

@PRProd PRProd closed this as completed Nov 17, 2022
@clinds34
Copy link

sorry there is a stray $ in the command, which is probably my bad

@clinds34
Copy link

not so fast....

source: Prime Video (FireTV)
adb_response: >-
Starting: Intent { cmp=ca.bellmedia.cravetv/awl.application.MainActivity }

Error type 3

Error: Activity class {ca.bellmedia.cravetv/awl.application.MainActivity} does
not exist.
hdmi_input: null
device_class: tv
entity_picture: >-
/api/media_player_proxy/media_player.fire_tv
token=xxx
friendly_name: Fire TV
supported_features: 22961

@PRProd
Copy link
Owner Author

PRProd commented Nov 17, 2022

You don't have the latest version yet... likely a cache issue. The cache can be quite sticky. Your version is still trying to use my older broken command.

I just released v1.8.5 which removed the accidental "$", so it should all be good now. Enjoy!

@PRProd PRProd closed this as completed Nov 17, 2022
@clinds34
Copy link

fantastic, v1.8.5 is good.

@PRProd
Copy link
Owner Author

PRProd commented Nov 18, 2022

@clinds34 - Out of curiosity, which exact Fire device(s) are you using? Since you have been able to help out by running some ADB commands, maybe you could help with this too?
https://github.com/PRProd/HA-Firemote/wiki/Existing-Amazon-Devices---Support-Chart

No pressure, but any input from the community will only make things better.

@clinds34
Copy link

clinds34 commented Nov 18, 2022

happy to help, I have two fire tv 4ks and a Pioneer FireTV which curiously is not on those lists (i think it is manufactured by TCL). That TV is outside and not part of the HA ecosystem.

ediit: turns out it is the Hisense 4k 2022 - which runs on the same Android and Firetv OS as the 4k max.

@PRProd
Copy link
Owner Author

PRProd commented Nov 18, 2022

Sweet! I was just going to ask what it responds with when you send adb shell getprop ro.product.vendor.model but now I'm assuming that it returns with AFTHA001 ?

Are you currently able to test that TV with the Firemote card? If so, can you open a new "Device Support Request" issue so I can track it and get it added?

@clinds34
Copy link

ok, give me some time and I will come back to you this weekend. That tv is outside and not always able to connect. This presents me with a two birds one stone opportunity...

@PRProd
Copy link
Owner Author

PRProd commented Nov 20, 2022

@clinds34 - You're the best! THANK YOU!!!!

@clinds34
Copy link

Here is the state attributes I get after running adb shell getprop ro.product.vendor.model

source_list:

  • ca.bell.tv.firetv
    app_id: ca.bell.tv.firetv
    source: ca.bell.tv.firetv
    adb_response: AFTDCT31
    hdmi_input: null
    device_class: tv
    entity_picture: >-
    /api/media_player_proxy/media_player.fire_tv_192_168_1_156?token=29ee28e1f52f560f3d346fb34508c4f44e398b0400357242dc3234e0b68e5ac7&cache=1669321571.235302
    friendly_name: Fire TV 192.168.1.156
    supported_features: 22961

@clinds34
Copy link

Using the Firemote firetv 4 series 2021 i am not having any problems controlling the tv.

@PRProd
Copy link
Owner Author

PRProd commented Nov 25, 2022

Thank you!

From that model number (AFTDCT31), it appears that your TV is actually an Insignia 4K UHD - Fire TV (2020)

I'll add that to the officially supported devices soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request New App Shortcut Request for a new Firemote app shortcut
Projects
None yet
Development

No branches or pull requests

2 participants