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

Tags: #<Tag:0x00007fc40c5e5b28> #<Tag:0x00007fc40c5e5a38> #<Tag:0x00007fc40c5e5948>

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 or OFF (brightness_move_up,brightness_move_down) - Stop Cover

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
    cover:
      name: Cover
      description: Controlled Cover
      selector:
        target:
          entity:
            domain: cover

mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'button'
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- 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.stop_cover
      data: {}
      target: !input 'cover' 
  - conditions:
    - '{{ command == ''brightness_move_up'' }}'
    sequence:
    - service: cover.stop_cover
      data: {}
      target: !input 'cover' 

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?