I having trouble controlling a 2-button Tuya switch through Zibgee2mqtt

Hi everyone and sory my English.

I’m having trouble controlling the Tuya 2-button switch via Zigbee2mqtt as follows:

  • Openhab 3 + Zigbee2mqtt running on docker in Nas synology.
  • when using Zigbee2mqtt frontend everything works fine.
  • But when controlling from Openhab, it has a problem: turn on the switch 1 light 1 on, but when the switch is turned off, the light turns off and then turns on again; when I turn on light 2, light 1 is on again… sometimes on the contrary, it has something conflicting with each other.
  • It only works well with single button 1 switch. I have the above problem with the 2 button and 3 button switches I have.
    Below is the switch I bought and instructions for setting it up from Zigbee2mqtt.
    TuYa TS0013 control via MQTT | Zigbee2MQTT
    My config:
UID: mqtt:topic:system:Bedroom_light
label: Bedroom Wallswich
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:system
  - id: Bedroom_light_left
    channelTypeUID: mqtt:switch
    label: Bedroom Light
    description: ""
      commandTopic: zigbee2mqtt/bedroom_light/set
      stateTopic: zigbee2mqtt/bedroom_light/state_left
      off: OFF
      on: ON
  - id: Bedroom_light_right
    channelTypeUID: mqtt:switch
    label: Bedroom Light 2
    description: ""
      commandTopic: zigbee2mqtt/bedroom_light/set
      stateTopic: zigbee2mqtt/bedroom_light/state_right
      off: OFF
      on: ON


commandTopic: zigbee2mqtt/bedroom_light/set/state_left

And adjust for the right hand switch.

If this doesn’t work, please share your rules, and the MQTT messages which zigbee2mqtt publishes when you use the zigbee2mqtt UI.

Thanks @hafniumzinc !
i tried and it worked, but i think it’s still unstable.

  • It worked well with the 2-button switch
  • But with 2 other 3-button switches there is a delay. Sometimes when I send the command to turn on the light it doesn’t turn on, but when I send the command to turn off the light will come on then turn off.

I’m not knowledgeable about coding and just use opehab system settings through user interface.
Except for setting a rule for a certain action, such as a context switch to turn a light bulb on and off, I have not used a Rule for controlling the switch. I don’t understand the rule for a switch what does it mean, does it make a difference compared to not having a rule? because i only needed Things → chanel → items then I found it worked. in this case will the rule work to improve it? Or is it the signal strength?