🎮 ZHA, deCONZ, Zigbee2MQTT - Ikea E1812 Shortcut button Universal blueprint - all actions + double click events - control lights, media players and more with Hooks

This blueprint is part of the Awesome HA Blueprints project.
Read more about it on the related Community Forum topic. :rocket:

Updates will be published on the project’s GitHub repository.

:arrow_down: Get Started

Option 1: My Home Assistant

Click the badge to import this Blueprint (needs Home Assistant Core 2021.3 or higher)

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

Option 2: Direct Link

Copy this link if you want to import the blueprint in your installation.

:link: Blueprint URL

:page_facing_up: Description

IKEA E1812 TRÅDFRI Shortcut button|200X200

This blueprint provides universal support for running any custom action when a button is pressed on the provided IKEA E1812 TRÅDFRI Shortcut button. Supports controllers integrated with deCONZ, ZHA, Zigbee2MQTT. Just specify the integration used to connect the remote to Home Assistant when setting up the automation, and the blueprint will take care of all the rest.

In addition of being able to provide custom actions for every kind of button press supported by the remote, the blueprint allows to loop the long press actions while the corresponding button is being held. Once released, the loop stops. This is useful when holding down a button should result in a continuous action (such as lowering the volume of a media player, or controlling a light brightness).

The blueprint also adds support for virtual double button press events, which are not exposed by the controller itself.

Automations created with this blueprint can be connected with one or more Hooks supported by this controller.
Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

:closed_book: Full Documentation

Full documentation regarding requirements, inputs and more is available here.

Docs provide all the information you need to properly configure this blueprint on your instance.

:electric_plug: Available Hooks

:bulb: Light

This Hook blueprint allows to build a controller-based automation to control a light. Supports brightness and color control both for white temperature and rgb lights.

Light Hook docs

:loud_sound: Media Player

This Hook blueprint allows to build a controller-based automation to control a media player. Supports volume setting, play/pause and track selection.

Media Player Hook docs

:door: Cover

This Hook blueprint allows to build a controller-based automation to control a cover. Supports opening, closing and tilting the cover.

Cover Hook docs

:information_source: Changelog

Updated list of changes and improvements is available here.

Happy automating to everyone! :fire:

2 Likes

Hello, if I press my shortcut button, zha_event ON is fired about 6x… how can I make this single press button have some timeout / debounce.

Hi @Mattx,

thank you for your feedback, we have to implement some sort of debounce in this blueprint, for ZHA.

To help solving this issue, It’d be extremely helpful if you could post here the list of events fired by the controller when clicking the button.

In your Home Assistant UI, navigate to Developer Tools -> Events. At the bottom of the page, in the “Listen to Events” form type zha_event, click on “Start Listening”, then press the shortcut button only once. Copy the events which appear on the page and paste them here (or as PM).

Thank you!

Hello @epmatt :wink:

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "68:0a:e2:ff:fe:fe:af:49",
        "unique_id": "68:0a:e2:ff:fe:fe:af:49:1:0x0006",
        "device_id": "6238485e169d73607f866212a354df03",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "on",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2021-03-19T08:32:44.305924+00:00",
    "context": {
        "id": "6695347e3c7bd3ea7d855ce65b2711dd",
        "parent_id": null,
        "user_id": null
    }
}

I am posting only one event, but 6 are fired with one click. On the second button I have, only 3 are fired. Maybe, there is also off_delay setting in ZHA cluster, but I did not test that.

Hi @MattX, thank you for reporting! :slight_smile:

Could you please post all the 6 events which gets fired on the single button press? I’m particularly interested in the time_fired attribute, which we’ll probably use for debouncing, but if you could post the whole list of events it would be great. :+1:

Maybe, there is also off_delay setting in ZHA cluster, but I did not test that.

Interesting, is there any documentation regarding this ZHA cluster? Maybe we can use it to implement debouncing without the need to alter the blueprint.

Thank you!

Hello,
here is my zha debug: https://pastebin.com/K6fNp6fB
here is zha events: https://pastebin.com/ZmfVMe4F

I will look deeper in that ZHA cluster settings… as for now, i don´t have any info about ikea documentation.

Hi @MattX,

thank you for your precious help, I’ll look into this and let you know if I’m able to implement this feature. :+1:

I will look deeper in that ZHA cluster settings…

Great, please let me know if you discover anything which might be useful. :slight_smile:

Thanks again!

It looks like there is some battery issue too, with Sonoff gateway.
My battery was dead in couple of days.
Tried different ZHA settings, but doesn’t affect multiple event firing anyway.
We need to add timeout to automation

Hi @MattX,
thank you for testing the ZHA settings. Given the results, adding the debounce feature directly in the blueprint is probably the best solution.

I’ll work on it and let you know as soon as it’s ready.

Thanks again :slight_smile:

It´s been month now, any good news @epmatt :wink: ?

Hi @MattX,
I’m really sorry for not reaching out to you sooner. Thanks to the valuable contribution of another user, we currently have an open Pull Request on GitHub which implements debouncing for the E1812.

The process was not straightforward since the controller behaviour varies from installation to installation, and we also encountered an issue with the HA Core automation integration, which eventually got fixed in the 2021.4.6 release.

I’m currently in the process of reviewing the Pull Request, hopefully we’ll be able to merge it and provide a fully working debounced version in the upcoming days.

In the meantime, you can test the updated Controller by importing the blueprint from the PR, using the following link:
(https://github.com/vandalon/awesome-ha-blueprints/tree/E1812/blueprints/controllers/ikea_e1812/ikea_e1812.yaml)

If you’d like to, you can always join the discussion and provide your valuable feedback on the related GitHub Pull Request. :wink:

Thank you for your patience and time. :slight_smile:

Awesome ! These are good news :wink: Thank you

1 Like

Hi there!

To @MattX and anyone who might be interested in this feature, I’ve just pushed an update for the blueprint which adds support for debouncing. :tada:

Debouncing allows to filter duplicate events which might be fired by this controller. This unexpected behaviour was reported for devices connected with the ZHA integration.

If you plan to update this blueprint, please read carefully the changelog and documentation, which also provides guidance on how to enable debouncing.

This update should solve your issues with duplicate action runs. If something is not working as intended after the update, please let me know. :+1:

Thank you for your patience, and happy automating!

Hi,
I tried different ways, but always getting this errors:

Logger: homeassistant.components.automation.controller_ikea_e1812_shortcut_button_3
Source: components/automation/init.py:508
Integration: Automation (documentation, issues)
First occurred: 10:57:34 AM (5 occurrences)
Last logged: 11:07:31 AM

Error while executing automation automation.controller_ikea_e1812_shortcut_button_3: not a valid value for dictionary value @ data[‘entity_id’]

Logger: homeassistant.components.automation.controller_ikea_e1812_shortcut_button_3
Source: helpers/script.py:1337
Integration: Automation (documentation, issues)
First occurred: 10:57:34 AM (5 occurrences)
Last logged: 11:07:31 AM

Controller - IKEA E1812 Shortcut button: Error executing script. Invalid data for call_service at pos 3: not a valid value for dictionary value @ data[‘entity_id’]

Automation:

- alias: Controller - IKEA E1812 Shortcut button
  description: ''
  use_blueprint:
    path: EPMatt/ikea_e1812.yaml
    input:
      integration: deCONZ
      controller_device: ddb82b1d24d9e43c69f2cc5fcc25b215
      button_double_press: true
      button_long_loop: true
      action_button_short:
        - service: notify.telegram
          data:
            message: 'teste1'
      action_button_long:
        - service: notify.telegram
          data:
            message: 'teste1'
      action_button_release:
        - service: notify.telegram
          data:
            message: 'teste1'
      action_button_double:
        - service: notify.telegram
          data:
            message: 'teste1'

Hi @nmartinho, thank you for reporting here.

You need to provide a valid input_text entity for the helper_last_controller_event input.

To learn more about the helper_last_controller_event , how it’s used an why it’s required, you can read this section in the official documentation.

Please let me know if adding the missing input solves your issue.
Thanks!

Hi @epmatt it worked. :+1:
My fault, ignored that was a required parameter.
Thanks for the support.

1 Like

Works like a charm. Thanks!

1 Like

Hi, was working fine and all of a sudden my automation stopped working correctly. It is meant to toggle some lights to a certain RGB value and brightness, instead its gone back to just putting it on whatever the last state was. An error in the logs popped up…

Error while executing automation automation.bedroom_button_1: UndefinedError: 'dict object' has no attribute 'event'

And a copy of the automation… Ubuntu Pastebin

Hi @BeastHouse, thank you for reporting.

The issue seems relative to the way the blueprint recognizes Zigbee2MQTT events.
Did you perform any modifications to your system before experiencing this issue? (eg. Zigbee2MQTT or HA update, Zigbee coordinator change etc.)

Thank you!

Potentially a HA update, however I just deleted and re-created the automation and now it’s working again. Thanks for the response.

1 Like