Legacy Zigbee2MQTT Lutron Aurora Dimmer Control

First, huge shout out to drinfernoo. I used their original blueprint and the comments by other community members to debug this blueprint and figure out how to make it work.

This blueprint allows you to control any dimmable light using a Lutron Aurora dimmer knob, integrated via Zigbee2MQTT. Drinfernoo’s blueprint did not work for me, and after a lot of debugging I discovered that my version of zigbee2mqtt was not sending the same mqtt payload as drinfernoo. There seems to be some inconsistencies across the user base, which may be related to the version of HA/mqtt/zigbee2mqtt being run.

I will do my best to reply to posts and if my blueprint does not work for you I encourage you to try drinfernoo’s. If this works for you, let me know your system setup (HA Core|Mosquito Broker|zigbee2mqtt)! I am more interested than anything, but it might let me predict future breaks.

Requirements:

  • Set the aura legacy payload to true
  • Must select the “Brightness” entity not the “Action” entity during setup
  • Dimmable Lights

Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Legacy Zigbee2MQTT Lutron Aurora Dimmer Control
  description: Control any light with the Lutron Aurora remote, integrated by Zigbee2MQTT.
  domain: automation
  input:
    aurora:
      name: Aurora
      description:
        The Lutron Aurora you wish to use to control this light. Use of
        If you have two entity's shown, the 'brightness' entity is the correct one.
      selector:
        entity:
          integration: mqtt
          domain: sensor
          multiple: false
    light:
      name: Light
      description: The light you wish to be affected. Make sure it is a dimmible light
      selector:
        target:
          entity:
            domain: light

mode: queued
max_exceeded: silent

trigger:
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input aurora
  - platform: state
    entity_id: !input aurora


action:
  - service: light.turn_on
    target: !input light
    data:
      transition: "{{ 0.7 }}"
      brightness: '{{ trigger.to_state.state }}'
1 Like

Just wanted to let you know that your blueprint worked perfectly for me. Thank you so much for your efforts! As far as my versions of HA, Z2M, and MQTT, I’m running home assistant 2022.8.7, and the latest stable versions of Z2M and MQTT available as Home Assistant Add-ons. Hopefully this info helps others, and possibly clear up why the payloads differ so dramatically from user to user.

Cheers.

Thanks for looking into this, but now i’m having other issues.
The Aurora brightness entity in z2m is always on 117, the action entity changes state for a brief moment and then dissapears, the logs show:

Zigbee2MQTT:info 2022-08-29 10:21:21: MQTT publish: topic ‘zigbee2mqtt/Living Room Dimmer’, payload ‘{“action”:“brightness_move_to_level”,“action_level”:2,“action_transition_time”:0.02,“brightness”:117,“linkquality”:114,“update”:{“state”:“available”},“update_available”:null}’

And the automation fails with:

“Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘to_state’”

Can you please help?

Are your Auroras set to legacy = True?
I ask because that payload looks like the non-legacy payload.

I know I saw your post on drinfernos blueprint, its weird that drinfernos blueprint did not work with you since your payload looks like the dict payload vs the state payload.

Glad its working for you! I am still working on some “finishing touches” after using it around the house for the last week. Hopefully will have an update shortly to make operation more smooth.

That did the trick, changing it to legacy started updating the brightness entity. Thanks!

Hi! I just switched to Zigbee2MQTT and am using this blueprint. I have the Aurora set to Legacy and all the controls are working. However every time I use it (on/on/dim) I get three errore in my logs:

Template variable error: 'dict object' has no attribute 'to_state' when rendering '{{ trigger.to_state.state }}'

Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'

Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'

Any idea why this is happening?
Thank you!

Hi!
I found the issue. The error happened when the event triggered the automation, because events don’t have a state. I removed that trigger and now it seems to be working without the errors in the logs. The state of the brightness entity changes whenever the dimmer is used and will trigger the automation.

1 Like

This was the first solution that enabled my Lutron Aurora dimmers to control my dimmable Philips Hue lights with Zigbee2MQTT, so thank you. However, I noticed that after a HA restart, several of my lights (but not all of them) were triggered to turn on by this Blueprint automation. Why would that be, and is there a solution for this?

Thanks for posting this. This worked out of the box, but I was having weird issue where sometimes the click would not work and it had to be clicked a second time. I removed that event and it fixed the issue.

This worked out of the box for me too, but I am also noticing the click doesn’t always work. The odd thing is when I am looking at MQTT Explorer the failed clicks don’t show up on the bus, which seems less about the blueprint and more about the Aurora not sending the signal (?) but anyway, I’m interested in understanding better what you mean by “you removed that event”. Would you mind elaborating?

Thank you,
Lawrence.

As much as I hated to do it, this Blueprint forced me to finally move my 40+ devices from ZFA over to Zigbee2MQTT. And the blueprint works flawlessly! Thank you so much! Well worth it!

In case someone else is searching for the same issue I had, here is the issue and fix I’m using.

I had 1 dimmer that would randomly trigger. Unfortunately, it was my bedroom light dimmer, and it would trigger in the middle of the night. Lights at 100% is not conducive to sleep.

I found that there was a change in the action that was getting triggered. The action would change from an empty string to null. I don’t know why it was happening. It seemed to happen if the dimmer was used to turn on the lights, but another automation, or in my case Alexa, turned them off. 2-4 hours later, the value changed.

So I’ve made 2 changes. The first is removing this block from the trigger section.

  - platform: event
    event_type: state_changed
    event_data:
      entity_id: !input aurora

This fixed the errors that I was seeing in the traces that made it hard to otherwise troubleshoot.

Second, I added a condition on the action to only accept “brightness”. Here is my trigger now:

trigger:
- platform: state
  entity_id: !input aurora
condition:
- condition: template
  value_template: '{{ trigger.to_state.attributes.action == "brightness" }}'
action:
- service: light.turn_on
  target: !input light
  data:
    transition: '{{ 0.7 }}'
    brightness: '{{ trigger.to_state.state }}'

Hi

I’m trying to use this alongside the adaptive lighting integration. Ideally, when the button is pressed I’d like it to grab the current attributes from adaptive lighting while turning the dial right from an off state starts at the low end of brightness as usual.

Has anyone happened to already figure out how to configure this? I’ve spent some time using trying to work out a separate automation in the GUI but seems I’m not versed enough to nail down a good trigger.

Edit: I’ve gotten a rough implementation. I’m using the trigger if one of the lights is turned on then the condition the light has the numeric state of the attribute “Brightness” greater than 254. Since the button sets the lights to 255 from the off state that registers the right times. Then I have the automation call service: apply adaptive lighting then set manual control to false.
There’s a slight delay where the lights flash to full brightness first which is not ideal but that’s as far as I’ve gotten.

The issue I’ve had related to these dimmer switches is their value (0-255 for brightness) on the dimmer doesn’t change when issue commands from anything other than physical interaction.

If my lights are on at 100% from the dimmer switch, and turned off via HA or various voice assistants, slowing rotating as if to brighten from 0% slowly will cause the brightness of 255 to remain.

There may be a way to set the value to 0 when the bulbs are otherwise turned off, but I have not tried.
Now… I have to try as that is a small glitch in my system. I’ll report what I find.

Maybe try using (a couple of?) automation to keep the brightness values on Aurora dimmer and on the smart bulb in sync.

My 2 cents.
I have a way, but this requires a zigbee bulb, and the said bulb would have to have zigbee binding support. So not for everyone / not for every use cases.

The way I handle this is that I would let adaptive lighting to control the bulb directly. I believe adaptive lighting these days can put the bulb directly to the desired brightness upon turning on - whether you turn on by HA or by dimmer.
So for this (also zigbee) Aurora dimmer, I would just bind it directly to the zigbee bulb, so that the bulb would turn on / off / increase brightness / decrease brightness based on the Aurora dimmer.

Yes the brightness value of the Aurora dimmer and the bulb will be out of sync, and that’s fine - I’m not using the brightness value from the dimmer for anything - I’d just focus on the brightness of the bulb if I/when need to do anything.

(BTW I also have an automation to disable adaptive lighting on the bulb for 1 hour, if there is any manual brightness control. But that’s another story / off-topic.)

I attempted this with using MQTT publish. I can see that Zigbee2MQTT saw the message, but it fails.

When I looked further, here. The brightness value isn’t writable. It sends signals, but since it is battery powered, it doesn’t receive with initiating the transaction.

Update to this, I’ve gotten a lot closer this weekend it just took some outside steps. Only thing I haven’t worked out is how to prevent the light turning all the way off when turning the dial to the left.

I first had to disable legacy mode to get the more robust mqtt payload which helped with recognizing button presses (attribute action_transition_time 0.07 for presses, 0.02 for turns).

Next, made an mqtt sensor that captures the payload action_level to read the current brightness on the dial and a template sensor to get the difference of the from.state and to.state of the mqtt sensor so I have positive or negative values to feed in.

mqtt:
  - sensor:
    - name: "mqtt_sensor"                                           
      unique_id: "uniqueID"
      state_topic: "zigbee2mqtt/Dining light switch"  
      value_template: "{{ value_json.action_level }}"
      json_attributes_topic: "zigbee2mqtt/Dining light switch"
      json_attributes_template: "{{ value_json | tojson }}"

template:
  - trigger:
      - platform: state
        entity_id: sensor.mqtt_sensor
    sensor:
      - name: "mqtt_sensor_difference"
        unique_id: "uniqueID2"
        state: "{{ (trigger.to_state.state | float(0) - trigger.from_state.state | float(0)) | round(2) }}"

Then, to put it all together I have the automation trigger on mqtt message received, set a variable for the current light brightness, and conditionally if the action_transition_time is 0.07 turn on adaptive lighting for that light then toggle to the current adaptive lighting values. If the action_transition_time doesn’t match then the automation turns off adaptive lighting for the light (if on) and turns the light up or down by an arbitrary amount from the current light brightness variable captured at the start depending on the positive or negative value of the template sensor.

End result turns up on any right turn and down on any left turn as well as toggles power regardless of the dials current state besides respecting the adaptive lighting automation.
I don’t think this qualifies as something you’d want/could make a blueprint for since it’s dependent on making sensors in the configuration but if it’s useful to anyone else, here is what the final automation looks like

alias: TV Room Dial
description: ""
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/Dining light switch
condition: []
action:
  - variables:
      current_level: "{{ state_attr('light.yourlight', 'brightness')|int(0) }}"
  - if:
      - condition: or
        conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.action_transition_time == 0.07 }}"
          - condition: template
            value_template: "{{ trigger.payload_json.action_level == 0 }}"
    then:
      - service: adaptive_lighting.set_manual_control
        data:
          manual_control: false
          lights:
            - light.yourlight
          entity_id: switch.adaptive_lighting_your_adapt
      - service: switch.turn_on
        target:
          entity_id: switch.adaptive_lighting_your_adapt
        data: {}
        enabled: true
      - service: light.toggle
        target:
          entity_id: light.yourlight
        data:
          transition: "{{ 0.7 }}"
          kelvin: >-
            {{ state_attr('switch.adaptive_lighting_your_adapt',
            'color_temp_kelvin') | int(2500) }}
          brightness_pct: >-
            {{ state_attr('switch.adaptive_lighting_your_adapt', 'brightness_pct')
            | int(3) }}
      - stop: ""
    else:
      - service: adaptive_lighting.set_manual_control
        data:
          manual_control: true
          lights:
            - light.tv_room_lights
          entity_id: switch.adaptive_lighting_your_adapt
      - if:
          - condition: state
            entity_id: switch.adaptive_lighting_your_adapt
            state: "on"
        then:
          - service: switch.turn_off
            target:
              entity_id: switch.adaptive_lighting_your_adapt
            data: {}
        enabled: true
      - choose:
          - conditions:
              - condition: or
                conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action_level == 2 }}"
                  - condition: numeric_state
                    entity_id: sensor.mqtt_sensor_difference
                    below: 0
            sequence:
              - service: light.turn_on
                metadata: {}
                data:
                  brightness: "{{ current_level|int - 45 }}"
                target:
                  entity_id: light.yourlight
          - conditions:
              - condition: or
                conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action_level == 255 }}"
                  - condition: numeric_state
                    entity_id: sensor.mqtt_sensor_difference
                    above: 0
            sequence:
              - service: light.turn_on
                metadata: {}
                data:
                  brightness: "{{ current_level|int + 45 }}"
                target:
                  entity_id: light.yourlight
mode: restart