Shelly BLU RC Button 4 US ZB

I created a blueprint for using Shelly BLU RC Button 4 US ZB. When connecting on zigbee it didn’t bring the buttons in, so I created a blueprint to make it easier, Here it is: Full disclosure, I don’t code so gemini did the heavy lifting.

blueprint:
  name: Shelly 4-Button Remote (ZHA)
  description: Automate your Shelly 4-Button remote using ZHA events.
  domain: automation
  input:
    remote:
      name: Remote
      description: Select the Shelly Wall Switch to use
      selector:
        device:
          integration: zha
          manufacturer: Shelly
          
    # --- BUTTON 1 INPUTS ---
    button_1_single:
      name: Button 1 - Single Press
      default: []
      selector:
        action: {}
    button_1_double:
      name: Button 1 - Double Press
      default: []
      selector:
        action: {}
    button_1_long:
      name: Button 1 - Long Press
      default: []
      selector:
        action: {}
    button_1_release:
      name: Button 1 - Release
      default: []
      selector:
        action: {}

    # --- BUTTON 2 INPUTS ---
    button_2_single:
      name: Button 2 - Single Press
      default: []
      selector:
        action: {}
    button_2_double:
      name: Button 2 - Double Press
      default: []
      selector:
        action: {}
    button_2_long:
      name: Button 2 - Long Press
      default: []
      selector:
        action: {}
    button_2_release:
      name: Button 2 - Release
      default: []
      selector:
        action: {}

    # --- BUTTON 3 INPUTS ---
    button_3_single:
      name: Button 3 - Single Press
      default: []
      selector:
        action: {}
    button_3_double:
      name: Button 3 - Double Press
      default: []
      selector:
        action: {}
    button_3_long:
      name: Button 3 - Long Press
      default: []
      selector:
        action: {}
    button_3_release:
      name: Button 3 - Release
      default: []
      selector:
        action: {}

    # --- BUTTON 4 INPUTS ---
    button_4_single:
      name: Button 4 - Single Press
      default: []
      selector:
        action: {}
    button_4_double:
      name: Button 4 - Double Press
      default: []
      selector:
        action: {}
    button_4_long:
      name: Button 4 - Long Press
      default: []
      selector:
        action: {}
    button_4_release:
      name: Button 4 - Release
      default: []
      selector:
        action: {}

mode: restart
max_exceeded: silent

trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input remote

action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      args: "{{ trigger.event.data.args }}"
      endpoint: "{{ trigger.event.data.endpoint_id }}"

  - choose:
      # --- BUTTON 1 LOGIC ---
      - conditions:
          - "{{ endpoint == 1 }}"
          - "{{ command == 'on' }}"
        sequence: !input button_1_single
      
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [1, 1, 10] }}"
        sequence: !input button_1_double
      
      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [0, 20, 10, 0, 0] }}"
        sequence: !input button_1_long

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [1, 11, 10] }}"
        sequence: !input button_1_release

      # --- BUTTON 2 LOGIC ---
      - conditions:
          - "{{ endpoint == 1 }}"
          - "{{ command == 'off' }}"
        sequence: !input button_2_single
      
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [2, 1, 10] }}"
        sequence: !input button_2_double

      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [1, 20, 10, 0, 0] }}"
        sequence: !input button_2_long

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [2, 11, 10] }}"
        sequence: !input button_2_release

      # --- BUTTON 3 LOGIC ---
      - conditions:
          - "{{ endpoint == 2 }}"
          - "{{ command == 'on' }}"
        sequence: !input button_3_single

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [3, 1, 10] }}"
        sequence: !input button_3_double

      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [0, 20, 10, 0, 0] }}"
        sequence: !input button_3_long

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [3, 11, 10] }}"
        sequence: !input button_3_release

      # --- BUTTON 4 LOGIC ---
      - conditions:
          - "{{ endpoint == 2 }}"
          - "{{ command == 'off' }}"
        sequence: !input button_4_single

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [4, 1, 10] }}"
        sequence: !input button_4_double

      - conditions:
          - "{{ command == 'step' }}"
          - "{{ args == [1, 20, 10, 0, 0] }}"
        sequence: !input button_4_long

      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ args == [4, 11, 10] }}"
        sequence: !input button_4_release
2 Likes

Hello Chad,

Thanks for contributing to the community with a new Blueprint.

I have a suggestion for you. Many people who are not familiar with directory structures will have problems installing this without the Home Assistant MY tools.

Adding a MY link for this Blueprint to your top post would help them a lot.

Here is the link to make that.
Create a link – My Home Assistant

I’m am not really sure how to do that. I can’t figure out where I get the url from. I went to the blueprint in my HA, and pressed m, but there is no matching mylink found.

I gave you a link. Click it, then add
https://community.home-assistant.io/t/shelly-blu-rc-button-4-us-zb/978816

Then it creates a link for you. Copy the markdown url and paste it in your top post if it lets you edit it.
Like this:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Thanks, it isn’t letting me edit the post (only the script) so your link will have to do.

1 Like

If you do a bit more interaction with the forum, it will let you update it. Access is based on Forum experience to deter spammers.
You need to be a trust level ‘member’ to edit a post. Understanding Discourse Trust Levels

And yes, I won’t delete my link unless you are eventually able to edit yours.

Thank you for this. I was just beginning to get frustrated with making this work with my HA. So far I haven’t been able to get any long-press actions to work. Do they work for you?

I didn’t test it until you mentioned it. I am having some problems with it as well. I will look into it and see if i can figure something out there.