Is this add-on is suitable for using with cellphones?
Hi, I’m trying to understand how to implement this add-on in hassio. I’ve managed to get the add-on working, I’ve got a media_player entity that can turn off my android tv box but that’s all it can do at the moment. This adb business is well above my current level of understanding, so I’m starting with a basic switch to trigger an automation/intent. However, nothing happens. Here’s my automation
- alias: Android TV Auto
trigger:
- platform: state
entity_id: input_boolean.androidtv
from: 'off'
to: 'on'
action:
- service: media_player.androidtv_intent
data:
entity_id: media_player.androidtv
intent: "-n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"
Am I heading in the right direction? Sometimes it’s worth posting because the more eagle-eyed of you can spot an obvious mistake. Otherwise, is there something else I need to do to be able to use these ‘intent’ services?
Any pointers would be very much appreciated.
Maybe this could inspire some.
My biggest problem is I can see the format of the intents but I just don’t understand where that code goes. Is that Shield_Intents.MD file something that is being referenced, or is that just the format of the service call you are using in automations?
Would you mind posting some of the code that relates to the action from your input_boolean triggers please?
– edit –
Updated the gist with better lovelace code for some buttons, i had some buttons that activated some node-red flows, the new code should work for anyone without my custom node-red flows.
– edit –
The input_booleans trigger a node-red flow, (they are a advanced combination of looking if tv is on, set correct input via IR, set soundlevel depending on time and if wife is home, and then starting the right application on the shield) so they are not a good example, but if you look further down you see a typical example.
(the input_boolean.shield_dummy is only there because you have to have a entity for the button card to work.)
card:
type: entity-button
icon: mdi:stop
name: STOP
entity: input_boolean.shield_dummy
hold_action: none
tap_action:
action: call-service
service: media_player.androidtv_key
service_data:
entity_id: media_player.shield
key: KEYCODE_MEDIA_STOP
The intent examples you use on the /dev-service page.
(you test them there and the you implement them in a automation, lovelace or node-red or other)
Thank you so much for this mcfrojd!! That’s really helpful.
Found a few more intents for some (highly recommended) apps I use.
S0undTV for twitch:
"intent":"-n com.s0und.s0undtv/com.s0und.s0undtv.activities.MainActivity"
SmartYoutubeTV:
"intent":"-n com.liskovsoft.videomanager/com.liskovsoft.smartyoutubetv.bootstrap.BootstrapActivity"
Perfect Player:
"intent":"-n com.niklabs.pp/com.niklabs.perfectplayer.MainActivity"
Not an issue of the add-on, but my nVidia Shield TV doesn’t turn off when pressing the power button the media card. Turning it on with the power button works and also the state gets correctly updated when I turn off the Shield TV with the remote control.
Anyone else noticing this as well?
Yes (though I use the mini media player). If I open the more info panel I can turn on and off with the toggle there.
Thanks! I use the mini media player as well. And indeed when opening the more info panel I can turn off the Shield. That made me realize that the mini media player does a toggle service call by default, which apparently doesn’t work for the Shield TV.
I have now added toggle_power: false
in the mini media player settings and then both turning on and off work fine
Help, I’m a newbie to Hass.io
Saldy I can’t get the Android TV Component to work.
Here’s what I get in my Hass log.
Tue Feb 12 2019 20:56:27 GMT+1100 (Australian Eastern Daylight Time)
Error while setting up platform androidtv
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/androidtv.py”, line 191, in setup_platform
adb_server_port=config[CONF_ADB_SERVER_PORT])
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 230, in init
self.properties = self.device_info()
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 325, in device_info
properties = self._adb_shell(‘getprop’)
File “/config/deps/lib/python3.6/site-packages/androidtv/init.py”, line 479, in _adb_shell_pure_python_adb
return self._adb_device.shell(cmd)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/command/transport/init.py”, line 20, in shell
conn = self.create_connection(timeout=timeout)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/device.py”, line 45, in create_connection
self.transport(conn)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/command/transport/init.py”, line 15, in transport
connection.send(cmd)
File “/config/deps/lib/python3.6/site-packages/adb_messenger/connection.py”, line 77, in send
return self._check_status()
File “/config/deps/lib/python3.6/site-packages/adb_messenger/connection.py”, line 83, in _check_status
raise RuntimeError(“ERROR: {} {}”.format(repr(recv), error))
RuntimeError: ERROR: ‘FAIL’ 00a7device unauthorized.
This adb server’s $ADB_VENDOR_KEYS is not set
Try ‘adb kill-server’ if that seems wrong.
Otherwise check for a confirmation dialog on your device.
i had the same error when settings it up for my shield
this error indicates you have not manually accepted/authorised the connection. when you start up the add-on it will try to connect to your shield with the ip address you input into the add-ons config settings. You then have to accept the prompt that will appear on the shield (save the authorisation with the checkbox too) to authorise the connection.
If the promt dont come up on your Shield, you might not have activated “developer mode” on your Shield, and then activated “network adb”.
This steps is a must.
Thanks mcfrojd and simbesh.
No prompt on Shield and developer mode with Network Adb on.
I’ll restart it and go through the steps again.
C
Sweet! I will do that too then.
Worked it out, I didn’t create the directory for the keys to be stored in.
Instructions are a little miss-leading. I suggest that a line is added in if that’s the case because ATM it refers to that specific instruction as optional.
How are you guys getting the proper intenets for your specific devices? I have a bravia tv and some of the commands listed in this thread work on it, some dont. Specifically, the plex command listed in the thread doesn’t work. How would I go about finding the commands for my device?
Hi guys,
I managed to open Kodi on my NVidia Shield TV by using the
-n org.xbmc.kodi/.Splash
intent. The odd thing is that when I return to the Home screen, I get a message saying “-n Kodi Unknown” that I cannot get rid of. Only closing the Kodi app removes also the message…
Opening other apps (e. g. Youtube) does not cause this message, it’s only Kodi. Has anybody else also encountered this message?
Yes, the same here.