Zigbee2MQTT - Loratap SS600ZB / Tuya TS0043 3-button wireless switch

This is the blueprint for the Loratap SS600ZB / Tuya TS0043 3-button wireless switch for Zigbee2MQTT:

grafik

Supported actions for each button:

  1. Single press
  2. Double press
  3. Long press

Further information: TuYa TS0043 control via MQTT | zigbee2mqtt.io

blueprint:
  name: Zigbee2MQTT - Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch
  description: Automate your Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch via Zigbee2MQTT.
  domain: automation
  input:
    switch:
      name: Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch
      description: Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch to use
      selector:
        entity:
          integration: mqtt
          domain: sensor
    button_one_short_press:
      name: Single Press - Button 1
      description: Action to run on button 1 - single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 - double press
      default: []
      selector:
        action: {}
    button_one_long_press:
      name: Long Press - Button 1
      description: Action to run on button 1 - long press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 - single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 - double press
      default: []
      selector:
        action: {}
    button_two_long_press:
      name: Long Press - Button 2
      description: Action to run on button 2 - long press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 - single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 - double press
      default: []
      selector:
        action: {}
    button_three_long_press:
      name: Long Press - Button 3
      description: Action to run on button 3 - long press
      default: []
      selector:
        action: {}
  source_url: https://github.com/AramidX/ha-blueprint/blob/8e259f8e40ab1218f06ea1ce1d1444f67b4cd62f/blueprints/tuya/loratap_ss600zb_wireless_switch_z2m.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input "switch"
  attribute: action
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''1_single'' }}'
    sequence: !input 'button_one_short_press'
  - conditions:
    - '{{ command == ''2_single'' }}'
    sequence: !input 'button_two_short_press'
  - conditions:
    - '{{ command == ''3_single'' }}'
    sequence: !input 'button_three_short_press'
  - conditions:
    - '{{ command == ''1_double'' }}'
    sequence: !input 'button_one_double_press'
  - conditions:
    - '{{ command == ''2_double'' }}'
    sequence: !input 'button_two_double_press'
  - conditions:
    - '{{ command == ''3_double'' }}'
    sequence: !input 'button_three_double_press'
  - conditions:
    - '{{ command == ''1_hold'' }}'
    sequence: !input 'button_one_long_press'
  - conditions:
    - '{{ command == ''2_hold'' }}'
    sequence: !input 'button_two_long_press'
  - conditions:
    - '{{ command == ''3_hold'' }}'
    sequence: !input 'button_three_long_press'
2 Likes

This blueprint no longer seems to work, it allows me to select the TS0043 device and assign actions etc, but nothing actually happens when I press a button on the remote.

I tried stepping though the action and got this error:

xecuted: 25 March 2022, 14:57:19
Error: UndefinedError: 'dict object' has no attribute 'to_state'

I too get the same result.

I got this working in Node-Red. I was after each of the 3 buttons to select a preset Philips Hue Scene controlling 7 x rgb ceiling lights, each button can cycle through multiple scenes. Uses the Home Assistant and HueMagic nodes. Works good (wife friendly) about 1 second delay needed between presses and am yet to do anything with the double or long press options.

I use Tuya TS0043.

I got error message.

xecuted: 25 March 2022, 14:57:19
Error: UndefinedError: 'dict object' has no attribute 'to_state'

I remove attribute: action from trigger.
It’s work for me!!!.

blueprint:
  name: Zigbee2MQTT - Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch
  description: Automate your Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch via Zigbee2MQTT.
  domain: automation
  input:
    switch:
      name: Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch
      description: Loratap SS600ZB / Tuya TS0043 Zigbee Wireless Switch to use
      selector:
        entity:
          integration: mqtt
          domain: sensor
    button_one_short_press:
      name: Single Press - Button 1
      description: Action to run on button 1 - single press
      default: []
      selector:
        action: {}
    button_one_double_press:
      name: Double Press - Button 1
      description: Action to run on button 1 - double press
      default: []
      selector:
        action: {}
    button_one_long_press:
      name: Long Press - Button 1
      description: Action to run on button 1 - long press
      default: []
      selector:
        action: {}
    button_two_short_press:
      name: Single Press - Button 2
      description: Action to run on button 2 - single press
      default: []
      selector:
        action: {}
    button_two_double_press:
      name: Double Press - Button 2
      description: Action to run on button 2 - double press
      default: []
      selector:
        action: {}
    button_two_long_press:
      name: Long Press - Button 2
      description: Action to run on button 2 - long press
      default: []
      selector:
        action: {}
    button_three_short_press:
      name: Single Press - Button 3
      description: Action to run on button 3 - single press
      default: []
      selector:
        action: {}
    button_three_double_press:
      name: Double Press - Button 3
      description: Action to run on button 3 - double press
      default: []
      selector:
        action: {}
    button_three_long_press:
      name: Long Press - Button 3
      description: Action to run on button 3 - long press
      default: []
      selector:
        action: {}
  source_url: https://github.com/AramidX/ha-blueprint/blob/8e259f8e40ab1218f06ea1ce1d1444f67b4cd62f/blueprints/tuya/loratap_ss600zb_wireless_switch_z2m.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: state
  entity_id: !input "switch"
action:
- variables:
    command: '{{ trigger.to_state.state }}'
- choose:
  - conditions:
    - '{{ command == ''1_single'' }}'
    sequence: !input 'button_one_short_press'
  - conditions:
    - '{{ command == ''2_single'' }}'
    sequence: !input 'button_two_short_press'
  - conditions:
    - '{{ command == ''3_single'' }}'
    sequence: !input 'button_three_short_press'
  - conditions:
    - '{{ command == ''1_double'' }}'
    sequence: !input 'button_one_double_press'
  - conditions:
    - '{{ command == ''2_double'' }}'
    sequence: !input 'button_two_double_press'
  - conditions:
    - '{{ command == ''3_double'' }}'
    sequence: !input 'button_three_double_press'
  - conditions:
    - '{{ command == ''1_hold'' }}'
    sequence: !input 'button_one_long_press'
  - conditions:
    - '{{ command == ''2_hold'' }}'
    sequence: !input 'button_two_long_press'
  - conditions:
    - '{{ command == ''3_hold'' }}'
    sequence: !input 'button_three_long_press'
1 Like

Does this work now?
I had it initially seemed to be able to add the device to automation. Didn’t work tho.
Tried yours and the top version.

WHere do you see that debug log?

It seems to be working on and off. Will continue testing.

Just doesn’t work half the time. Same button pressed, 10s apart

and

Sometimes this error


(script.aircon_power) turned off
Stopped because of unknown reason "null" at November 7, 2022 at 11:19:26 PM (runtime: 1.51 seconds)

No idea, since it’s finished

I have exactly the same problem as
aussie1497

the button returns ’ ’ instead of returning 1_single.

It randomly returns either nothing or 1_single

Same problem, same symptoms, how to return to normal performance?

I got it :slight_smile:

If you are using Zigbee2MQTT, you do not need an attribute as the status is transmitted directly by the sensor.

I have commented out the attribute line and reloaded the yaml files.

Now it works! :slight_smile:

i dont know what you mean with anything you said, but i do know i need to do thos…

So what did you do ?

Is there any way to reduce the amount of time the hold action takes to register? It’s like 3 full seconds when just natively used by Zigbee2MQTT without a blueprint. Pretty cumbersome.

Hello

I have the model 3 with covers buttons ( up, down, stop)

I never successed to make this blueprint working even with modifications suggested into this thread

I used this one instead and it work fine (I don’t use the button 4)

Jubii This worked a day. Now I have the same problem with Error: UndefinedError: ‘dict object’ has no attribute ‘to_state’.

I have to admit I am not a programmer so I am stealing from you clever people. So I can’t troubleshoot anything around the code myself.

I were surprised it worked in the first place because I read about how to implement unsupported devices specially from Tuya into mqtt2Zigbee and that was very technical.

Cheers

Hey folks! I’ve faced with strange behaviour of this blueprint.

The first action triggers okay, but all the next fail or cancel.

I’ve made a little debug session and figured out what it was.
The problem is related to mode: restart property.

Since the action of this switch goes in part with an empty one, this empty action restarts the first execution.

To fix this issue I just changed it to the queued value and the issues are gone.
image

Maybe it will help someone and save some time :wink: