Z2M IKEA Tradfri Shortcut Button E1812 Universal Actions

This is a blueprint for the IKEA Tradfri Shortcut Button E1812.
The states of the action are internal send as on/off/brightness_move_up/brightness_stop.

I transformed them into single press, double press, long_press and released.
For each of them you can select actions that will be performed.

Shortcut

Because I am quite new to home assistant I am happy for useful feedback for improving the code.

Blueprint Code

Click the badge to import this Blueprint: (needs Home Assistant Core that supports zigbee2mqtt)

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

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: 'Z2M IKEA Shortcut Button E1812'
  description: "Blueprint for Ikea Tradfri Shortcut Button E1812. You can put several actions to each single press, double press and long press."
  domain: automation
  source_url: https://community.home-assistant.io/t/z2m-ikea-tradfri-shortcut-button-e1812-universal-actions/522409
  input:
    button:
      name: Remote
      description: IKEA Shortcut Button to use (e.g sensor.kitchen_remote_action)
      selector:
        entity:
          integration: mqtt
          domain: sensor
          multiple: false
          
    single:
      name: Action when On sended
      description: Action to run when SHORT press
      default: []
      selector:
        action: {}
    double:
      name: Action when Off sended
      description: Action to run when DOUBLE SHORT press
      default: []
      selector:
        action: {}
    long:
      name: Action when Brightness_move_up sended
      description: Action to run when LONG press
      default: []
      selector:
        action: {}
    released:
      name: Action when Brightness_stop sended
      description: Action to run when LONG press RELEASED
      default: []
      selector:
        action: {}  
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id:
      - !input button
    to: "off"
    id: "off"
  - platform: state
    entity_id:
      - !input button
    to: "on"
    id: "on"
  - platform: state
    entity_id:
      - !input button
    to: "brightness_move_up"
    id: "long_down"
  - platform: state
    entity_id:
      - !input button
    to: "brightness_stop"
    id: "stop"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: "off"
        sequence: !input double
      - conditions:
          - condition: trigger
            id: "on"
        sequence: !input single
      - conditions:
          - condition: trigger
            id: "long_down"
        sequence: !input long
      - conditions:
          - condition: trigger
            id: "stop"
        sequence: !input released

The template looks like that:

3 Likes

i cant get it in my Blueprint list .
When i try i get this massage: No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

Thanks for that feedback.
I fixed the error.

Here is the yaml code only for 3 actions.
The reason is, that when you hold the button, it sends brightness_move_up and as soon you release it sends a brightness_stop. If that is a trigger, than the automation restarts and actions might not be fully executed.

Blueprint Code

Click the badge to import this Blueprint: (needs Home Assistant Core that supports zigbee2mqtt)

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

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: 'Z2M IKEA Shortcut Button E1812 3 Universal Actions'
  description: "Blueprint for Ikea Tradfri Shortcut Button E1812. You can put several actions to each single press, double press and long press."
  domain: automation
  source_url: https://community.home-assistant.io/t/z2m-ikea-tradfri-shortcut-button-e1812-universal-actions/522409/3
  input:
    button:
      name: Remote
      description: IKEA Shortcut Button to use (e.g sensor.kitchen_remote_action)
      selector:
        entity:
          integration: mqtt
          domain: sensor
          multiple: false
          
    single:
      name: Action when On sended
      description: Action to run when SHORT press
      default: []
      selector:
        action: {}
    double:
      name: Action when Off sended
      description: Action to run when DOUBLE SHORT press
      default: []
      selector:
        action: {}
    long:
      name: Action when Brightness_move_up sended
      description: Action to run when LONG press
      default: []
      selector:
        action: {}
        
mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id:
      - !input button
    to: "off"
    id: "off"
  - platform: state
    entity_id:
      - !input button
    to: "on"
    id: "on"
  - platform: state
    entity_id:
      - !input button
    to: "brightness_move_up"
    id: "long_down"

condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: "off"
        sequence: !input double
      - conditions:
          - condition: trigger
            id: "on"
        sequence: !input single
      - conditions:
          - condition: trigger
            id: "long_down"
        sequence: !input long


1 Like

Thanks for this! Is there some way to make HA detect the long press and incrementally increase a light brightness until released?

1 Like

Hi @Danieldz ,

Thanks for the template!.
The short button press works like a charm, i’m just having some difficulties with the double press. Do you have any idea why this doesn’t work?.

alias: Afstandsbediening Garagedeur
description: Open/Sluit de garagedeur of open deze voor 50%
use_blueprint:
  path: Danieldz/z2m-ikea-tradfri-shortcut-button-e1812-universal-actions.yaml
  input:
    button: sensor.remote_garagedeur_action
    single:
      - device_id: be746991fa9bb6872733a925242b39dd
        domain: cover
        entity_id: 44ad320a7eaa6e10b981cbd4dcbbb607
        type: open
      - device_id: be746991fa9bb6872733a925242b39dd
        domain: cover
        entity_id: 44ad320a7eaa6e10b981cbd4dcbbb607
        type: stop
      - device_id: be746991fa9bb6872733a925242b39dd
        domain: cover
        entity_id: 44ad320a7eaa6e10b981cbd4dcbbb607
        type: close
    double:
      - device_id: be746991fa9bb6872733a925242b39dd
        domain: cover
        entity_id: 44ad320a7eaa6e10b981cbd4dcbbb607
        type: set_position
        position: 50
      - device_id: be746991fa9bb6872733a925242b39dd
        domain: cover
        entity_id: 44ad320a7eaa6e10b981cbd4dcbbb607
        type: close