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


(Keith Croshaw) #1

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.


Power on/off lights based on TV state
(Tim Slagle) #2

Dude! Super cool!!

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


(Keith Croshaw) #3

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:


(John O) #4

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!!


(Keith Croshaw) #5

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.


(John O) #6

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.


(Keith Croshaw) #7

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.


(John O) #8

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.


(Keith Croshaw) #9

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


(John O) #10

@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


(Keith Croshaw) #11

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


Notification when switches are left on after departing