How to control power to another device?

We have a USB CarPlay adapter in one of our cars. Unfortunately, our garage is right below our bedroom and the USB port in the car that it uses for CarPlay is always live. As a result, our phones are constantly flapping back and forth between the CarPlay adapter and our home wireless network while in range.

Would it be possible to wire an ESP in line so that it cuts off power to the CarPlay adapter when the ESP connects to our home WiFi or sees a Bluetooth device that lives in the garage?

Thanks!

Of course even if it doesn’t sound very elegant.
You could use some relay/mosfet module or build your own circuit.

Thanks for the response! I guess I asked the wrong question in the post. It should have been how would I go about doing this?

I know I’d have to take USB/Data in from the car and run the power to the ESP (and possibly a relay/mosfet?) while somehow keeping the data connection intact to the adapter. I’m comfortable with a soldering iron and wiring but not too confident with my circuit design/component selection just yet.

Would something like this ESP32 2 Channel 5V Relay Module 4M Byte Flash Large Capacity Programmable Relay Board or maybe ESP8266 WiFi Relay Module with ESP-01S Relay Adapter Module be what I’m looking for?

You have so many options… Like the boards you linked or just common Esp32 dev board with separated relay module:

I guess you need to modify some spare usb-cable to get 5V/GND for esp, route 5V to relay and from there back to the other end of cable. There are also usb breakout boards and cables.

The adapter takes 5v in, so I’m thinking a pair of these with a perfboard in between them would give me a way to tap into the data line while still allowing for easy plugging/unplugging from the ESP to the car and then from the ESP to the CarPlay adapter.

Thanks!

Yep. It’s just a choice of using pcb or directly wires.