[New SmartApp][Beta] Turn off A when B is running

So I’ve got a lot of projects that I’d like to share but I don’t feel like many of them are ready for public eyes, and even posting this one could prove to be a hasty decision, but that all being said this one is simple I hopefully didn’t flop it too bad.

Logic: The app reads a powerMeter capability to see if it’s above the user specified standby value, if it is turn off the user selected switches, if it’s below turn them back on.

Uses:

  • Too many devices on one circuit, keeps tripping breaker.
  • My strange scenario where two devices are fighting for water (Washing Machine) (Cat Genie… Look it up), the Cat Genie locks up if it thinks there’s something wrong with the water supply (It’s T’d off of the washer line and when the washer starts it wins the battle, so we turn it off and when the Cat Genie is done we turn the washer back on as that will resume with no user interaction.

Note: Some powerMeter devices are a bit slow to report values back. My Aeon Outlet is quite slow, but it works before it becomes an issue. I’ve heard the SmartThings one from the store is very fast but it doesn’t have the 15 Amp rating that I need for the appliance in question… Yes it’s a beast.

The Code:

Please feel free to leave comments below.

Also where do you guys get icons from? I can figure it out, just wondering if there was a nice way to make icons online that I missed.

7 Likes

Dude! Super cool!!

Glad to see you’re getting your hands dirty writing some code! Keep it up man!

Thanks, as I said I’ve got a bunch of code kicking around, most of it I’ve hacked and slashed together for myself but this one is nice and simple. I figured why keep it to myself. :smile:

I haven’t tried this app yet but if it works I’m going to use it to turn the kids tv off when they leave (if I unplug the TV when it’s on then plug it back in it stays off). Perfect that it can turn the energy switch back on so the can use the remote to turn tv back on when they get home. Thanks for writing this!!

Well the app will actually only turn another device off when the power sensing device is above “standby current draw.” So I don’t know if that meets your needs, unless I’m missing a part of the equation. Feel free to take some of the code if you want to make something that fits your scenario better.

I have this plugged into the TV.

This reports energy use. And can be toggled on and off. Was hoping your app could do what I described.

This app would be more to turn your living room lights off when the TV is turned on for example. What you need is a motion sensor in the kids room, then when motion isn’t detected for (however long you figure out your kid(s) isn’t just sitting there watching TV) turn off a switch. I’m sure there’s some turn it off if no motion apps out there.

Motion won’t work (long story) maybe I’ll try a virtual swith with the big switch app and your app… Or attempt hacking your code :slight_smile: either not a big deal, just thought it would be helpful (to me) if it worked. Thank you for sharing your code.

No problem. Let me know if you figure out a combination of devices that might work and need some help writing your own SmartApp.

@keithcroshaw
Just now had a chance to test your app. It works exactly how I want it to. When the mode changes to nobody home, your app detects power being used from my power strip and turns it off. I have another app that turns the strip back on 5 seconds later.
Thanks for sharing this

1 Like

Awesome, glad somebody has use for this other than me!

1 Like

I modified this app to turn on devices when the primary device is running.

I also added a configurable time-delay shut off for the linked devices. For example, to prevent them flapping if the primary device is turned on and off repeatedly, or to give them time to shut down on their own.

Glad you still had a copy. And glad it’s helpful to you.
Something happened a while back which prompted me to remove everything from my GitHub.
I’m surprised to see people still using custom apps with WebCoRE around.

But again, cool!

Yeah, I have tried to avoid WebCore and do everything in SmartThings even though it’s increasingly a mess. I am more likely to switch to OpenHAB or HomeAssistant than jump on WebCore.

I’m running on Home Assistant.
I was using SmartThings as my Z-Wave/Zigbee bridge but a developer over at Hubitat just released a new Alpha version of his MQTT driver which is proving sufficient.
So now Hubitat will be my Z-Wave/Zigbee bridge and maybe handle a few things here and there.