Skip to content

Instantly share code, notes, and snippets.

@ccfiel
Last active July 31, 2025 16:18
Show Gist options
  • Select an option

  • Save ccfiel/532d0000c2ec584a5e4ff3728c2ebe3c to your computer and use it in GitHub Desktop.

Select an option

Save ccfiel/532d0000c2ec584a5e4ff3728c2ebe3c to your computer and use it in GitHub Desktop.
Zigbee2Mqtt Add zemismart Tuya Zigbee Ultrasonic Water Meter Valve
import * as exposes from "zigbee-herdsman-converters/lib/exposes";
import * as tuya from "zigbee-herdsman-converters/lib/tuya";
const e = exposes.presets;
const ea = exposes.access;
/** @type {import('zigbee-herdsman-converters').Definition} */
export default {
fingerprint: [
{
modelID: "TS0601",
manufacturerName: "_TZE284_vuwtqx0t",
},
],
model: "TS0601_water_valve",
vendor: "Tuya",
description: "Ultrasonic water meter valve",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
exposes: [
// Main valve switch
e.switch().setAccess("state", ea.STATE_SET),
// Water consumption sensor
e.numeric("water_consumed", ea.STATE).withUnit("m³").withDescription("Total water consumption").withValueMin(0).withValueStep(0.001),
// Flow rate sensor
e.numeric("flow_rate", ea.STATE).withUnit("m³/h").withDescription("Instantaneous water flow rate").withValueMin(0).withValueStep(0.001),
// Temperature sensor
e.temperature(),
// Voltage monitoring
e.voltage(),
// Auto clean mode toggle
e.binary("auto_clean", ea.STATE_SET, true, false).withDescription("Auto clean mode"),
],
meta: {
tuyaDatapoints: [
[1, "water_consumed", tuya.valueConverter.divideBy1000],
[13, "state", tuya.valueConverter.onOffNotStrict],
[14, "auto_clean", tuya.valueConverter.raw],
[21, "flow_rate", tuya.valueConverter.divideBy1000],
[22, "temperature", tuya.valueConverter.divideBy100],
[26, "voltage", tuya.valueConverter.divideBy100],
],
},
// Optional: Add device-specific options
options: [
exposes.options.precision("water_consumed"),
exposes.options.calibration("water_consumed"),
exposes.options.precision("flow_rate"),
exposes.options.calibration("flow_rate"),
exposes.options.precision("temperature"),
exposes.options.calibration("temperature"),
],
};
@ccfiel
Copy link
Author

ccfiel commented Jul 29, 2025

  1. Create a folder external_converters under zigbee2mqtt
    ex: /homeassistant/zigbee2mqtt/external_converters

  2. upload tuya_water_meter_converter.mjs in external_converters folder.

  3. Reboot System

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment