Smart Dimmer: A dimmer for everyone

Hi, I would like to share with you my new blueprint. It allows to use any button to turn on/off and dimm a group of lights.

Note: Dimming non-Zigbee devices has known issues. ZHA lights works perfectly

(ZHA lights needs to implement the Zigbee Light Link standard, as I’m sending raw commands to them)

Incorporation URL: https://gist.github.com/notherealmarco/6ce63099a744cf7da3ce3d3f552f9b3d

This Blueprint provides a script for every group of light you want to control with a button. Then you can use automations (or another blueprint) to map the button to the script. (see below)

You can choose the action by passing a variable to the script.

Supported dimming algorithms

Timestamp: this algorithm should be used only if the lights are not ZHA devices compatible with the Zigbee Light Link standard.
When you call the dimmming function (e.g. you hold down a button), the lights starts dimming to the highest/lowest brightness level with a 3s transition. When the button is released, the a new brightness will be calculated based on the time (in microseconds) the button has been pressed and sent to the lamp.

This algorithm has a known issue: sometimes the lights jumps to a completely different brightness when the button is released (I’m still investigating why).

ZHA ZLL: this algoritm is optimized for Zigbee devices, when the button is released, a special Zigbee raw command is sent to the light, which stops the transition and answers with the current brightness.
This command is not natively supported by Home Assistant, so I need to send a raw message, that’s why I need the IEEE address.

ZHA Group: same as ZHA ZLL but for Zigbee groups (native Zigbee groups managed through the ZHA integration, doesn’t work with software defined groups like the light_group component).

Note: You may need to click on “reconfigure device” (ZHA device page) if the light doesn’t push back it’s current brightness

Configuration

Input Value Notes
Light All the lights you want to turn on/off and dimm At least one entity is needed, do not add only areas or devices
Dimmer helper (input_boolean) An input_boolean helper You can use the same entity for every instance of this blueprint
Dimmer helper (input_text) An input_text helper You can use the same entity for every instance of this blueprint
Dimming mode The algorithm to use, see above Timestamp may be unstable for now, I need to find a way to address the issue
IEEE or Group ID Light’s Zigbee IEEE address if you selected “ZHA ZLL light” as dimming mode, Zigbee group ID if you selected “ZHA Group” This value doesn’t matter if you’re using Timestamp

Usage

Once you created an instance of the blueprint, you can start adding automations for your buttons:

If you have a blueprint for your button which support custom actions, use it! Otherwise you can manually create the automations.

When a button is pressed once, add an action, edit the action as yaml and paste:

service: script.<your_script_entity_id>
data:
  action: toggle

Note: <your_script_entity_id> needs to be replaced with the entity_id of the script you previously created with this blueprint.

On the button hold event, add:

service: script.<your_script_entity_id>
data:
  action: dimm_auto

On the button hold release event, add:

service: script.<your_script_entity_id>
data:
  action: stop

If your remote has separate buttons to dimm up / down the light, you can use the dimm_up and dimm_down actions, and the short_up and short_down actions for short presses.

Known working blueprints for remotes

Please, let me know down below if you find any working blueprint for your remote

IKEA E1743: (the one with two buttons) for this remote, you can directly use the all-in-one blueprint: https://gist.github.com/notherealmarco/6c7313e0411341d9dd6be40162dd67a9

(Alternative) IKEA E1743: https://github.com/EPMatt/awesome-ha-blueprints/blob/485b52c48bd7429dab7e45ced331920a57ea1363/blueprints/controllers/ikea_e1743/ikea_e1743.yaml

IKEA E1524/E1810: (the one with five buttons) https://github.com/EPMatt/awesome-ha-blueprints/blob/485b52c48bd7429dab7e45ced331920a57ea1363/blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml

Xiaomi WXKG01LM: (the round Mijia one) https://gist.github.com/notherealmarco/9b7218264f40ff934119870d57b2b21b

Blueprint code

Check the incorporation link above

4 Likes

I’m new to Home Assistant & am looking for a way to make my dimmable RF lights act as a dimmable light. This looks promising, but the instructions seem to be designed only for those who already know what they are doing… Which sadly isn’t me yet.

  • Settings > Devices & Services > Helpers
  • + Add Helper > Toggle
  • Name: Dimmer helper (It sounds like you might need the name to be this, I don’t believe that is the case as revealed later)
  • Settings > Devices & Services > Helpers
  • + Add Helper > Text
  • Name: Dimmer helper (It sounds like you might need the name to be this, I don’t believe that is the case as revealed later)
  • I assume I can leave every other field default as you gave no other information
  • I know I want to use Timestamp: but thisgives me no idea what I’m supposed to do with that? Do I have to create something or just have decided which I’m going to use? Later I discovered this is an option setting when creating the script.

AND once you have created the Dimmer Helpers

This is where I’m confused… Again… I downloaded the smart_dimmer.yaml from the Github you linked… do you mean that? Do you mean something else entirely?

  • I went into Settings > Automations & Scenes > Blueprints
  • There I have + Import Blueprint-ed the link to the blueprint from the Github
  • Next I clicked Create Script next to the Blueprint I just imported
  • Give it a Name
  • Give it an Icon
  • Blueprint to use: Smart Dimmer
  • Light: choose lights, at least 1 needs to be an entity
  • Dimmer helper (input_boolean): Just using the 1 I created earlier, hopefully it’s setup correctly
  • Dimmer helper (input_text): Same as above
  • Light 1 dimming mode: This is where that choice earlier comes into play

Where & how do I do this?
I never added the dimming functions, how do I add this? where do I add this?

Thank you very much for your script! I ran into a small problem with a hue bulb. It starts dimming up or down, but it doesn’t respond on the stop function. What is going wrong?

Edit: It looks like the zigbee endpoint ID 1 is not correct for Philips Hue lights which has endpoint ID 11?

Thank you very much for your script.
I tried to use it with deconz and it didn’t work.
Has anyone used it successfully with deconz?

Thanks!

Hi there,

I found a solution for that:
The script is used together with the Blueprint for the IKEA Shortcut Button (Controller - IKEA E1812 TRÅDFRI Shortcut button | Awesome HA Blueprints) and the dimming mode “timestamp”

The action for short press and long press worked already ootb with the skript.
To stop the dimming I didn’t use the script with the stop-action, instead I call the deconz.configure service:
For me this worked out:

service: deconz.configure
data:
  entity: light.buro
  field: /action
  data:
    bri_inc: 0
    transitiontime: 0

That stopped the dimming process.

1 Like

Thanks you for the contribution!

This blueprint was not meant to be used with deCONZ, but I’ll surely include it in the documentation, as it might help other people.

That’s possible, I should add an “advanced” parameter to let users change the endpoint.
I tested it only with some ZLL-compliant bulbs and they always had endpoint ID 1.

Thanks!

I am super happy with this blueprint!! :slight_smile: , but there is one thing I would like to see (preferably) differently.

The lights do not go fluently from one state to another state (not smooth/no transition time).
So, it’s more like a flickering lights when the lux values changes, especially during the winter and autumn.

Is this something that can be added to this blueprint (not using additional scripts and so on/no added complexity)?

Hello! I am using the version you have on github with support for zigbee2MQTT. The dimming works, there are some issues. I have a dimmer that supports brightness_move. 1st, the dimming is WAY to fast, can it be slowed down with a variable?
2nd, the input helpers, what are they for? Is it for storing the light levels? I am not sure they work correctly, because sometimes it seems like it doesn’t remember what current value is on
3rd, since Z2M uses brightness_move, are you only using “brightness_move”:0 to stop, or are you also using “brightness_move”:40 f.ex. and “brightness_move”:-40 to dim lights up and down, can’t see in your code you are dimming this way with Z2M, only to stop the dimming. Is this correct?

EDIT:
Okay, I fiddled around a bit with mqtt publish and I found out a sweetspot for Zigbee2MQTT dimming is {“brightness_move”: 50/-50}
Above or below seems to be quite troublesome. So I think you should update your blueprint for Z2M dimming, so that the dimming happens with the brightness_move for up and down, not just stop.

Also, the toggling of a light turns the light on at 50% as default. Instead of just toggling you should create a scene right before the lights turns off, and then just recall that scene when toggling on again.