Code to override a rule if switch is pressed

Hey everyone,

I’m still pretty green when it comes to the rule engine. I wonder if anyone can suggest a code approach such that if a light dimmer/switch is pressed (on, off, etc), the press will override (or take precedence over) a rule execution.

For example, I have motion actuation that sets the level of the living room can lights. After a motion sensor trigger, the rule ive made has “if” blocks that set the level on a Lutron Caseta in-wall dimmer depending on what time of day it is. At night, my wife likes to turn these lights on while she’s reading, but when she’s not reading, I’d like the rule to execute as normal.

I am attaching the available attributes for the Lutron dimmer. None of them — to my knowledge — monitors a button press.

Any suggestions? TIA!

1 Like

Hi my friend, Im not 100% if I get it, but a logic like this could help you:

  1. Virtual “Read_Time_Switch”
  2. A rule: “Trigger: Read_Time_Switch switch ON, Action: Dimme Scene 1”
  3. In the rule: “Trigger Motion_Sensor: switch ON, IF Read_Time_Switch is OFF then Dimme Scene 2…etc”

The only issue is after reading time Read_Time_Switch has to be off.

Hope this help.

The switch is always going to turn on with a normal switch/dimmer. I remember lutron offering buttons / keypads too, but I’m not sure how they work. I think you get more options in Hubitat with them than SmartThings if I remember correctly.

Maybe there’s another button type device out there that could do what you want. Otherwise you’ll have to deal with the light coming on and then getting adjusted with a normal switch.