Set Up MQTT Tuya Door Sensor

Hi there,

is there anyone who can help me to get channels configured for my doorsensor(s)?

I managed to get the according thing set up in OpenHab and it shows “online”, but that’s it.

I would really like to have something like, send a notification (to Telegram Channel?) if the door opens as long as “security” is enabled. mosquitto shows me messages like that on the raspberry:

Client mosqsub|5205-raspberryp received PUBLISH (d0, q0, r0, m0, ‘zigbee2mqtt/bridge/logging’, … (198 bytes))
{“level”:“info”,“message”:“MQTT publish: topic ‘zigbee2mqtt/ZigbeeStick01’, payload ‘{“battery”:100,“battery_low”:false,“contact”:false,“linkquality”:55,“tamper”:false,“voltage”:3000}’”}
Client mosqsub|5205-raspberryp received PUBLISH (d0, q0, r0, m0, ‘zigbee2mqtt/ZigbeeStick01’, … (98 bytes))
{“battery”:100,“battery_low”:false,“contact”:false,“linkquality”:55,“tamper”:false,“voltage”:3000}
Client mosqsub|5205-raspberryp received PUBLISH (d0, q0, r0, m0, ‘zigbee2mqtt/bridge/logging’, … (197 bytes))
{“level”:“info”,“message”:“MQTT publish: topic ‘zigbee2mqtt/ZigbeeStick01’, payload ‘{“battery”:100,“battery_low”:false,“contact”:true,“linkquality”:42,“tamper”:false,“voltage”:3000}’”}
Client mosqsub|5205-raspberryp received PUBLISH (d0, q0, r0, m0, ‘zigbee2mqtt/ZigbeeStick01’, … (97 bytes))
{“battery”:100,“battery_low”:false,“contact”:true,“linkquality”:42,“tamper”:false,“voltage”:3000}

Sometimes I get them displayed in the Event Monitor in OpenHab as well. I have set up the MQTT Broker succesfully, it seems.

But I have no clue what to set in the Channel configuration:
MGTT State Topic: ? - I have: zigbee2mqtt/ZigbeeStick01/contact
Custom On/Open Value: ? - I have: true
Custom Off/Closed Value: ? - I have: false

But the Item I added always says “NULL”

Any hint would be really appreciated!

  • Platform information: OpenHab on Synology NAS, CC2531 USB Stick on Raspberry
    • Hardware: enough
    • OS: what OS is used and which version
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 3.10
  • Issue of the topic: How to get the channels configured?
  • Please post configurations (if applicable):
    UID: mqtt:topic:5853b352e1:3b7401a072
    label: Türsensor 1 Esszimmer Rechts
    thingTypeUID: mqtt:topic
    configuration: {}
    bridgeUID: mqtt:broker:5853b352e1
    location: Esszimmer Rechts
    channels:
    • id: Tuerstatus
      channelTypeUID: mqtt:contact
      label: Tür Status
      description: “”
      configuration:
      stateTopic: zigbee2mqtt/ZigbeeStick01/contact
      off: “false”
      on: “true”

Here is working version:

  - id: contact
    channelTypeUID: mqtt:contact
    label: Сontact
    description: null
    configuration:
      stateTopic: zigbee2mqtt/ZigbeeStick01
      transformationPattern: REGEX:(.*\"contact\".*)∩JSONPATH:$.contact
      off: "true"
      on: "false"

You have to install RegEx and JSONPath transformations Add-ons

2 Likes

Wow, that worked instantly! I was 3 evenings trying to find the right way - thank you so much!

It worked to me too! Thnx!