ZHA - MOES ZigBee Wireless Scene Switch | 3 button remote (TS0043) powered by Tuya

Blueprint for the MOES ZigBee (TS0043) 3 button remote. It supports single and double press actions on all 3 buttons.

Blueprint Code

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
Or import this Blueprint by using the forum topic / Gist URL:

blueprint:
  name: MOES ZigBee (TS0043) 3 button remote
  description: Automate your MOES ZigBee Wireless Scene Switch 3 button remote using
    ZHA events.
  domain: automation
  input:
    moes_ts0043:
      name: Moes TS0043 3 button remote
      description: Moes TS0043 3 button remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_gbm10jnj
          model: TS0043
    button_one_single_press:
      name: Button 1 (single press)
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Button 1 (double press)
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_two_single_press:
      name: Button 2 (single press)
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Button 2 (double press)
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
    button_three_single_press:
      name: Button 3 (single press)
      description: Action to run on button 3 single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Button 3 (double press)
      description: Action to run on button 3 double press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'moes_ts0043'
action:
  - variables:
      command: '{{ trigger.event.data.command }}'
      endpoint_id: '{{ trigger.event.data.endpoint_id }}'
  - choose:
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_double_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_double_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_double_press'
4 Likes

Hi Prash,

Got this to work with my MOES TS0042 2-button remote and modified your blueprint slightly to accommodate this slightly different switch and it works brilliantly!

blueprint:
  name: MOES ZigBee (TS0042) 2 button remote
  description: Automate your MOES ZigBee Wireless Scene Switch 2 button remote using
    ZHA events.
  domain: automation
  input:
    moes_ts0042:
      name: Moes TS0042 2 button remote
      description: Moes TS0042 2 button remote
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_5e235jpa
          model: TS0042
          multiple: false
    button_one_single_press:
      name: Button 1 (single press)
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Button 1 (double press)
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_two_single_press:
      name: Button 2 (single press)
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Button 2 (double press)
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
  source_url: https://community.home-assistant.io/t/zha-moes-zigbee-wireless-scene-switch-3-button-remote-ts0043-powered-by-tuya/512399
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input moes_ts0042
action:
- variables:
    command: '{{ trigger.event.data.command }}'
    endpoint_id: '{{ trigger.event.data.endpoint_id }}'
- choose:
  - conditions:
    - '{{ command == ''remote_button_short_press'' and endpoint_id == 1 }}'
    sequence: !input button_one_single_press
  - conditions:
    - '{{ command == ''remote_button_double_press'' and endpoint_id == 1 }}'
    sequence: !input button_one_double_press
  - conditions:
    - '{{ command == ''remote_button_short_press'' and endpoint_id == 2 }}'
    sequence: !input button_two_single_press
  - conditions:
    - '{{ command == ''remote_button_double_press'' and endpoint_id == 2 }}'
    sequence: !input button_two_double_press

Thanks!

1 Like

Great to hear this helped

1 Like

I’ve been working with @denhamcoote at his request to port my HUE smartbutton multi-press blueprint to these Moes buttons if you want to try it out @Prash @AndyWhittaker

Unfortunately I don’t own these buttons so I can’t test it myself but here’s my first rough draft:

Due to the nature of it allowing 5 presses altogether, it treats single and double press events the same for now. Until I find a better way to handle this you need to try and time your button presses slower to not register a “Moes double press”

2 Likes

Thanks, I believe this means you can have it register combined key button presses for an action, if I understood it correctly?

You get 5 presses/actions per button + a hold action.

It comes with some hue smartbutton-like logic built in, so you can assign the button to a light to toggle it on/off or press it up to 5 times to cycle through scenes. If you don’t want that you just have 5 different assignable actions for the presses instead

2 Likes

Got this as a Blueprint to share?

THANKS ! I thought I would never be able to use this device in Home Assistant until I discovered your Blueprint!

1 Like

Thank you, @Prash !
I’ve mokey-see-monkey-do adapted it to the 4-button version which is working:

blueprint:
  name: MOES ZigBee (TS0044) 4 button remote
  description: Automate your MOES ZigBee Wireless Scene Switch 4 button remote using
    ZHA events.
  domain: automation
  input:
    moes_ts0044:
      name: Moes TS0044 4 button remote
      description: Moes TS0044 4 button remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_wkai4ga5
          model: TS0044
    button_one_single_press:
      name: Button 1 (single press)
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Button 1 (double press)
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_two_single_press:
      name: Button 2 (single press)
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Button 2 (double press)
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
    button_three_single_press:
      name: Button 3 (single press)
      description: Action to run on button 3 single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Button 3 (double press)
      description: Action to run on button 3 double press
      default: []
      selector:
        action: {}
    button_four_single_press:
      name: Button 4 (single press)
      description: Action to run on button 4 single press
      default: []
      selector:
        action: {}
    button_four_double_press:
      name: Button 4 (double press)
      description: Action to run on button 4 double press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'moes_ts0044'
action:
  - variables:
      command: '{{ trigger.event.data.command }}'
      endpoint_id: '{{ trigger.event.data.endpoint_id }}'
  - choose:
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_double_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_double_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_double_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 4 }}'
      sequence: !input 'button_four_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 4 }}'
      sequence: !input 'button_four_double_press'

I was able to get this working on my switch with just a slight modification to the OP. My switch has a different “manufacturer” field than OP and so the switch wasn’t showing up in the blueprint. I pulled up the device info and the manufacturer was listed in there (_TZ3000_1kmurvlx) and so I just updated that.

I also had to fiddle with “how do I make a new blueprint?” since I hadn’t done that before…

I get this error when I copy the OP’s blueprint with your manufacturer id (i have the same one). Any ideas?

UPDATE: my bad… I’m an idiot! I was adding the YAML to the automation. I had to create a YAML file and save it in the blueprints folder for the automations to pick it up. It’s now working flawlessly!

After my booboo above, I was able to make the blueprint work. I also added support for long press. Everything should work after copy/pasting the code. If it doesn’t make sure the manufacturer id matches your device.

If you’re not sure where to add this (like I was), install a text editor to your Home Assistant, something like VS Code or File Editor. Go to config → blueprints → automations → moes . If moes doesn’t exist, create the folder. Inside the moes folder, create a file and name it something like ts0043_3_button.yaml, and paste the code below. That should load the blueprint into your home assistant for you to pick from automations. If you make edits to the yaml file later, go to Settings → Tools and restart automations every time you make one.

blueprint:
  name: MOES ZigBee (TS0043) 3 button remote
  description: Automate your MOES ZigBee Wireless Scene Switch 3 button remote using
    ZHA events.
  domain: automation
  input:
    moes_ts0043:
      name: Moes TS0043 3 button remote
      description: Moes TS0043 3 button remote to use
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_1kmurvlx
          model: TS0043
    button_one_single_press:
      name: Button 1 (single press)
      description: Action to run on button 1 single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Button 1 (double press)
      description: Action to run on button 1 double press
      default: []
      selector:
        action: {}
    button_one_long_press:
      name: Button 1 (long press)
      description: Action to run on button 1 long press
      default: []
      selector:
        action: {}
    button_two_single_press:
      name: Button 2 (single press)
      description: Action to run on button 2 single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Button 2 (double press)
      description: Action to run on button 2 double press
      default: []
      selector:
        action: {}
    button_two_long_press:
      name: Button 2 (long press)
      description: Action to run on button 2 long press
      default: []
      selector:
        action: {}
    button_three_single_press:
      name: Button 3 (single press)
      description: Action to run on button 3 single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Button 3 (double press)
      description: Action to run on button 3 double press
      default: []
      selector:
        action: {}
    button_three_long_press:
      name: Button 3 (long press)
      description: Action to run on button 3 long press
      default: []
      selector:
        action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'moes_ts0043'
action:
  - variables:
      command: '{{ trigger.event.data.command }}'
      endpoint_id: '{{ trigger.event.data.endpoint_id }}'
  - choose:
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_double_press'
    - conditions:
        - '{{ command == ''remote_button_long_press'' and endpoint_id == 1 }}'
      sequence: !input 'button_one_long_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 2 }}'
      sequence: !input 'button_two_double_press'
    - conditions:
        - '{{ command == ''remote_button_long_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_two_long_press'
    - conditions:
        - '{{ command == ''remote_button_short_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_single_press'
    - conditions:
        - '{{ command == ''remote_button_double_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_double_press'
    - conditions:
        - '{{ command == ''remote_button_long_press'' and endpoint_id == 3 }}'
      sequence: !input 'button_three_long_press'