How can I autoconnect to miracast/chromecast (screen cast) device? I've seen it in a friends OS though not in most and not in any of the roms I have/am using.

What lets this happen for some but not others? They are all kitkat or later.

Is there any setting or app that lets me do this?

Tasker integration would be a huge plus.
What I've done that has worked is use tasker to launch the wireless display settings app, then use AutoInput to click on the adapter once it shows up. I was using this in my car, so I had the app trigger as soon as the phone connected to the car's bluetooth.