Enforce A Scene


#1

1) Give a description of the problem
I am trying to make a piston that enforces the state of the light switches. For example if the light is on and then someone switches it off, the piston will turn the light back on. Now I have some lights set to off and some set to on. Also the lights are following a routine so they keep switching, therefore I set the piston to only toggle the switch if there’s physical interaction.

2) What is the expected behavior?
Keep the lights that are supposed to be on, on and if they’re supposed to be off, then off.

3) What is happening/not happening?
It keeps toggling on and off

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)

Not letting me put the log in because it has more than 2 links and I’m a new user


#2

A few things to keep in mind:

Many (most) bulbs do not report a difference between physical and programmatic interaction. You might get lucky, but it is usually better to program “Any interaction” and not rely on a physical…


This can be done, but if anything flips that light off, webCoRE will immediately turn the light on.
(I normally do not recommend this forced logic)

If you decide to do it anyway, you should first check all other controls, and make sure there are no automations anywhere controlling that bulb. (Philips Hue, SmartThings, Alexa, Google Home, Apps on our phone, IFTTT & Routines, (just to name a few)). If you create this piston, then none of these can be programmed on that switch. (or you will likely create an infinite loop with your bulb)

Depending on the loop, you might have to pull the power plug on your ST hub to stop your lights from flashing 40 times a second.


Perhaps a ‘safer’ method is working backwards like this:

temp

(This sample piston can also get stuck in a loop, but it is not going to drive you crazy when it happens, and it should be easier to break out of)


#3

I have these switches on routines so the only way this will work is if I set the piston to match what the routine for that time is set to?


#4

Feel free to experiment, but personally, I would do one of the following:
(my preferred choice at the top)

  • Avoid turning a smart bulb into a stubborn one.
    or
  • Disable ALL automations on that switch except for one piston

If you do not choose either of my suggestions, it will require a lot of preliminary thinking & extensive testing to get everything working in sync…
(I am not responsible for any grey hair you may get, LOL)


#5

So you’re saying I should use a piston instead of the routine and include this enforce feature as part of the piston?


#6

I think in time, you will come to hate the enforce aspect, but if you still want to go thru with it, then “Yes”… Use one piston instead of Routines/Scenes/IFTTT/etc. (nothing else should control that switch except one piston)

Gradually, as I learned the power of webCoRE, I have moved all my Routines & Scenes into webCoRE, and let it handle all the heavy lifting and logic. I have absolutely NO regrets.


NOTE
If you are new to webCoRE, this enforcement will likely frustrate you, and may potentially scare you off from webCORE. Would you be willing to share a real life example of why you WANT to enforce this?


#7

I want to use it for the Sabbath. I have a couple of scenes that run based on the time of the day but since we can’t turn on/off the lights, I want that if by accident someone hits a switch, it’ll go back to what it is supposed to be at the time.


#8

Well, a simple solution could be based on my earlier suggestion:

temp

This still allows for human interactions (as well as automatic commands), yet the bulb will revert back to on after a period of time.


Food for thought :
Most people approach this in the opposite direction. Such as:

Program the Routine/Scene you want (lights, colors, fans, etc) in webCoRE, and let webCoRE keep that scene active UNLESS the override switch is on.
(you’ll have infinite more control and options if the brainwork is left to webCoRE)


#9

How would I set up the piston that webCoRE should keep the scene active?


#10

Sorry, I was vague…

What I meant is, let all the logic be in a piston (times, day of week, etc) and let webCoRE control the lights etc. (in other words, re-create the scene in webCoRE, and disable your current Routine)


#11

Yeh working on that but is there a way to set the piston that if the status of a switch is not what it is set to be in the piston it will correct it?


#12

At your request, but please use with EXTREME caution!!

temp


For anyone else reading this, please do not ever do this…
(you are safer using my earlier example and/or tips)


#13

Do you think this will work?


#14

Thank you. That helped me to visualize your setup…

I imported your piston, and made a handful of changes that should help…

  • moved your last two IFs outside the ELSE
  • added a variable to make sure this only runs a few hours a week
  • added a 5 second delay for the off command (small peace of mind)
  • tidied up your weekly timer section.
  • added a few comments to help you see what is happening
  • added LOG commands so you can see the infractions later

Hopefully this does what you need:


EDIT :
To prevent a loop, you will still have to make sure your other pistons/routines/scenes do not try to control Dimmer 3 and White Bulb 1 during the last 5 hours on Fridays…
(to clarify, they can likely control the color & brightness levels, but should not touch the on or off switch)


#15

Oh wow this is amazing. I have a bunch of switches that I have on this routine. I added them in, does it look ok?


#16

Also can I have multiple pistons with the same “sceneActive” definition?


#17

At the moment, I am not near a computer to examine your latest piston, but local variables are on a per-piston basis. (meaning each piston can only see the variables contained within)

If there is any overlapping times in the same piston, you can always make additional variables.


#18

Holy Smokes!?!

Remember all my warnings about loops on one bulb?
Well, you can multiply those warnings 22 times with your latest piston!

I think we need to reevaluate and approach this differently.

I have an idea in my head, but I should probably ask you a few questions first:

  1. Are those 22 Dimmers actually Simulated Switches? (if not, what are they?)
  2. Do you have a piston monitoring each one of those switches?
  3. Does pushing any one of those tell webCoRE to turn on a different Routine?
  4. Is Friday evening the only time you want to ignore the other 22 switches?
  5. Can you please describe what happens when you execute the “Friday Evening” routine?

#19
  1. Are those 22 Dimmers actually Simulated Switches? (if not, what are they?) What do you mean? Are they fake or real? They’re real in wall GE dimmer switches (so are regular on/off)
  2. Do you have a piston monitoring each one of those switches? I only have 4 pistons for each of the 4 scences I’m trying to enforce
  3. Does pushing any one of those tell webCoRE to turn on a different Routine? No
  4. Is Friday evening the only time you want to ignore the other 22 switches? Ignore?
  5. Can you please describe what happens when you execute the “Friday Evening” routine? It sets a specific scene