OH3: Tuya (MOES) radiator termostat control using zigbe2mqtt and MQTT

I am using last few weeks these devices:
image
It supported by zigbee2MQTT current version 1.7 and listed as “TS0601_thermostat”.
If you have OH3 and MQTT installed, manually add Generic MQTT Thing add copy to “Code” tab YAML code with configuration of channels:

label: TRV1
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:ohpi2
location: gZal
  - id: CurrentHeatingSetpoint
    channelTypeUID: mqtt:number
    label: Temperature Target
    description: ""
    configuration:
      unit: °C
      min: 5
      formatBeforePublish: '{"current_heating_setpoint": %.1f}'
      max: 35
      commandTopic: zigbee2mqtt/TRV1/set
      step: 0.5
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"current_heating_setpoint\".*)∩JSONPATH:$.current_heating_setpoint
  - id: linkquality
    channelTypeUID: mqtt:number
    label: Link Quality
    description: null
    configuration:
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"linkquality\".*)∩JSONPATH:$.linkquality
      unit: lqi
  - id: LocalTemperature
    channelTypeUID: mqtt:number
    label: Local Temperature
    description: null
    configuration:
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"local_temperature\".*)∩JSONPATH:$.local_temperature
      unit: °C
  - id: position
    channelTypeUID: mqtt:number
    label: Valve Position
    description: ""
    configuration:
      min: 0
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"position\".*)∩JSONPATH:$.position
      max: 100
  - id: SystemMode
    channelTypeUID: mqtt:string
    label: System Mode
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set
      allowedStates: heat,auto,off,manual
      formatBeforePublish: '{"system_mode": %s}'
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"system_mode\".*)∩JSONPATH:$.system_mode
  - id: preset
    channelTypeUID: mqtt:string
    label: Preset
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set
      allowedStates: manual,complex,schedule,boost,comfort,eco
      formatBeforePublish: '{"preset": %s}'
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"preset\".*)∩JSONPATH:$.preset
  - id: childlock
    channelTypeUID: mqtt:switch
    label: Child Lock
    description: ""
    configuration:
      formatBeforePublish: '{"child_lock": "%s"}'
      commandTopic: zigbee2mqtt/TRV1/set
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"child_lock\".*)∩JSONPATH:$.child_lock
      off: UNLOCK
      on: LOCK
  - id: BatteryLow
    channelTypeUID: mqtt:contact
    label: Battery low
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"battery_low\".*)∩JSONPATH:$.battery_low
      off: "false"
      on: "true"
  - id: autolock
    channelTypeUID: mqtt:string
    label: Auto Lock
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"auto_lock\".*)∩JSONPATH:$.auto_lock
  - id: awaymode
    channelTypeUID: mqtt:switch
    label: Away mode
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set/away_mode
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"away_mode\".*)∩JSONPATH:$.away_mode
      off: '"OFF"'
      on: '"ON"'
  - id: local_temperature_calibration
    channelTypeUID: mqtt:number
    label: Temperature calibration
    description: ""
    configuration:
      unit: °C
      min: -3
      max: 3
      commandTopic: zigbee2mqtt/TRV1/set/local_temperature_calibration
      step: 0.5
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"local_temperature_calibration\".*)∩JSONPATH:$.local_temperature_calibration
  - id: away_preset_days
    channelTypeUID: mqtt:number
    label: Away Preset Days
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set/away_preset_days
      unit: days
      min: 1
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"away_preset_days\".*)∩JSONPATH:$.away_preset_days
      max: 30
  - id: away_preset_temperature
    channelTypeUID: mqtt:number
    label: Away Preset Temperature
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set/away_preset_temperature
      unit: °C
      min: 5
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"away_preset_temperature\".*)∩JSONPATH:$.away_preset_temperature
      max: 25
  - id: boost_time
    channelTypeUID: mqtt:number
    label: Boost time
    description: ""
    configuration:
      unit: s
      min: 100
      max: 900
      commandTopic: zigbee2mqtt/TRV1/set/boost_time
      step: 100
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"boost_time\".*)∩JSONPATH:$.boost_time
  - id: comfort_temperature
    channelTypeUID: mqtt:number
    label: Comfort temperature
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set/comfort_temperature
      unit: °C
      min: 5
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"comfort_temperature\".*)∩JSONPATH:$.comfort_temperature
      max: 35
  - id: eco_temperature
    channelTypeUID: mqtt:number
    label: Eco temperature
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set/eco_temperature
      unit: °C
      min: 5
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"eco_temperature\".*)∩JSONPATH:$.eco_temperature
      max: 25
  - id: force
    channelTypeUID: mqtt:string
    label: Force
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set
      allowedStates: open,close,normal
      formatBeforePublish: '{"force":"%s"}'
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"force\".*)∩JSONPATH:$.force
  - id: window_detection
    channelTypeUID: mqtt:switch
    label: Window detection
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set
      formatBeforePublish: '{"window_detection":"%s"}'
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"window_detection\".*)∩JSONPATH:$.window_detection
      off: OFF
      on: ON 
  - id: week
    channelTypeUID: mqtt:string
    label: Week
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/TRV1/set
      allowedStates: 5+2,6+1,7
      formatBeforePublish: '{"week":"%s"}'
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"week\".*)∩JSONPATH:$.week
  - id: LastSeen
    channelTypeUID: mqtt:datetime
    label: Last Seen
    description: ""
    configuration:
      stateTopic: zigbee2mqtt/TRV1
      transformationPattern: REGEX:(.*\"last_seen\".*)∩JSONPATH:$.last_seen


You may need to edit commandTopics and stateTopics to reflect your settings.
There is additional topics “work days” and “holiday” schedules, but I can’t find the good way to configure them yet. Would be great if some one can share these channels settings.
Hope this data are useful and will save time.

Update: added channel LastSeen - contains date/time of last Zigbee message from device.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.