Zigbee2mqtt IKEA on/off-switch general use

This blueprint is basically the same as the 5-button version, but for use with the on/off-button.
E1743

The original use of the button is on or off (short presses) or brightness up (long pressing the on button) and brighness down (long pressing the off button).

But to make it more general, you select an action for on-short, off-short, on-long, off-long.

blueprint:
  name: Ikea on/off-switch general use
  description: "This blueprint is for the IKEA on/off-remote switch when used with zigbee2mqtt.
  It is for genral use so all buttons can be connected to any action of your choice.
  Make sure to select the correct sensor for the remote."
  domain: automation
  input:
    remote:
      name: Remote
      description: IKEA remote to use
      selector:
        entity:
          integration: mqtt
          domain: sensor
    on_button_short:
      name: On button short
      description: Action to run when ON button SHORT press
      default: []
      selector:
        action: {}
    off_button_short:
      name: Off button short
      description: Action to run when OFF button SHORT pressed
      default: []
      selector:
        action: {}
    on_button_long:
      name: On button long
      description: Action to run when ON button LONG pressed (brightness up)
      default: []
      selector:
        action: {}
    off_button_long:
      name: Off button long
      description: Action to run when OFF button LONG pressed (brightness down)
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "remote"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'on' }}"
        sequence: !input "on_button_short"
      - conditions:
          - "{{ command == 'off' }}"
        sequence: !input "off_button_short"
      - conditions:
          - "{{ command == 'brightness_move_up' }}"
        sequence: !input "on_button_long"
      - conditions:
          - "{{ command == 'brightness_move_down' }}"
        sequence: !input "off_button_long"

3 Likes

Thanks for your blueprint!
May you rename the Title and the Description?
Its pretty misleading to have an on-of switch named “IKEA 5-button remote” :laughing:

blueprint:
  name: zigbee2mqtt IKEA 2-button remote
  description: "This blueprint is for the IKEA round, 2-button remote when used with zigbee2mqtt.
  It is for general use so all buttons can be connected to any action of your choice"

Oops, thanks for spotting it. So much for thinking you proof read, but forget the title
 :rofl:

Awesome timing, my Ikea Button arrived 10 minutes ago :tada:

I think you pasted the wrong blueprint, this on has actions for up/down/left/right in addition to on/off.

Hi, this blueprint didn’t work for me, because my IKEA button publiches different states:

  • ‘on’
  • ‘off’
  • ‘brightness_move_up’
  • ‘brightness_move_up’

But probably you just pasted the wrong blueprint :slight_smile:
Thanks for your work.

yes, I did

fixed

jupp, fixed


I really hope it’s correct and working now


Note to self: you can’t check to often. Don’t publish blueprints when too tired


1 Like

@julab @Skeletorjus @limbo

If you have (tried to
) used the blueprint, does it work as it should now?

Can u make it for the 5 button as well ? :slight_smile:

I’m not quote sure if you’re pulling my leg :wink: :upside_down_face:

but in case you just found this and didn hang along I managed to first publish the 5-button-version instead of the on/off-switch,so yeas, there is one as well, link at the top, and here

Hope they work as they should :slight_smile:

Oh om so sorry.

Thank u!

Ive imported it, but I don’t see any of my remote buttons for the device to select


But when I’m going to the action function I do see my remote ?

What am I doing wrong :confused:

I’m not quite sure I understand.

First you have to select the correct remote, And make sure it’s the corrext entity since there are a lot to choose from. If you haven’t changed to much, the entity_id will contain action. ie sensor.my_remote_action

Then click the ADD ACTION button next to the button you want to controll and you will be able to select what action and entity to control, This will work the same as when you do a “normal” automation in the ui. If you are new to automations I suggest you take a look at the documentation on the home page where they have written far better instructions than I can do here.

The actions be a lot of different things, I for example have some buttons just turning on/off lamps, and other buttons will activate an input_boolean and do a lot of things at the same time, like when it’s bed-time it will turn off all my lights, lower the set-points, turn on my alarm, turn off the bedside lamp etc. Yet other will control the media-player volume.

So these blueprints (both this and the 5-button-version) are ment for those who would like to be able to use the remotes just as they like.

It I remember correctly, there are blueprints for zigbee2mqtt and IKEA 5-button remote that you assign a light and it will work like it would if you paired the remote and lamp directly.

Hope this will help, just get back otherwise, so it’s not the blueprints that are the problem.

Okay i will try again :slight_smile:

When im trying to run the blueprint, i dont see the remotes as a device when im selecting the first drop down.

https://paste.pics/49788beeed90e1a3c010eb9a13e65386

But when im in entities i do see my devices fine


https://paste.pics/86f27fad741a29d85b0d32b3cb831d68

Ah, I think I might have found the problem.

It seems you are using the IKEA trÄdfri integration. This integration is ment for the zigbee2mqtt integration.

The “problem” is that different integrations have different ways of solving things


Now, unfortunatley I don’t have an IKEA GW so can’t test myself how much changes that needs to be done in order for it to work with the IKEA TrĂ„dfri integration, but if you are lucky, it might be quite easy.

Open up the blueprint file in an editor and remove the line integration: mqtt. This is used to filter the entities so you get a few less to scroll through, and kind of as the case is here, to filter out entities that are not compatible with the blueprint. If up want to you could replace mqtt with IKEA Tradfri to filter out only your trÄdfri-devices. But if you just remove the line you will have all your sensors showing up.

Save your changes and go to configuration -> server controls -> reload automations.

Now your device should show up, and with a bit of luck it is the same commands and it will work.

If it does’t, send me an PM and lets see if we can sort it out.

remote:
      name: Remote
      description: IKEA remote to use
      selector:
        entity:
          integration: mqtt
          domain: sensor

to:

remote:
      name: Remote
      description: IKEA remote to use
      selector:
        entity:
          domain: sensor

Yes, it is working. Thanks :slight_smile:

1 Like

Is it possible to support two actions per event? E.g. “On button short” turns on a switch AND a light? At the moment I’ve had to create a group and use a single action.

You should be able to add more or less as many actions as you like. just klick och the ADD ACTION and fil in the others.

Thanks, this is a very usefull blueprint.
Is possible to better handle the brightness up and down to have a smooth transition instead of single step?