My ultimate goal is to have pandora play on my chromecast audio homegroup (two chrome cast audio devices linked together) when I enter home. I’m having trouble getting any media to cast. Any ideas how to do this?
I currently have this in automation. I made a input_select button to test it out but nothing works.
- alias: Start Music
trigger:
platform: state
entity_id: input_select.music_test
to: "Start"
action:
service: media_player.play_media
data:
entity_id: media_player.audiounlimited
media_id: http://xxxxxxxx.com/wp-content/uploads/2016/05/eye.mp3
media_type: audio/mp4
Don’t give me too much credit; your original post requesting help had the full URL in the code example; I just clicked on it. Hope the other thread helps. I’ve been meaning to try it out but I have so many other things to work on first. Just got my iBeacons set up and trying to get the manual alarm control panel to work properly. Then I am on to Echo integration. Of course @brusc came out with another video on HA and Tasker so I have to do that now!
I completed this using tasker & autoremote, as I couldn’t find a way to get HA to play/CA content that wasn’t local source. Currently, I have it set up to cast Pandora, Spotify, & Amazon Music.
First follow the directions on this link to get your py script and AutoRemote command setup:
Next, get the Tasker Task setup on on your android device (I’m using my Nexus 9 rooted). Rooted is important for me, because I need it to disable the lock screen & wake from Doze. The Tasker Task is a combination of Keyguard plugin, Secure Settings plugin, AutoRemote, & AutoInput. After receiving the command from the py script/AutoRemote, the device wakes & disables the lock screen (using Keyguard & Secure Settings), launches the respective app, then uses AutoInput to pick the group that I want to cast too. Depending on the App (I’m looking at you Amazon Music) casting isn’t available, so I have to use Cast Screen, which is a little hacky, but works nonetheless.
It’s a little roundabout, but it’s the only thing I found to get streaming music to play to CA from HASS. If there is a better solution that I’ve missed, or if you need more detailed instructions, please let me know!
A screenshot of the tanker task would help if you have time first. Do you mind writing out instructions with the different programs you use and where to download? I bought tasked and auto input but I’m a bit stuck now. Thanks!
Maybe also your Python script? Not sure where the url comes from thanks!
So just to confirm, you got the Tasker Profiles & Tasks to work, or you got the app up and running? Tasker is a really amazing and powerful app, however there is a bit of a learning curve. The Tasker plugins that I use for this particular Tasker Profile are:
The video that @rpitera posted is for Tasker to HA flow. The article that I posted earlier in the thread pertains to HA to Tasker flow. For my particular setup, I am going from HA to Tasker.
The URL comes from your device specific AutoRemote URL.
My HA setup is set up as a switch that runs the either On.py or Off.py script. The script send an AutoRemote message to the specific Android device, which acts as a trigger to run the Music Casting task (or conversely turn it off).
Please let me know if any of that makes senses. If you are having any trouble with understanding Tasker/navigating it, I would suggest looking at the subreddit /r/Tasker, as the people there are immensely helpful.
Robert, was responding to TC. Thank you for the video, I was studying that last night too!
This morning at 8 AM I was able to figure out all the tasker profile and tasks. i realized secure setting was an app and that is what tripped me out.
When I go home today, I’m going to try to figure out the home assistant integration when I go home. Do you mind sharing your on.py and off.py script? Just so I can see how you did that.What you did is brilliant. I’m almost there! Thank you all!
The URL is from the device specific AutoRemote URL that I previously mentioned. When you go to that URL and put text in the “Message” box (for example the text could say “Pandora”), the URL string will include the specific message that you want to send via AutoRemote. That URL then goes into the ‘[URL]’ part of the requests.get (you do not need the brackets, but you do need the single quotation marks). You will need a script for both an On or Off command, the only difference being the text that you put in the “Message” box for the AutoRemote URL, thereby sending different commands to the Android device.
Note: I was getting a bad SSL handshake, so that is why I include the verify=False.
TC! I was able to get everything to work thank you! Do you mind putting a screenshot of your tasker “Task Edit” page? I’m just curious on the settings used as mine seem to be finnikey depending on if you have pandora open or not.
No problem! I think there is also an option in AutoInput to wait until the specified elements are on the screen, but I have never used that feature (although I should probably investigate it)