Pretty basic lighting piston - feedback on design efficiency please?


#1

1) Give a description of the problem
I’m new to CoRE, and I’d be grateful for feedback on the design-efficiency of this simple piston.

2) What is the expected behavior?
When my 3 Kitchen bulbs switch to “On” (they are controlled by a Hue motion sensor outside of SmartThings), I’d like this piston to also turn on my Basement Stairs light, but only if BOTH of these two conditions are met:

  1. the Basement Stairs light is not already On - I have some other automations in place such that it’s very likely that this Basement light is already on, so I don’t want this piston to send a wasted “On” command in that case.
    .
  2. Either me or my girlfriend are home. It’s a long story, but I have another automation that will turn on those 3 Kitchen bulbs at a set time in the late afternoon (regardless of presence or motion), so for that particular case, I don’t need the Basement Stairs light to also come on.

3) What is happening/not happening?
Both me and this piston are new - it hasn’t had a chance to fire yet, and I’m not sure yet how to test piston builds, but… I think this piston will work here as-is; but I’m wondering if there’s a better / more efficient way to set it up?

Right now, the Trigger and both follow-on Conditions in my IF statement are all set to “Automatic” for Subscription Method – is that the proper way to do it? I confess I’m not clear on what that option brings to the fight, or how to best use it in various piston builds

I’m open to any/all feedback / guidance / suggestions!

**4) Post a Green Snapshot of the piston!

5) Attach any logs (From ST IDE and by turning logging level to Full)
My apologies - I’m not sure how to do this, but I don’t think it would be relevant for my overall question.

Thanks for your time!


#2

Looking at the piston and what you’ve said, that piston will fire whenever a Kitchen light is turned on, regardless of how it was turned on.

So even if your second piston turns the light on in the afternoon and you’re home the basement light will still come on.


#3

Indeed, and that’s definitely one of my concerns… Since the Kitchen lights are primarily controlled by motion (and can go on/off pretty often!), I’m concerned that using their “switch - on” as a trigger is a wasteful & inefficient way to initiate what I’m attempting to do.

In the scenario of me being home in the afternoon at the time my other piston automatically turns on the Kitchen lights, then the Basement Stairs light would inevitably already be on, so I wouldn’t want this piston to fire in that case…

Most honestly, the main goal of this piston would be to turn on the Basement Stairs light in the morning when either me or my girlfriend walk through the kitchen for the first time that day (which can vary from very early to mid-morning).

Heck, now that I say that, it would be awesome if I could set up that Kitchen Lights switch-on trigger with an condition/dependency of something like “daily for the first time”…

Is such a thing possible? That would actually negate the need for my other 2 existing conditions.

Thank you for your response!


#4

I believe you could create that, if I’m right you would need to create a variable of some kind that changes to 'true the first time you trigger it and then from there you can say…

IF motion
AND (global variable) is false

I’m not 100% sure if that would work but it would be my first thing to try.


#5

Awesome - I will play around with something along those lines as soon as I can. Thank you for your help!!

I’ll update (hopefully close!) this thread when I get there. Thanks again.


#6

No worries, if you need anymore help let me know and I’ll do my best :):grinning:


#7

Give this one a shot.

A few notes:
I changed your 3 triggers to conditions. Reason for this is the likelihood of all 3 triggers being true at the same time is very slim… in fact it may never happen. By making these conditions, WebCoRE will ‘subscribe’ to the 3 devices and automatically trigger when a change in state occurs for any of them. With this version, when the last dimmer is switched ‘on’, the clause will evaluate ‘true’.

Removed the ‘if switch is not on’ from your IF statement. You can set this in the “do” portion by selecting “value - off” from the “Only if switch is” menu. NOTE: WebCoRE will automatically skip commands that will not result in a change in state, so in this instance the clauses are not necessary at all. If you turn on full logging, you’ll see “execution skipped because it would make no difference in [device]'s state” on occasion.


#8

This below will turn lights on at a specific time. I also threw in a “last day” variable I use to make sure something only fires once per day. Not necessary in this since it’ll never be 7am more than once, but hopefully you can see how it works and figure out how it could apply to other conditions/pistons.


#9

These are both great examples - very helpful - thank you very much!!


#10

Glad to help! I’m only about 2 weeks into this myself, so all the newbie questions, frustrations, and feeling overwhelmed are fresh on my mind. I know where you’re coming from! lol

Cheers!


#11

Sweet, that sample with the $day variable was just what I needed - I used that in my piston, and it tested out great! And it’s wayyyy cleaner than anything I was envisioning when I first posted, so that’s a win.

Thank you @PoshMidget96 for steering me toward variables, and thank you @michicago for providing the example that helped me seal the deal!


#12

You’re welcome, I’m still very new to all this, and this community has already helped me a lot, so I’m more than happy to offer some help back.