Simple blueprint for ZHA Tuya 1 Button switch ( TS0041 TZ3000_mrpevh8p )

Hi all. I bought cheap Zigbee buttons ( This sort of thing: https://www.aliexpress.com/item/1005006401590560.html ) that seem to be very similar to other Tuya devices, but I could not get modifications of existing blueprints to work. After a lot of learning and debugging I found that even if you have a condition that switches on the “command” field of the Zigbee data if the button send two different events very quickly on press, ZHA would get confused and put the target device into a “stuck” state until some until the light.toggle service was called twice. However, if you put the full condiditon in the “trigger” clause then the second event is never processed and the target device does not get stuck, so here is my blueprint for simple light toggle using these buttons.

blueprint:
  name: ZHA - TS0041 Scene Switch
  description: Automate your Tuya 1-Button Scene Switch using ZHA events.
  domain: automation
  input:
    tuya_1button_scene_switch:
      name: TS0041 Switch
      description: Tuya 1-Button Scene Switch to use
      selector:
        device:
          integration: zha
          manufacturer: _TZ3000_mrpevh8p
          model: TS0041
    button_short_press:
      name: Short Press
      description: Action to run on a short Press
      default: []
      selector:
        action: {}

mode: restart
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'tuya_1button_scene_switch'
    command: remote_button_short_press
action:
  sequence: !input 'button_short_press'

Hi SilentMobius,

Thank you for your contribution to the community!

I have a suggestion for you. People will be asking for the my- link to easy load your code, use this you set that up.
Create a link – My Home Assistant

Just in case, here is the import button for Zigbee2MQTT Tuya 1-button smart button:

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