Tell me how to set up the zigbee2mqtt relay correctly

Hello friends! I have never connected a zigbee relay to openhab and ran into a small problem, namely, from openhab, the relay turns on and off perfectly and correctly shows the status of its operation (on/off). But if I turn on the relay with a push-button switch, the operation status in openhab does not change. I assume that openhab does not get the correct topic from zigbee2mqtt and therefore does not change the status of the switch. Can you tell me what I’m doing wrong? I am writing with a translator, sorry if it is not very clear and with errors.
The relay I use TuYa TS0011_switch_module control via MQTT | Zigbee2MQTT
As configured, you can see in the code. I would be grateful for any help!

UID: mqtt:topic:MQTT_Broker:FanRelayBathroom
label: Вентилятор(ванная)
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:MQTT_Broker
location: Ванная
  - id: FanRelayBathroom
    channelTypeUID: mqtt:switch
    label: Вентилятор(ванная)
    description: ""
      commandTopic: zigbee2mqtt/FanRelayBathroom/set
      postCommand: false
      qos: 0
      stateTopic: zigbee2mqtt/FanRelayBathroom/set
      off: OFF
      on: ON

From OH’s perspective, this has nothing to do with Zigbee. This is an MQTT problem so it will help the right people find this post you should say zigbee2mqtt in the title.

Please do not post screen shots. There’s a “Code” tab. Click that and post the text found there using code fences.

code goes here

Please search the Tutorials and Solutions section of this forum where you will find a number of zigbee2mqtt tutorials which will useful to finding the mistake here. An MQTT client like MQTT Explorer is also a great resource to see what’s being published to which topics.

You are correct to focus on the state topic but I don’t use zigbee2mqtt and cannot help further.

1 Like

Thank you for the advice! I corrected the message, as you requested.

Your stateTopic is wrong: remove /set and set “Incoming Value Transformations” to JSONPATH:$.state

1 Like

Thanks! Everything worked!