Shelly Button1 press with multiple inputs (single, double, triple, long)

A small blueprint to get the different Shelly button 1 inputs (single, double, triple, long) working in one automation. With inspiration from this post that didn’t work for me.

First time working with blueprints so feedback is always welcome!

My Home Assistant

blueprint:
  name: Shelly Button1 press
  description: Control anything from a Shelly Button1
  domain: automation
  input:
    remote:
      name: Shelly Button1 Switch
      description: Button to use
      selector:
        entity:
          domain: binary_sensor
          integration: shelly
    button_single:
      name: Short click
      default: []
      selector:
        action: {}
    button_double:
      name: Double click
      default: []
      selector:
        action: {}
    button_triple:
      name: Triple click
      default: []
      selector:
        action: {}
    button_long:
      name: Long click
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/shelly-button1-press-with-multiple-inputs-single-double-triple-long/338986
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input 'remote'
  to: "on"
action:
- variables:
    event: '{{ trigger.to_state.attributes.click_type }}'
- choose:
  - conditions:
    - '{{ event == "single" }}'
    sequence: !input 'button_single'
  - conditions:
    - '{{ event == "double" }}'
    sequence: !input 'button_double'
  - conditions:
    - '{{ event == "triple" }}'
    sequence: !input 'button_triple'
  - conditions:
    - '{{ event == "long" }}'
    sequence: !input 'button_long'
3 Likes

This did not work for me.
I currently only have the Button1, so using Nok’s template is a bit overkill for my use.

Your template is a good outline for the Button1 but I had trouble getting it to work because the Button1 is not an Entity, it only has device triggers.

I modified the template in two places:

  1. The selector now searches for all Shelly Button1 devices within Home Assistant instead of an entity.
  2. The trigger action looks for the click events instead of an entity state.

I hope this is helpful for anyone else who wants a simple Blueprint for the Shelly Button1.

blueprint:
  name: Shelly Button1 Press
  description: Control anything from a Shelly Button1
  domain: automation
  input:
    remote:
      name: Shelly Button1
      description: Button to use
      selector:
        device:
          integration: shelly
          model: Shelly Button1
          multiple: false
    button_single:
      name: Single click
      default: []
      selector:
        action: {}
    button_double:
      name: Double click
      default: []
      selector:
        action: {}
    button_triple:
      name: Triple click
      default: []
      selector:
        action: {}
    button_long:
      name: Long click
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: shelly.click
  event_data:
    device_id: !input remote
action:
- variables:
    event: '{{ trigger.event.data.click_type }}'
- choose:
  - conditions:
    - '{{ event == "single" }}'
    sequence: !input button_single
  - conditions:
    - '{{ event == "double" }}'
    sequence: !input button_double
  - conditions:
    - '{{ event == "triple" }}'
    sequence: !input button_triple
  - conditions:
    - '{{ event == "long" }}'
    sequence: !input button_long
2 Likes