Has anyone got the learned remote commands to work?
Apparently they won’t work with the new Chromecast, because it is not rooted. redphx has given some insight on this:
I just found a thread where someone mentions commands that do work, but I have yet to test how well they work.
ADB permissions on Chromecast with Google TV? | XDA Forums (xda-developers.com)
input keyevent 22 KEYCODE_DPAD_right
input keyevent 19 KEYCODE_DPAD_UP
input keyevent 20 KEYCODE_DPAD_DOWN
input keyevent 21 KEYCODE_DPAD_LEFT
input keyevent 23 KEYCODE_DPAD_CENTER
input keyevent 4 KEYCODE_BACK
input keyevent 26 KEYCODE_POWER toggles tv power
input keyevent 177 KEYCODE_TV_POWER toggles tv power
input keyevent 224 KEYCODE_WAKEUP turns on tv
input keyevent 223 KEYCODE_SLEEP turns off tv
I tried them last night, they seem to be the same as the normal codes. I will be using my TV’s codes instead as those seem to be faster.
I have a separate Python script I use that does the same thing as the learned commands. At first I had the same problem that it only worked when the physical remote was active (it times out after a short time). In the shell prompt I queried the input devices:
darcy:/ $ getevent -S
add device 1: /dev/input/event3
name: "shield-ask-remote"
add device 2: /dev/input/event2
name: "virtual-search"
add device 3: /dev/input/event1
name: "tegra-hda HDMI/DP,pcm=3"
could not get driver version for /dev/input/mice, Not a typewriter
add device 4: /dev/input/event0
name: "gpio-keys"
and found that /dev/input/event3
is always available and works with sendevent
, which is about 100x faster than using input keyevent
.
I’ve been trying to figure this out as well… don’t have any direct solutions, but I do have a workaround and some other possible leads for a better solution:
- Logitech Harmony Hub can pair with the CCwGTV dongle via Bluetooth. This fixes it well enough for me, but also has me thinking that for people who don’t have Harmony, that there may be a way to pair the dongle directly with a HA instance that has access to Bluetooth? Harmony shows up on the CCwGTV as “Harmony Keyboard.”
- I tried recording both the button presses from the CCwGTV remote and the iOS “Android TV” app, and they come up with different codes. Neither works when sent back by HA, but maybe there’s some other setup to emulate the commands of that would? Has anyone tried capturing the codes coming off the remote in the Google Home app?
Hi I have a harmony hub and when I try to add devices vi scan network it only finds my two 1st gen chromecast and not the two new google tv ones.
Am I missing something as I can’t see any other way or trying to add them vi the app
TIA
Do all methods require “USB debugging” to be enabled?
I’ve been recently troubleshooting bad video image stuttering in YouTube app.
And turns out it was “USB debugging” setting causing this. Anyone else notice this? Very noticeable at 4K but still happens all the way down 1080i 50Hz with 720p content. tbh it’s only been an issue for the last couple of months. turn that setting off and perfect 4K 60Hz content.
I ran the adb command as well and got a result of:
add device 1: /dev/input/event3
name: "virtual-search"
could not get driver version for /dev/input/mice, Not a typewriter
add device 2: /dev/input/event2
name: "cec_input"
add device 3: /dev/input/event1
name: "aml_vkeypad"
add device 4: /dev/input/event0
name: "gpio_keypad"
But I can’t use sendevent with any of these devices. Looks like your device is a Nvidia Shield not a Chromecast with Google TV? Has anyone had any luck controlling the power of the CwGT without the remote awake or harmony? Mine’s in the kitchen and not close to my harmony hub.
My device is indeed an Nvidia Shield but the two run the same operating system. Can you post specifically what sendevent
commands you are trying and what the output is?
I’m trying sendevent /dev/input/event0 4 4 786846 && sendevent /dev/input/event0 1 152 1 && sendevent /dev/input/event0 0 0 0 && sendevent /dev/input/event0 4 4 786846 && sendevent /dev/input/event0 1 152 0 && sendevent /dev/input/event0 0 0 0
which is what seems to be power toggle from when I listen for the remote command.
I get response sendevent: /dev/input/event0: Permission denied
on all inputs. I think the CwGT requires root to access /dev/input
. I may just return this thing if I can’t control it properly.
“permission denied” is based on the permissions of the currently logged in user and the permissions of the devices. On my Shield from an adb shell
I see this:
/ $ ls -l /dev/input
total 0
crw-rw---- 1 system input 13, 64 2021-08-24 22:13 event0
crw-rw---- 1 system input 13, 65 2021-08-24 22:13 event1
crw-rw---- 1 system input 13, 66 2021-08-24 22:13 event2
crw-rw---- 1 system input 13, 67 2021-08-24 22:13 event3
crw-rw---- 1 system input 13, 68 2021-08-24 22:13 event4
crw-rw---- 1 system input 13, 69 2021-08-24 22:13 event5
crw-rw---- 1 root input 13, 63 2021-08-24 22:13 mice
crw-rw---- 1 root input 13, 32 2021-08-24 22:13 mouse0
crw-rw---- 1 root input 13, 33 2021-08-24 22:13 mouse1
and
/ $ whoami
shell
The directory listing for /etc/input
shows that the owner is system
and the group is input 13,
. The reason sendevent works for me is that my user must be in that group (I don’t have root access so I can’t explicitly see group membership).
You definitely don’t need root access to do sendevent
but you do need authority to access those devices. I would try plugging in an external keyboard (or a bluetooth keyboard dongle) and see if you have access to do sendevent on that. (I’m guessing not but who knows)
I just got this to work but only by using Logitech Harmony Remote commands and a script that uses parallel for multiple presses.
I made the mistake of using a custom:button-card with a tap action of toggle to start, best to use the call-service function and then it is lightning fast
I think the root access to /dev is specific to the CwGT device. From previous posts in this thread and XDA Developers forums it doesn’t look like the CwGT is going to work with the Android TV integration properly. I’m probably going to try and swap this device out with something else to see if I can get proper integration going.
In case my point wasn’t clear, I am aware that the kernel ignores permissions for root users. But being root isn’t required to run these commands and it is generally a bad idea to run non-administrative scripts as root for myriad reasons.
All files & devices have group access and if you run the command as a user in that group, it will work. Unfortunately, getting into the input group (or finding out what users are in that group) itself requires root access. I would reach out to the manufacturer for guidance if such information isn’t published.
For people with pre-Dec 2020 devices, they can gain root access: https://www.xda-developers.com/chromecast-with-google-tv-bootloader-unlock-exploit/
Just an update on powering on the CwGT after it goes to sleep. I gave it one last shot with a USB-C ethernet adapter and disabled wireless. So far it’s been reliable to use the regular media_player.turn_on service with a wired connection compared to wireless. This is after the remote has definitely gone to sleep. I also did configure the CwGT in App Mode only but will have to confirm whether that made a difference or not.
UPDATE: While it’s pretty consistent turning on, I can’t seem to turn it off consistently when TinyCam Pro is running. Last ditch I tried pairing my harmony hub which is across the whole on the same floor and it works well.
Has anyone been successful opening specific intents with the CwGT? I’m trying to open a specific camera in tinyCamPro but the examples I’ve seen don’t seem to work.
For me, disabling screencap in the AndroidTV integration stopped this
Hi! I was very interested if this is still the case? Is the new chromecast with Google TV working for you when using the old cast integration? There is an alert that the state isn’t read correctly when you have Google TV 11.
Did you find a way to disable OS updates?