zigbee-herdsman-converters
Version:
Collection of device converters to be used with zigbee-herdsman
392 lines • 20.7 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.definitions = void 0;
const exposes = __importStar(require("../lib/exposes"));
const m = __importStar(require("../lib/modernExtend"));
const reporting = __importStar(require("../lib/reporting"));
const tuya = __importStar(require("../lib/tuya"));
const e = exposes.presets;
const ea = exposes.access;
exports.definitions = [
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_s139roas"]),
model: "ZWSH16",
vendor: "AVATTO",
description: "Smart Temperature and Humidity Detector",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await tuya.configureMagicPacket(device, coordinatorEndpoint);
await endpoint.command("manuSpecificTuya", "mcuVersionRequest", { seq: 0x0002 });
},
exposes: [e.battery(), e.temperature(), e.humidity(), tuya.exposes.temperatureUnit(), tuya.exposes.batteryState()],
meta: {
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_ybsqljjg", "_TZE200_cxakecfo", "_TZE200_4aijvczq"]),
model: "ME168_AVATTO",
vendor: "AVATTO",
description: "Thermostatic radiator valve",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
whiteLabel: [tuya.whitelabel("Girier", "ME168_Girier", "Thermostatic radiator valve", ["_TZE200_cxakecfo", "_TZE200_4aijvczq"])],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
ota: true,
exposes: [
e.battery(),
//! to fix as the exposed format is bitmap
e
.numeric("error", ea.STATE)
.withDescription('If NTC is damaged, "Er" will be on the TRV display.'),
e.child_lock().withCategory("config"),
e
.enum("running_mode", ea.STATE, ["auto", "manual", "off", "eco", "comfort", "boost"])
.withDescription("Actual TRV running mode")
.withCategory("diagnostic"),
e
.climate()
.withSystemMode(["off", "heat", "auto"], ea.STATE_SET, "Basic modes")
.withPreset(["eco", "comfort", "boost"], "Additional heat modes")
.withRunningState(["idle", "heat"], ea.STATE)
.withSetpoint("current_heating_setpoint", 4, 35, 1, ea.STATE_SET)
.withLocalTemperature(ea.STATE)
.withLocalTemperatureCalibration(-30, 30, 1, ea.STATE_SET),
e
.binary("window_detection", ea.STATE_SET, "ON", "OFF")
.withDescription("Enables/disables window detection on the device")
.withCategory("config"),
e.window_open(),
e
.binary("frost_protection", ea.STATE_SET, "ON", "OFF")
.withDescription("When the room temperature is lower than 5 °C, the valve opens; when the temperature rises to 8 °C, the valve closes.")
.withCategory("config"),
e
.binary("scale_protection", ea.STATE_SET, "ON", "OFF")
.withDescription("If the heat sink is not fully opened within " +
"two weeks or is not used for a long time, the valve will be blocked due to silting up and the heat sink will not be " +
"able to be used. To ensure normal use of the heat sink, the controller will automatically open the valve fully every " +
'two weeks. It will run for 30 seconds per time with the screen displaying "Ad", then return to its normal working state ' +
"again.")
.withCategory("config"),
e
.numeric("boost_time", ea.STATE_SET)
.withUnit("min")
.withDescription("Boost running time")
.withValueMin(0)
.withValueMax(255)
.withCategory("config"),
e.numeric("boost_timeset_countdown", ea.STATE).withUnit("min").withDescription("Boost time remaining"),
e.eco_temperature().withValueMin(5).withValueMax(35).withValueStep(1).withCategory("config"),
e.comfort_temperature().withValueMin(5).withValueMax(35).withValueStep(1).withCategory("config"),
...tuya.exposes
.scheduleAllDays(ea.STATE_SET, "06:00/21.0 08:00/16.0 12:00/21.0 14:00/16.0 18:00/21.0 22:00/16.0")
.map((text) => text.withCategory("config")),
],
meta: {
tuyaDatapoints: [
// mode (RW Enum [0=auto, 1=manual, 2=off, 3=eco, 4=comfort, 5=boost])
[
2,
null,
tuya.valueConverter.thermostatSystemModeAndPresetMap({
fromMap: {
0: { deviceMode: "auto", systemMode: "auto", preset: "none" },
1: { deviceMode: "manual", systemMode: "heat", preset: "none" },
2: { deviceMode: "off", systemMode: "off", preset: "none" },
3: { deviceMode: "eco", systemMode: "heat", preset: "eco" },
4: { deviceMode: "comfort", systemMode: "heat", preset: "comfort" },
5: { deviceMode: "boost", systemMode: "heat", preset: "boost" },
},
}),
],
[
2,
"system_mode",
tuya.valueConverter.thermostatSystemModeAndPresetMap({
toMap: {
auto: new tuya.Enum(0), // auto
heat: new tuya.Enum(1), // manual
off: new tuya.Enum(2), // off
},
}),
],
[
2,
"preset",
tuya.valueConverter.thermostatSystemModeAndPresetMap({
toMap: {
none: new tuya.Enum(1), // manual
eco: new tuya.Enum(3), // eco
comfort: new tuya.Enum(4), // comfort
boost: new tuya.Enum(5), // boost
},
}),
],
// work_state (RO Enum [0=opened, 1=closed])
[ ],
// temp_set (RW Integer, 40-350 C, scale 1 step 10)
[ ],
// temp_current (RO Integer, -0-500 C, scale 1 step 10)
[ ],
// battery_percentage (RO, Integer, 0-100 %, scale 0 step 1)
[ ],
// child_lock (RW Boolean)
[ ],
//! load_status (RW, Enum, range [0=closed, 1=opened]) - Non-functional
// [13, 'load_status', tuya.valueConverterBasic.lookup({CLOSE: tuya.enum(0), OPEN: tuya.enum(1)})],
// window_check (RW Boolean)
[ ],
// window_state (RO Enum, range [0=opened, 1=closed])
[ ],
// week_program_13_(1-7) (RW Raw, maxlen 128, special binary-in-base64 format)
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
//? error (RO Bitmap, maxlen 2, label [0x=low_battery, x0=sensor_fault]?)
[ ],
// frost (RW Boolean)
[ ],
//! rapid_switch (RW Boolean) - Non-functional
// [37, 'rapid_switch', tuya.valueConverter.onOff],
//! rapid_countdown (RW Integer, 1-12 h, scale 0 step 1) - Non-functional
// [38, 'rapid_countdown', tuya.valueConverter.raw],
// scale_switch (RW Boolean)
[ ],
// temp_correction (RW Integer, -10-10 C, scale 0 step 1)
[ ],
// comfort_temp (RW Integer, 100-250 C, scale 1 step 10)
[ ],
//! switch (RW Boolean) - Non-functional
// [102, 'switch', tuya.valueConverter.onOff],
// rapid_time_set (RW Integer, 0-180 min, scale 0 step 1)
[ ],
// heating_countdown (RO Integer, 0-3600 min, scale 0 step 1)
[ ],
// eco_temp (RW Integer, 100-200 C, scale 1 step 10)
[ ],
//! eco (RW Boolean) - Non-functional
// [106, 'eco', tuya.valueConverter.onOff],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_goecjd1t"]),
model: "ZWPM16",
vendor: "AVATTO",
description: "Zigbee smart energy meter",
extend: [tuya.modernExtend.tuyaBase({ dp: true })],
exposes: [
e.power(),
e.voltage(),
e.current(),
e.energy(),
e.numeric("daily_energy", ea.STATE).withUnit("kWh").withDescription("Daily energy"),
],
meta: {
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_jrcfsaa3"]),
model: "ZWPM16-2",
vendor: "AVATTO",
description: "Zigbee smart energy meter 80A/2CH",
extend: [tuya.modernExtend.tuyaBase({ dp: true })],
exposes: [
tuya.exposes.voltageWithPhase("l1"),
tuya.exposes.powerWithPhase("l1"),
tuya.exposes.currentWithPhase("l1"),
tuya.exposes.energyWithPhase("l1"),
e.numeric("daily_energy_l1", ea.STATE).withUnit("kWh").withDescription("Daily energy L1"),
tuya.exposes.voltageWithPhase("l2"),
tuya.exposes.powerWithPhase("l2"),
tuya.exposes.currentWithPhase("l2"),
tuya.exposes.energyWithPhase("l2"),
e.numeric("daily_energy_l2", ea.STATE).withUnit("kWh").withDescription("Daily energy L2"),
],
meta: {
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_sdykkwsu"]),
model: "ZDMS16-US-W2",
vendor: "AVATTO",
description: "Zigbee 2 channels dimmer",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.lightBrightnessWithMinMax().withEndpoint("l1"),
tuya.exposes.countdown().withEndpoint("l1"),
tuya.exposes.switchType().withEndpoint("l1"),
tuya.exposes.lightBrightnessWithMinMax().withEndpoint("l2"),
tuya.exposes.countdown().withEndpoint("l2"),
tuya.exposes.switchType().withEndpoint("l2"),
e.power_on_behavior().withAccess(ea.STATE_SET),
],
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
endpoint: (device) => {
return { l1: 1, l2: 1 };
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_5cuocqty", "_TZE204_nqqylykc", "_TZE204_2cyb66xl", "_TZE204_tgdnh7pw"]),
model: "ZDMS16-1",
vendor: "AVATTO",
description: "Zigbee Module 1 channel Dimmer",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.lightBrightnessWithMinMax(),
tuya.exposes.countdown(),
tuya.exposes.switchType(),
e.power_on_behavior().withAccess(ea.STATE_SET),
],
meta: {
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_o9gyszw2", "_TZE204_jtbgusdc"]),
model: "ZDMS16-2",
vendor: "AVATTO",
description: "Zigbee Module 2 channels Dimmer",
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.lightBrightnessWithMinMax().withEndpoint("l1"),
tuya.exposes.countdown().withEndpoint("l1"),
tuya.exposes.switchType().withEndpoint("l1"),
tuya.exposes.lightBrightnessWithMinMax().withEndpoint("l2"),
tuya.exposes.countdown().withEndpoint("l2"),
tuya.exposes.switchType().withEndpoint("l2"),
e.power_on_behavior().withAccess(ea.STATE_SET),
],
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
],
},
endpoint: (device) => {
return { l1: 1, l2: 1 };
},
},
{
fingerprint: tuya.fingerprint("TS0011", ["_TZ3000_hbxsdd6k"]),
model: "LZWSM16-1",
description: "1 gang switch module - (without neutral)",
vendor: "AVATTO",
extend: [tuya.modernExtend.tuyaOnOff({ switchType: true, onOffCountdown: true }), m.forcePowerSource({ powerSource: "Mains (single phase)" })],
configure: async (device, coordinatorEndpoint) => {
await tuya.configureMagicPacket(device, coordinatorEndpoint);
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ["genOnOff"]);
},
},
];
//# sourceMappingURL=avatto.js.map