USB PowerOff when TV is turned off?

hey all,

im gonna use the USB interface in my rpi for LED behind the tv,
it there any way to turn usb power off when the tv is off, and turn it on when the tv is on (either in HDMI mode or Regulair TV mode)?

Powering off the usb ports on a raspberry won’t really work as the network would also go down and other stuff connected to it.

You could use a relay connected to the gpios with a script to catch the cec command for turning off the tv and then switches the lights off when receiving that signal.

Actully it doesnt really matter, as i have a RPI 3 and use the onboard WiFi, and i dont use either the USB or rj45 plug for anything…

In this case you could just have googled:

On your own risk though.

yes, but that is a command to manully turn it off, i want it to turn off when tv turns off, and turn on when tv turns on :slight_smile:

A dirty hack could be to use the 5v from an usb port of the tv to switch a relay to disconnect the usb power of the pi to your lights.

Actully My tv has a USB port that i was originally gonna use, but the problem is that this USB port is always giving power, Even when the tv is off

Check this thread, if tvservice -n give you different information when TV is on/off you can use this to control the USB power.

This is my second answer about RemotePi board, and i’m not affiliate to them…
If you use a Physical power button that is overriding the RPI hardware, your RPI will be Powered Off (no halt) but the power button will remain in a sort of “sleep” mode.
This can be a good solution in case you use a heat sink with a cooling fan that will keep working after the RPi is Soft shutdown.
With the Power button the heat sink will be powered off too…