Control power on a USB port on emonPi

Hi,

I would like to send a message via MQTT to my emonPi and then disable or enable the power to a USB port depending on the content of the message.

I already have Node Red on the emonPi working to receive a MQTT message that has been sent from an external source. Now I think I need to use an “exec node” to call a command to turn the USB port off or on. Can anyone provide me with guidance on how I can do this part please? I am a novice user…

Thanks!
Ingleby

https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93463 seems to indicate the only “software” control over the USB ports is to completely power down the USB bus (which includes all connected devices, including the RJ45 network port).
Here’s another post for the Pi 3

What do you want to turn a USB port off for? Would a GPIO controlled relay be a better option?

Hi Greebo,

Thanks for the quick response - I actually want to connect a light to the USB port and switch it on or off depending on the status of a message I receive from MQTT.

I have seen today that Blink1 using nodered might be a good option (Glynn was looking at it :slight_smile: ) for this (https://blog.thingm.com/2014/07/node-red-plugin-for-blink1/) and I was wondering if anyone had used it on their emonBase/EmonPi?

Best Wishes,
Evan

Do you mean a normal household light, or are you talking about an actual blink(1) turning an LED on and off? If you mean the blink(1), from what I’ve just read, its a software controlled RGB LED anyway so you don’t need to mess with any USB power at all.

Is that what you’re trying to do?

Yes - I agree with you - messing with the power is not necessary.

Today I realized it was better to buy one of these blink(1) USB lights (or something similar) and try and use nodeRed to connect the arrival of a MQTT message and then change the colour of the blink(1) led. I was even more excited that GLYN HUDSON has been looking into this - because I hope it means it will work on the emonBase…

I have searched this forum for information on blink(1) but did not find anything…