Zigbee2Mqtt Opple 6 Cover Switch

Here’s a little blueprint for Shelly 2.5 covers (to control roller shutters / venetian blinds).
i’ve based my work on ferryhel’s blueprint for Tradfri.

This blueprint only responds to single button clicks of Opple 6 and is suitable for 3 cover switches.

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

blueprint:
  name: Zigbee2Mqtt Opple Cover Switch
  description:
    '"Control your Shelly shutters with the Opple 6 button switch.
    Select the Opple action and your shutters. Non-Shelly devices will work fine as well.
    Shutters go up and down based on the up and down buttons, and stop when pressed again. This is based on the state of the device."
    '
  domain: automation
  input:
    switch:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        entity:
          domain: sensor
    cover_1:
      name: Cover 1
      description: The cover 1 you wish to close using the buttons 1 and 2.
      selector:
        entity:
          domain: cover
    cover_2:
      name: Cover 2
      description: The cover 2 you wish to close using the buttons 3 and 4.
      selector:
        entity:
          domain: cover
    cover_3:
      name: Cover 3
      description: The cover 3 you wish to close using the buttons 5 and 6.
      selector:
        entity:
          domain: cover
mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: !input "switch"
    attribute: action

variables:
  cover_1: !input cover_1
  cover_1_state: "{{ states[cover_1].state }}"
  cover_2: !input cover_2
  cover_2_state: "{{ states[cover_2].state }}"
  cover_3: !input cover_3
  cover_3_state: "{{ states[cover_3].state }}"

action:
  - variables:
      command: "{{ trigger.to_state.state }}"
  - choose:
      - conditions:
          - "{{ command == 'button_2_single' }}"
        sequence:
          - service: >
              {% if cover_1_state == 'opening' %}
                cover.stop_cover
              {% elif cover_1_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.open_cover
              {% endif %}
            entity_id: !input cover_1
      - conditions:
          - "{{ command == 'button_1_single' }}"
        sequence:
          - service: >
              {% if cover_1_state == 'opening' %}
                cover.stop_cover
              {% elif cover_1_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.close_cover
              {% endif %}
            entity_id: !input cover_1
      - conditions:
          - "{{ command == 'button_4_single' }}"
        sequence:
          - service: >
              {% if cover_2_state == 'opening' %}
                cover.stop_cover
              {% elif cover_2_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.open_cover
              {% endif %}
            entity_id: !input cover_2
      - conditions:
          - "{{ command == 'button_3_single' }}"
        sequence:
          - service: >
              {% if cover_2_state == 'opening' %}
                cover.stop_cover
              {% elif cover_2_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.close_cover
              {% endif %}
            entity_id: !input cover_2
      - conditions:
          - "{{ command == 'button_6_single' }}"
        sequence:
          - service: >
              {% if cover_3_state == 'opening' %}
                cover.stop_cover
              {% elif cover_3_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.open_cover
              {% endif %}
            entity_id: !input cover_3
      - conditions:
          - "{{ command == 'button_5_single' }}"
        sequence:
          - service: >
              {% if cover_3_state == 'opening' %}
                cover.stop_cover
              {% elif cover_3_state == 'closing' %}
                cover.stop_cover    
              {% else %}
                cover.close_cover
              {% endif %}
            entity_id: !input cover_3

1 Like