IKEA on/off button (E1743) to control Covers (Blinds)

This blueprint adds the ability to control home assistant covers (blinds) using an Ikea Tradfri button (E1743), connected via zigbee2mqtt.

This is a fork of Zigbee2mqtt - Ikea on/off switch with dimming

The button actions are mapped to cover services as follows:

Short Press ON - (on) - Open Cover
Short Press OFF - (off) - Close Cover
Long Press ON - (rightness_move_up) - Move cover UP until button is released.
Long Press OFF - (rightness_move_down) - Move cover DOWN until button is released.
Release ON or OFF after Long Press - Stop Cover

Update 28/09/2022 - Introduced condition to avoid random behavior due to zigbee2mqtt sending empty commands.
Updated: 23.06.2023 - changed behaviour of buttons to allow hold to move behaviour

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

blueprint:
  name: Ikea on/off button (E1743) cover control
  description: Control cover with IKEA Tradfri ON/OFF button (E1743).
  domain: automation
  input:
    button:
      name: button
      description: Ikea ON/OFF Button (E1743)
      selector:
        entity:
          domain:
          - sensor
          multiple: false
    cover:
      name: Cover
      description: Controlled Cover
      selector:
        target:
          entity:
          - domain:
            - cover
  source_url: https://community.home-assistant.io/t/ikea-on-off-button-e1743-to-control-covers-blinds/286307
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input button
  attribute: action
variables:
  command: '{{ trigger.to_state.state }}'
condition:
- condition: template
  value_template: '{{ command != ''''}}'
action:
- choose:
  - conditions:
    - '{{ command == ''off'' }}'
    sequence:
    - service: cover.close_cover
      target: !input cover
      data: {}
  - conditions:
    - '{{ command == ''on'' }}'
    sequence:
    - service: cover.open_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_move_down'' }}'
    sequence:
    - service: cover.close_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_move_up'' }}'
    sequence:
    - service: cover.open_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_stop'' }}'
    sequence:
    - service: cover.stop_cover
      data: {}
      target: !input cover
1 Like

Love this! Could I make a suggestion;
When you click the on/off button while it’s moving, it should stop the cover. Not on the long press. This removes the need for long clicks! I’m not sure how to do that conditionally, though.

Thanks!

Hey @ferryhel delighthed you find this useful.
Great suggestion there, there’s a small complication though. I use these buttons to control RF blinds, which don’t have state. While the state is maintained by home assistant, it’s still inaccurate (gets reset when you restart home assistant for example).
Having the stop function as a second click will require a more complex state machine, that you’ll need to implement using something like input_boolean.
If you have time to research this, I’m happy to take implementation suggestions and update this blueprint.


service: |
  {% if is_state('cover.rolluik_kantoor', 'closing' or 'opening') %}
      cover.stop_cover
  {% else %}
      cover.close_cover
  {% endif %}
target:
  entity_id: cover.rolluik_kantoor


I have this in an automation, but I’m not sure as to how I should to about turning that into a blueprint.
UPDATE:
Fixed it by adding the following to my blueprint:

variables:
  cover_entity: !input 'cover'
  cover_state: "{{ states[cover_entity].state }}"

And on the actions:

 sequence:
    - service: >
       {% if cover_state == 'opening' %}
         cover.stop_cover
       {% elif cover_state == 'closing' %}
         cover.stop_cover    
       {% else %}
         cover.open_cover
       {% endif %}
      entity_id: !input 'cover'

Hi @ferryhel where have you updated the code? is it in your automations or?

I am finding @cliviu74 hard to use as the blind dont open fully once your press the on button.

also are you getting the actual state from z2m? under action in z2m I am having null everytime even when any buttons are pressed. Do you guys experience the same?

Hi! I modified it to work with DeConz, but i changed it in the blueprint itself. I’m on mobile with no access to a pc for a bit, but you can edit it in the bp by changing the sequence and the variables

Right ok I see.

Also do you get the null under action when you press any buttons?

Yes, that occurred here. In general, I found it’s better to use an alternative under variables:
command: '{{ trigger.to_state.attributes.action }}'

Would love to see the opening post updated with these adjustment, in order to prevent errors and maintainability of the topic :slight_smile:

Can someone add the function to set the position Number of the blind?

After every battery change the max out point is erased! That sucks…

I permitted myself to add a feature to control blind opened level

blueprint:
  name: Ikea on/off button (E1743) cover control
  description: Control cover with IKEA Tradfri ON/OFF button (E1743).
  domain: automation
  input:
    button:
      name: button
      description: Ikea ON/OFF Button (E1743)
      selector:
        entity:
          domain:
          - sensor
          multiple: false
    cover:
      name: Cover
      description: Controlled Cover
      selector:
        target:
          entity:
          - domain:
            - cover
  source_url: https://community.home-assistant.io/t/ikea-on-off-button-e1743-to-control-covers-blinds/286307
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input button
  attribute: action
variables:
  command: '{{ trigger.to_state.state }}'
condition:
- condition: template
  value_template: '{{ command != ''''}}'
action:
- choose:
  - conditions:
    - '{{ command == ''off'' }}'
    sequence:
    - service: cover.close_cover
      target: !input cover
      data: {}
  - conditions:
    - '{{ command == ''on'' }}'
    sequence:
    - service: cover.open_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_move_down'' }}'
    sequence:
    - service: cover.close_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_move_up'' }}'
    sequence:
    - service: cover.open_cover
      data: {}
      target: !input cover
  - conditions:
    - '{{ command == ''brightness_stop'' }}'
    sequence:
    - service: cover.stop_cover
      data: {}
      target: !input cover

Great stuff @Citrowallon, hope you don’t mind if I publish the update in this blueprint.

My pleasure.
I was so happy to find this blueprint, don’t hesitate to share the modification for everybody

I just tried to install/use this blueprint but it does not work, it literally does nothing.
I do have an IKEA E1743 connected via z2m and cover with ShellyPlus2PM, I set up the right entity but the automation based on this blueprint does nothing, I do use the blueprint for the same IKEA button to control lights (Zigbee2mqtt - Ikea on/off switch with dimming) and that works perfectly so I am clueless what to check here to troubleshoot the problem, can someone help?

Can you look at the automation trace?
Settings → Automations → “Automation Name” → Traces (Upper right corner)

Check the “Trace Timeline” to see what’s happening there.

Maybe I was not cleat but what I wrote “it does nothing” I meant literally nothing in the traces despite I press the IKEA button associated to the blueprint, when I associate the very same IKEA to the blueprint that dims some lights using the relative blueprint, it works like a charm… what shoudl I look at? it seems to me the bleprint does not work not listening to the events from the button :frowning:

any clue for me?
this is how blueprint is setup; when I check the IKEA sensors it shows values when I press either on or off button but animation via blueprint never triggers :frowning:

id: '1697708177169'
alias: Controllo Serranda Gianluca
description: ''
use_blueprint:
  path: cliviu74/ikea-on-off-button-e1743-to-control-covers-blinds.yaml
  input:
    button: sensor.pulsante_serranda_gianluca_action
    cover:
      device_id: d76858a207145f6604099a9a026c75ce

Hmm, your automation looks OK to me.

If the automation is not triggering at all it means the event from the button is not registered.

Can you check the state of sensor.pulsante_serranda_gianluca_action when you push it?
(Logbook → Entity Id: sensor.pulsante_serranda_gianluca_action) and press the ikea’s buttons a few times. You should see new events showing in the timeline there. If there’s no events, look into your zigbee to homeassistant interactions.

If the button works correctly, you can try removing the automation, removing the blueprint and re-add bluprint and automation.

@papperone can you share what blueprint are you using for lights, the one that you mentioned it works for you? I can take a look if there’s something obvious between the 2.
This blueprint does a “debounce”, which means it eliminates empty events. Without this debounce, you have issues when holding buttons. This doesn’t explain automation not kicking in though, as you should be able to see events in “Trace” regardless of debounce.