UPDATE JUNE 2020: This thread is outdated. Instead, follow this guide:
Original post:
I’m planning to use Lovelace to make a dashboard using an Android tablet using Fully Kiosk Browser. That will replace my current method of a bunch of Tasker-connected Android home screen widgets to perform specific HA tasks like turning switches on/off. Importantly for this question, I also use the Sonos widget on the homescreen. We often use the Sonos widget to launch the Sonos app.
I’d like to include a Lovelace media player card that has a button to launch the Sonos app. I can think of a few ways to achieve opening of the Sonos app by going back through the HA server. But, I’d like to keep everything local to the tablet if possible.
Thanks, @thomasloven. I could only think of server-side solutions myself, so you’re helping to confirm my fear. It may not actually be a problem, but my main concern is latency introduced by more moving parts and the roundtrip through the server. I wonder if it will seem like too long between pressing a button and the app opening. I’ll try REST and see how that performs.
Now that I think about it, it might be possible to trigger the javascript thing via a weblink or similar. I’m not fluent enough in javascript to figure out how, though.
With a bit of trial and error of the formatting of the URL, it turns out that you can launch an Android app from the HA frontend in Fully Kiosk Browser with an Android intent. This https://developer.chrome.com/multidevice/android/intents implies that it should work in Chrome for Android, as well, but I couldn’t make it work.
This works in Fully Kiosk Browser to launch Sonos, for example:
I got an old Android tablet as well. Sadfully, stone age 4.0x.
Because of this I took MQTT Dash as my tool of choice…HA with Node-RED.
Anyways, perhaps you can place a pure URL in your frontend and start a tasker task by a plugin called “Tasker URL launcher”. I don’t know why, but it has been kicked out the playstore.
Another option could be using Autotools by Autoapps, which has a WebView builtin, with JS injection (not sure).
I ended up with: AutoVoice by AutoApps to send my spoken text to Snips.ai via MQTT, which parses my text and control HA as result
I was actually doing something similar in my old set-up with Domoticz. I was using a combination of Google Assistant connected dummy switches with MQTT to trigger Tasker tasks. It worked quite well, but I’m trying to cut down on the “moving parts” so that there are fewer points of failure.
@yes13q Are you talking about the Android app launch? If so, that’s on the local device you’re interacting with. For the voice examples, there’s no frontend device involved. It’s all on the server and in the cloud.
How did you figure out the URL to launch the Sonos app? I’d like to do the same with the Spotify app, but not sure if I just replace sonos.acr with spotify.acr, .SonosLaunchActivity with .SpotifyLaunchActivity, etc.
What is weird is that I tried setting up the weblink component in configuration.yaml using the two examples you gave, but Home Assistant failed to setup the component. I tried with the config below:
The BBC weblink works using Chrome and my Fire HD8, but Calendar doesn’t work, though I have the app installed. It is probably an Amazon Fire tablet issue.
Hello.
I am using the same technic as described here to launch spotify on my tablet from fully kiosk. It works great. I have a small problem however. The weblink from lovelace always open a new blank tab in fully kiosk. As anyone found a way to avoid that ? It s not very user friendly to have to close the blank tab each time
I don’t think you can avoid a new tab being opened using an intent. However, using Fully Kiosk’s REST API as originally suggested by @thomasloven in this thread does not open another tab. It’s a bit more work, though.
[pkg] refers to the Android package name. Some package name examples:
Sonos - com.sonos.acr
Spotify - com.spotify.music
Tado - com.tado
Google Maps - com.google.android.gm
To find the package name of an installed app, go to Settings/Universal Launcher/Select Items to Show/Add Application in Fully Kiosk. You’ll see a list of installed apps with the package name underneath each.
To enable the REST API in Fully Kiosk go to Settings/Remote Administration (PLUS):
Turn on Enable Remote Administration
Set a Remote Admin Password - Use your password in place of [pass] in the url above. Do not include the brackets.
Turn on Remote Admin from Local Network - Note the IP address. It goes in place of ip-address in the URL above. (You’ll probably want to set a that as a static IP on your router.)
Thanks that’s working great, is there a way to pass the ip of the calling device as a parameter, as i have 3 of wall mounted kiosks, and want to know which one called the service, or perhaps having 3 ui conditional elements for each kiosk and only show 1 per device but i dont know hiw to implement this. Any advice?
I don’t think that you can pass parameters such as the IP address directly, but there are other ways that you can differentiate among more than one tablet.
I have two tablets. I handle them as follows:
Create two Lovelace tabs, one for each tablet with different script entity_ids in the launch buttons on each, e.g. on one tablet the action looks like this: