Smartthing Integration IKEA 2 or 5 Button

This is a modified version of the @frenck IKEA 5 Button Blueprint to work with the Smart things Integration and the Smartthings.button event handler.

The only requirement is that the buttons follow a naming system in the Smartthings app.
Devices must be named
Switch 1
Switch 2
and so on

If anyone could tell me how to embed the code here, would be great :smile:

simonmcc89/HomeAssistantBlueprints: HomeAssistantBlueprints (github.com)

Paste this:

Hi.

Can I use this only with a Ikea button connected with smartthings, or do I need Ikea’s hub/gateway too?

Yes, you don’t need a gateway.

Funny thing is, the IKEA buttons don’t work with Home Assistant if you have them connected through the IKEA Gateway. The buttons don’t send events when pushing button to the IKEA gateway, they send it directly to the device you paired the button with (bulb, blind, etc). So to configure actions based on pressing IKEA buttons you need to have the button paired with SmartThings (or other Zigbee integration that supports pairing the button devices).

I am unable to use the Blueprint due to an error when I try and create a Automation.

Error: UndefinedError: ‘dict object’ has no attribute ‘event’ .

Is there something that I am doing wrong here ? Appreciate all the help.

1 Like

I think I figured it out. What is the Ikea remote inside the smart things app? Do you have more than one? If you only have one, make sure to rename it in the SmartThings App

Name should be Switch 1. Then when setting up the automation using the blueprint place a 1 under switch number. When the blueprint runs it will pull the switch number you set to 1 and pair it with the blueprint name of switch to make the name switch 1.

When it does that it will look for a device called switch 1 in smartthings then run the automation. This allows for more than one switch because you just name them switch 1, switch 2 etc and then select the corresponding number in the automation.

If anyone is interested, I have modified this to work specifically with the IKEA Tradfri Dimmer connected to SmartThings. Instead of using the name to identify the remote, I used the device_id, which can be found by going to Developer Tools, Events, and listening to the smartthings.button event while pressing either button.

blueprint:
  name: Smartthings IKEA Two Button Remote
  description: |
    Use IKEA Remote To Trigger Actions

  domain: automation
  input:
    entered_id:
      name: 'Switch Device ID (Required)'
      selector:
        text:
    button_up_short:
      name: Up button - short press
      description: Action to run on short brightness up press
      default: []
      selector:
        action:
    button_up_long:
      name: Up button - long press
      description: Action to run on long brightness up press
      default: []
      selector:
        action:
    button_down_short:
      name: Down button - short press
      description: Action to run on short brightness down press
      default: []
      selector:
        action:
    button_down_long:
      name: Down button - long press
      description: Action to run on long brightness down press
      default: []
      selector:
        action:

mode: restart
max_exceeded: silent

trigger:
  - platform: event
    event_type: smartthings.button

action:

  - variables:
      compare_id: !input 'entered_id'
      switch_id: "{{ trigger.event.data.device_id }}"
      button_id: "{{ trigger.event.data.component_id }}"
      action_type: "{{ trigger.event.data.value }}"

  - choose:
      - conditions:
          - "{{ action_type == 'pushed' }}"
          - "{{ switch_id == compare_id}}"
          - "{{ button_id == 'button2' }}"
        sequence: !input button_up_short

      - conditions:
          - "{{ action_type == 'held' }}"
          - "{{ switch_id == compare_id}}"
          - "{{ button_id == 'button2' }}"
        sequence: !input button_up_long

      - conditions:
          - "{{ action_type == 'pushed' }}"
          - "{{ switch_id == compare_id}}"
          - "{{ button_id == 'button1' }}"
        sequence: !input button_down_short

      - conditions:
          - "{{ action_type == 'held' }}"
          - "{{ switch_id == compare_id}}"
          - "{{ button_id == 'button1' }}"
        sequence: !input button_down_long