ZHA - IKEA Tradfri Shortcut button

Are you using ZHA? There is an issue at the moment with ZHA and IKEA remotes where a poll is draining the battery very quickly. Try pairing the remote thru another router to see if it avoid this problem for the moment and check the opened issue on ZHA GitHub.

Hi everyone
I just saw this blueprint and this may be exactly what I need. However: it doesnā€™t seem to work with a Tradfri gateway using the ZHA integration.

Is there a way to integrate a Tradfri gateway using a 3rd party integration? The goal for me is to use the button to control a Tuya light.

Thanks in advance

No, youā€™ll need an universal zigbee coƶrdinator like conbee or cc2531 usb stick. See https://www.home-assistant.io/integrations/zha/. I would personally use zigbee2mqtt instead of zha. In combination with the cheap cc2531 stick. https://www.zigbee2mqtt.io/

Attempted to use this blueprint but inside it says ā€œno devices foundā€ even though Iā€™m using them for other automations with no problem.

Struggling with this one.

My button is paired in ZHA OK, it appears in the dropbox when I setup the automation but doesnā€™t seem to do anything - The automation never seems to run. I have tried to use the ZHA_EVENTS listener but that doesnā€™t seem to return anything from any of my zigbee devices.

Not sure where to look next - any advice from anyone?

And it randomly started working about 3 hours laterā€¦

Hi,
Ikea e1812 and latest firmware 2.3.080 support double click natively (with a proper zha_event for double click). I have modified the blueprint according to the newest firmware release. I tested and itā€™s ok. Iā€™m not a developer so everybody feel free to debug/optimize

blueprint:
  name: ZHA - IKEA Tradfri Shortcut button
  description: Control anything with the ikea shortcut button
  domain: automation
  input:
    shortcut_button:
      name: Device
      description: Select an IKEA shortcut button
      selector:
        device:
          integration: zha
          manufacturer: IKEA of Sweden
          model: TRADFRI SHORTCUT Button
    button_short:
      name: Single click
      description: "Choose action(s) when short pressed:"
      default: []
      selector:
        action: {}
    button_double:
      name: Double click
      description: "Choose action(s) when double pressed:"
      default: []
      selector:
        action: {}
    button_long:
      name: Long click
      description: "Choose action(s) when long pressed:"
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/zha-ikea-tradfri-shortcut-button/261936
mode: single
max_exceeded: silent
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "shortcut_button"
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      cluster_id: "{{ trigger.event.data.cluster_id }}"
      endpoint_id: "{{ trigger.event.data.endpoint_id }}"
      args: "{{ trigger.event.data.args }}"
  - choose:
      # short click
      - conditions:
          - "{{ endpoint_id == 1 }}"
          - "{{ cluster_id == 6 }}"
          - "{{ command == 'on' }}"
        sequence:
          - choose:
            default: !input "button_short"
          - wait_for_trigger:
              - platform: event
                event_type: zha_event
                event_data:
                  device_id: !input "shortcut_button"
                  endpoint_id: 1
                  cluster_id: 6
                  command: on
            timeout:
              seconds: 1

      # double click
      - conditions:
          - "{{ endpoint_id == 1 }}"
          - "{{ cluster_id == 6 }}"
          - "{{ command == 'off' }}"
        sequence:
          - choose:
            default: !input "button_double"
          - wait_for_trigger:
              - platform: event
                event_type: zha_event
                event_data:
                  device_id: !input "shortcut_button"
                  endpoint_id: 1
                  cluster_id: 6
                  command: off
            timeout:
              seconds: 1
      # long click
      - conditions:
          - "{{ endpoint_id == 1 }}"
          - "{{ cluster_id == 8 }}"
          - "{{ command == 'move_with_on_off' }}"
        sequence:
          - choose:
            default: !input "button_long"
          - wait_for_trigger:
              - platform: event
                event_type: zha_event
                event_data:
                  device_id: !input "shortcut_button"
                  endpoint_id: 1
                  cluster_id: 8
                  command: stop
            timeout:
              seconds: 1
2 Likes

Every time I use this blueprint I get different results. I have the feeling that here reacts to very many events and it is always a coincidence which wins.

Here is an example where I pressed the button once (!):

  1. Triggered by the event ā€˜zha_eventā€™ at 29. November 2021, 09:11:48: Finished at 29. November 2021, 09:11:48 (runtime: 0.10 seconds)
  2. Triggered by the event ā€˜zha_eventā€™ at 29. November 2021, 09:11:48: Stopped because only a single execution is allowed at 29. November 2021, 09:11:48 (runtime: 0.00 seconds)
  3. Triggered by the event ā€˜zha_eventā€™ at 29. November 2021, 09:11:48: Stopped because only a single execution is allowed at 29. November 2021, 09:11:48 (runtime: 0.00 seconds)

I also captured a click in the events display, there also 3 ones. I attached it as a PNG

Iā€™ve downloaded this blueprint, but I cannot get it to work. Shortcut button shows as available in deCONZ/Phoscon, but the Blueprint says ā€œNo matching devicesā€


Have you tried to reload the Deconz integration ?

This updated script by @ArsenioLupin is the only script that worked for me with the new firmware 2.3.080!
The original script did work for single and long press, but failed to recognise a double press. This script fixes that.

Thanks :slight_smile:

Reload didnā€™t work for me. Still only visible in devices, not in the blueprint drop-down menu.

I am getting regular warnings on my logs (about three times a day) when using this blueprint. Anyone having the same?

Template variable warning: 'dict object' has no attribute 'command' when rendering '{{ trigger.event.data.command }}'
Template variable warning: 'dict object' has no attribute 'cluster_id' when rendering '{{ trigger.event.data.cluster_id }}'
Template variable warning: 'dict object' has no attribute 'endpoint_id' when rendering '{{ trigger.event.data.endpoint_id }}'
Template variable warning: 'dict object' has no attribute 'args' when rendering '{{ trigger.event.data.args }}'
1 Like

Hi there,

first at all, Iā€™m still a beginner with HA and this blueprint is the first I ever installed.

Unfortunately it does not work on my system. I downloaded, installed and configured the blueprint. After this I can configure the buttons and can turn on /off a switch.
But after approx. 5 minutes my complete ā€œAutomationā€ gets greyed out. I cannot do anything with it. I checked the server configuration, this sayed ā€œokā€ and I did a reboot.
After this, I got the following error message:

Logger: homeassistant.setup

Source: components/device_automation/init.py:112

First occurred: 20:59:21 (1 occurrences)

Last logged: 20:59:21

Error during setup of component automation

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/components/device_automation/__init__.py", line 109, in async_get_device_automation_platform

    integration = await async_get_integration_with_requirements(hass, domain)

  File "/usr/src/homeassistant/homeassistant/requirements.py", line 58, in async_get_integration_with_requirements

    integration = await async_get_integration(hass, domain)

  File "/usr/src/homeassistant/homeassistant/loader.py", line 566, in async_get_integration

    integration = await _async_get_integration(hass, domain)

  File "/usr/src/homeassistant/homeassistant/loader.py", line 594, in _async_get_integration

    raise IntegrationNotFound(domain)

homeassistant.loader.IntegrationNotFound: Integration '' not found.



The above exception was the direct cause of the following exception:



Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/setup.py", line 229, in _async_setup_component

    result = await task

  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 230, in async_setup

    if not await _async_process_config(hass, config, component):

  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 635, in _async_process_config

    await async_validate_config_item(hass, raw_config),

  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 86, in async_validate_config_item

    config[CONF_ACTION] = await script.async_validate_actions_config(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 241, in async_validate_actions_config

    return await asyncio.gather(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 298, in async_validate_action_config

    choose_conf[CONF_SEQUENCE] = await async_validate_actions_config(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 241, in async_validate_actions_config

    return await asyncio.gather(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 289, in async_validate_action_config

    config[CONF_DEFAULT] = await async_validate_actions_config(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 241, in async_validate_actions_config

    return await asyncio.gather(

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 256, in async_validate_action_config

    platform = await device_automation.async_get_device_automation_platform(

  File "/usr/src/homeassistant/homeassistant/components/device_automation/__init__.py", line 112, in async_get_device_automation_platform

    raise InvalidDeviceAutomationConfig(

homeassistant.components.device_automation.exceptions.InvalidDeviceAutomationConfig: Integration '' not found
Ā“Ā“Ā“

-> Is this related to this blueprint only, or do I have certain problem with my system???

I would be very nice, if someone can help me with this....

best, 
jj

I donā€™t know about your specific problem but you should :

Yes, thank you! Backup is no problem, Iā€™m doing a backup on my local NAS which is working perfect.

Also I checked the configuration, which showed okay. But this did not solve the error. Since this is my first blueprint, I donā€™t know if I have a general issue or just with this specific blueprintā€¦

thx
c

Hello Everyone! I am trying this blueprint, and it works with the single click only. Neither hold or double clicks work. Is it a known issue?

Iā€™m having an issue with this blueprint as well.
Initially, I configured actions for single and double press, and only the double press action would fire, although it would fire on either single or double press. After updating the firmware (from 23.0.15 to 23.0.80) I was getting only the correct single press action. Trace shows that double press is seen and no action is taken.
Now I have configured the same action for double and long press. Single and long press now work as expected, but double press still shows no action taken. I have tried deleting and re-adding the double press action, but there is no difference.
I do not see multiple events firing after a single press. The log reflects one event.

Just like for alexs, this worked to fix the same problem. Thanks!

hi all ,
any idea how i can use this as a remote to a ā€œring pro dingā€