Zigbee2mqtt IKEA on/off-switch general use

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?

I’m having a strange behavior with this blueprint and switch. Anyone else, too? I’m using this switch for start playing music on my sonos system. Sometimes it’s not working. In HA History, it seemed that the button is pressed, but no actions were executed. For better debugging, I added another action for a notification. The Actions are: set volume, select_source, send notification. If I press the button again, most of the time it works (starts playing music). But sometimes even pressing the button 2-3 times in a row don’t start the music nor sending me an notification. Does anyone know how to debug this in more detail? Or does anyone have the same issues and fixed it somehow?

Thanks and regards,
Jens

I had a similar issue with this blueprint. I fixed it by modifying the following part of this blueprint:

The problem seems to be the following.

  • When a button’s action is triggered, the automation is triggered and starts to run
  • Meanwhile, a few milliseconds later another command action is sent having the value ‘’ (empty)
  • the previous action - that might still run - is now cancelled (since we defined mode: restart)

change from this:

trigger:
  - platform: state
    entity_id: !input "remote"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
    # ommited

to this:

trigger:
  - platform: state
    entity_id: !input 'remote'
    attribute: action
  
variables:
  command: '{{ trigger.to_state.state }}'

condition:
  - condition: template
    value_template: "{{ command != ''}}"
 
action:
  - choose:
    # ommited

…this fix is essentially going to ignore/filter the empty commands

I pasted the modified blueprint of mine here:

2 Likes

I don’t want to be too optimistic, but I just switched two of my IKEA Switches to your blueprint. And so far (today) it really worked. It seemed like you did it. I was searching and debugging everything… And if this was really it, it was just this “small thing” (I also switched to a new WiFi Infrastructure which I’m also debugging since weeks).

Three Questions: How did you find that?

And:

Why is that? I mean, where did this “other command” came from?

Is that a general thing? Should this condition added in every Switch blueprint? (Maybe my second question will answer this directly)

I will keep an eye on my automations the next days. Thank you so much for fixing this issue.

After a couple of days of working with your blueprint, I can say: This indeed fixed my issue. Thank you very much @pavax.

Regards,
Jens

1 Like

Hi @jesc - I’m glad that my fix is working for you!

How did you find that?

When I added a delay action while using the original blueprint, the action that was supposed to happen after the delay never executed.

I mean, where did this “other command” came from?

From Zigbee2Mqtt way to respond to button clicks. - When you think about it does make sense - The (ikea) buttons are not stateful but Home-Assistant has the concept of stateful entities (in the case of Z2M the remote’s action is a sensor entity) So, when a button is triggerd Z2M changes the state of that sensor (eg. on_button_short). Shortly after it changes the sensor’s state back to empy like the real-world state - the button is not pressed.

Is that a general thing? Should this condition added in every Switch blueprint? (Maybe my second question will answer this directly)

IMHO: To avoid the issue off race conditions (cancelling an already running action) - The handling/filtering of the empty command is needed for all the Zigbee2Mqtt Blueprints (and having mode: restart set)

Personally, I’d rather not want to open another “Ikea Z2M Remote Bluepint Topic” here on the forum and thus hope that the original author @fich can fix this in his version.

Until so here is mine

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

Yes, again: Thank you. I was searching and debugging for weeks.

Was there an error somewhere? (I’m just curious, because I added some
homeassistant.components.sonos: debug, pysonos: debug to my configuration.yaml and couldn’t find anything (now I know that I was searching at the wrong place, but I thought, I kept an eye on any error message in my logs at that time).

Yes, it makes sense now. Thank you, for your detailed clarification.

Hope that, too. Would be good if he add the fix.