Incorporation URL: https://gist.github.com/bstenborg/1731775b26541d607584aea102d53236#file-smart_dimmer-yaml
This Blueprint creates 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)
It works by providing functions for toggling and dimming the group.
Timestamp: this mode 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 mode has a known issue: sometimes the lights jumps to a completely different brightness when the button is released.
ZHA ZLL: this mode 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).
Zigbee2MQTT: If using Zigbee2MQTT instead of ZHA. Only works with lights that support the brightness_move
command.
Note: You may need to click on "reconfigure device" (ZHA device page) if the light doesn't push back it's current brightness
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" or "Zigbee2MQTT" as dimming mode, Zigbee group ID if you selected "ZHA Group" (GROUP IDs IN DECIMAL NOTATION) | This value doesn't matter if you're using Timestamp |
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.
Please, let me know down below if you find any working blueprint for your remote
IKEA E1743: for this remote, you can directly use the all-in-one blueprint: https://gist.github.com/notherealmarco/6c7313e0411341d9dd6be40162dd67a9
(Alternative) IKEA E1743: (the one with two buttons) https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/ikea_e1743/ikea_e1743.yaml
IKEA E1524/E1810: (the one with five buttons) https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml
Xiaomi WXKG01LM: (the round Mijia one) https://gist.github.com/notherealmarco/9b7218264f40ff934119870d57b2b21b
@notherealmarco These kind of blueprints have been flaky at best, but this is the best variant of a toggle that I've found, well done! The only thing not working for me is the stop event. It does not seem to stop the dimming progress when releasing the button.
The ZHA event that is fired when releasing after long press is "stop_with_on_off", but I'm not sure what the config should be for the ZHA event response that you are sending from the script. I see that you send a
command: 3
, not sure if I need to change that to "stop_with_on_off" or something else?And this is towards a group of lights that I have created inside the ZHA interface