Automation: How to "dim up" Lutron Caseta light upon trigger

I’m no expert; just savvy enough to tinker with gadgets and pick up gems from this forum as needed. I’ve built a device comprising a plastic box plugged into a wall outlet, housing a 5v DC converter, two motion sensors, and a Wemos D1 Mini. One motion sensor is directed across the threshold of the dining room door, so it captures motion as soon as I enter. The other sensor captures motion in the entire room, with an adjustable delay (HC-SR501). FYI for anyone trying to build something similar, I’d advise shielding the motion sensors within the box by using some foil (enclosed well inside a layer of tape, so you don’t short anything).

My issue:

My automation turns on the chandelier to 50% as I enter, as shown below. However, the light goes from 0 to 50% in an instant. How I can slowly “dim” the lights up to 50%? It’s a Lutron Caseta dimmer, which automatically dims the lights down to 0% nicely when turned off. I’d like the same effect (with respect to the speed of the action) when turning the light on via the automation.

- id: '1615507202487'
  alias: 'Lights On with Motion: Dining Room'
  description: ''
  trigger:
  - platform: state
    to: 'on'
    entity_id: binary_sensor.dining_room_door
  condition:
  - condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: disarmed
  action:
  - type: turn_on
    device_id: [Lutron Caseta Device ID]
    entity_id: light.dining_room_chandelier
    domain: light
    brightness_pct: 50
  - wait_for_trigger:
    - platform: state
      from: 'on'
      to: 'off'
      for: 00:00:15
      entity_id: binary_sensor.dining_room_room
  - type: turn_off
    device_id: [Lutron Caseta Device ID]
    entity_id: light.dining_room_chandelier
    domain: light
  mode: single

Via which integration does that Lutron Caseta work? I can find the brand but not the dimmer. But there is the transition parameter to a turn on call. But the device does need to support this to work.

I initially used the Lutron Caseta Add-On (available in Supervisor > Add Ons), but as of a couple of months ago the integration is built into core. I’ve integrated it this new way and removed the old Add On instance. Lutron Caseta devices are commanded by a Lutron Caseta Smart Bridge, which is integrated into HA. Any commands from HA are sent to the wall switches via the Smart Bridge.

Edit: to be clear, if I press the “on” button on the wall-mounted dimmer switch in my dining room, the light “dims up”. It is the dimmer’s natural way of turning on and off, to dim up and down as such. It is only when the automation turns on the dimmer that it goes from 0 to 50% in an instant. …I want the dimmer to behave naturally.

Have you tried using the transition option?

transition
Number that represents the time (in seconds) the light should take to transition to the new state.

From the documentation for Lutron Caseta:

Available services: light.turn_on, light.turn_off and light.toggle. The light.turn_on service supports attributes brightness, brightness_pct and transition.

For example, turn on to 50% brightness over a period of 4 seconds.

  action:
  - service: light.turn_on
    target:
      entity_id: light.dining_room_chandelier
    data:
      brightness_pct: 50
      transition: 4
2 Likes

From the integration page you link:

So transition should work :slight_smile:

Thanks @123 and @septillion! That did it.

I created a scene with 50% brightness and called it in the automation with a three-second transition.

2 Likes

Glad to hear it worked and resolved the issue.

Please consider marking my post (above) with the Solution tag. Only one post in the thread can be the Solution post and only you, the topic’s author, can select it. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It will also put a link below your first post that leads to the solution post. All of this helps users find answers to similar questions.

In case anyone comes here looking for a solution for lights that don’t support transitions (my Sengled bulbs don’t) here is a system that fades the lights on over a ~9 minute span at around sunset or if it gets dark enough outside during the day.

It takes two automations to make the transitions work. You might be able to whittle it to one but I originally had the automation triggering on a one second interval so I could catch the second when the automation got turned on. But then I realized I could use the action of turning on the fade in automation to trigger it. But I never took the time to move it all to one automation.

  - alias: LC Deck Light On at Dusk
    trigger:
      - platform: state
        entity_id: sensor.dark_outside
        to: 'true'
      - platform: sun
        event: sunset
        offset: "+00:07:00"
    action:
      - service: automation.turn_on
        entity_id: automation.lc_deck_light_fade_on_at_dusk

  - alias: LC Deck Light Fade On at Dusk
    initial_state: 'off'
    trigger:
      # - platform: time_pattern
        # seconds: "/1"
      - platform: state
        entity_id: automation.lc_deck_light_fade_on_at_dusk
        to: 'on'
    action:
      - service: light.turn_on
        data:
          entity_id: light.deck_light_0a4c
          brightness: 5
      - repeat:
          sequence:
            - service: light.turn_on
              data:
                entity_id: light.deck_light_0a4c
                brightness: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int + 1 }}"
            - delay: 2
          until:
            condition: or
            conditions:
              - condition: template
                value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int >= 254 }}"
              - condition: state
                entity_id: light.deck_light_0a4c
                state: 'off'
      - service: automation.turn_off
        entity_id: automation.lc_deck_light_fade_on_at_dusk

If the light gets turned off by some other method during the transition then it gets reset and the transition automation stops running.

But if you reload your automations or restart HA during the time the transition automation is running it never gets retriggered. So the light gets stuck at that brightness.

So I added a couple more automations to handle that. If it’s not a big deal if the light ever reaches full brightness then you can ignore these.

  - alias: LC Deck Light Resume Fade On Control
    trigger:
      - platform: homeassistant
        event: start
      - platform: event
        event_type: automation_reloaded
    condition:
      - condition: state
        entity_id: light.deck_light_0a4c
        state: 'on'
      - condition: template
        value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int < 254 }}"
    action:
      - delay:
          seconds: 10
      - service: automation.turn_on
        entity_id: automation.lc_deck_light_resume_fade_on_at_dusk
        
  - alias: LC Deck Light Resume Fade On at Dusk
    initial_state: 'off'
    trigger:
      # - platform: time_pattern
        # seconds: "/1"
      - platform: state
        entity_id: automation.lc_deck_light_resume_fade_on_at_dusk
        to: 'on'
    action:
      - repeat:
          sequence:
            - service: light.turn_on
              data:
                entity_id: light.deck_light_0a4c
                brightness: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int + 1 }}"
            - delay: 2
          until:
            condition: or
            conditions:
              - condition: template
                value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int >= 254 }}"
              - condition: state
                entity_id: light.deck_light_0a4c
                state: 'off'
      - service: automation.turn_off
        entity_id: automation.lc_deck_light_resume_fade_on_at_dusk

You can asdjust the time span by changing the delay times and/or the step (in my case it’s + 1).

Hopefully it helps some future person.

I’ve compared this transition solution against another method: Without using a scene, simply call the Device (light.dining_room_chandelier) and set the Action to “Increase Brightness”. …and repeat this command within the automation until the desired brightness is achieved. In my test, there were five Device > Increase Brightness actions in immediate succession. The outcome was indeed a “dim up” effect, but it was very fast and was not the outcome I was seeking. ← FYI, in case someone is looking for a quick fix for a rather fast lighting transition.

Hi @123 I am so glad I found this. Lutron “dumb” Maestro dimmers can control the fade on and a separate fade off ramp for each individual switch and have been able to do this for at least 15 years. The Lutron integration with the Caseta line doesn’t have any such customizability so I am thrilled you found that transition works. :pray: So thank you.
I have a question… is it possible somehow to tie the transition speed for any defined Lutron dimmer to the actual on and off switch?
I am not smart enough to figure out templating or the like. I was thinking about having my Node-Red instance listen for the light press and then send the turn on or off command but add the transition speed.
Any ideas how I can do this?
Many thanks again

Sorry, I normally provide solutions for YAML-based automations not Node-Red. Hopefully, someone else can help you.

Does anyone know how to do this with the following YAML for light on with motion?

alias: Kitchen Lights
description: ''
use_blueprint:
  path: homeassistant/motion_light.yaml
  input:
    motion_entity: binary_sensor.kitchen_sensor_home_security_motion_detection
    light_target:
      device_id: 1db61fb43141736855c2a45c0dfe542c
    no_motion_wait: 120

I’d like to ramp up the light when it turns on to 100% with a 2 second ramp up