Open door and set light level


#1

1) Give a description of the problem
Trying to figure how to write a piston that would set light level when detecting a door open and turning light off when the door is closed. I can do that just fine, but the but the issue is: I am not sure how to create the piston so that the “light off” does not trigger if the light is already on (i.e. turned on manually). How do i check if the light was turned on by automation or manually before attempting to turn it off?

In addition, is there a way to reset the level of the dimmer without turning it it on? The dimmer seems to remember the last dimmer setting and when turned manually (after automation had set it to lest say 10%) it turns on to that last dimmer setting.

2) What is the expected behavior?

between sunset and sunrise and if the dimmer is not already on
Door opens and the dimmer goes on to 10%
Door closes and after 60 seconds light goes out

but …

I already have it figured out how to prevent automation from running if the light is already on, but how do I prevent it from running (i.e. turning light off) after the door is closed but the light was not turned on using the automation?

It kind of have it working by checking the dimer level and if it is not at 105 automation sets it to 10%) the automation will not run. I do not like it

Not sure if there is a better way.

3) What is happening/not happening?

It kind of have it working by checking the dimer level and if it is not at 10% (automation sets it to 10%) the automation will not run, but I do not like it

Not sure if there is a better way.

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


#2

I am not 100% clear on what you want to accomplish?
When variations need to change things, using a variable can be the best way to do…
Can you please explain step by step what you want to accomplish A TO Z

Just like this one:
Door opens and the dimmer goes on to 10%
Door closes and after 60 seconds light goes out


#3

Scenario 1:

Foyer light dimmer is in the off position

  1. Door opens, triggering the sensor
  2. Foyer light dimmer is turned on at 10%
  3. Door closes, triggering the sensor
  4. Foyer light dimmer is turned off

Scenario 2:

Foyer light dimmer is in the on position

  1. Door opens, triggering the sensor
  2. Since light is already on, nothing happens
  3. Door closes, triggering the sensor
  4. Since the Foyer light dimmer was already on prior to the door opening and closing, nothing should happen

Is there a way to set the dimmer level in the piston without actually having the light go on? See the use case below.

Scenario 3:

  1. Foyer light dimer is manual tuned on at 100% level
  2. Foyer light dimer is manual tuned off
  3. Foyer light dimmer is in the off position
  4. Door opens, triggering the sensor
  5. Foyer light dimmer is turned on at 10%
  6. Door closes, triggering the sensor
  7. Foyer light dimmer is turned off
  8. Foyer light dimer is manual tuned on and it defaults to the last setting of 10% - (is there a way to reset the level back to 100% as part of the last “off” procedure performed by the piston)

Hope this clarifies things.

Thank you.

Norm


#4

With most bulbs, the answer is no. Setting a level will turn on a bulb. But, there is at least one brand (using a specific Device Handler) that allow for this.


Yes, your final commands would be:

Set level to (whatever)
Turn off

This sets up the level for the next turn on


As far as how to act differently if the light was on or off when the door opens, I would use the logic found in this great thread.


#5

Thanks, while it does set the level up for the next time, it also makes the light go up to full brightness before it is turned off.


#6

There is no programming for full brightness here, so it must be another piston or SmartApp that is doing that.


#7

So with some help from WCmore (Thanks!) I got the piston working doing want I want (i.e. having knowledge of automation vs manual). Now the automation does not interfere with when lights are turned on manually (see piston bellow). The resetting of the dimmer level is still TBD, but looks like it may not be doable.

Thanks again for all the help