zigbee-herdsman-converters
Version:
Collection of device converters to be used with zigbee-herdsman
485 lines • 25.6 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 fz = __importStar(require("../converters/fromZigbee"));
const exposes = __importStar(require("../lib/exposes"));
const legacy = __importStar(require("../lib/legacy"));
const m = __importStar(require("../lib/modernExtend"));
const tuya = __importStar(require("../lib/tuya"));
const e = exposes.presets;
const ea = exposes.access;
const te = tuya.exposes;
const NAS_PS10B2_PRESENCE_TIME_MIN = 3; // seconds, per device spec
const NAS_PS10B2_PRESENCE_TIME_MAX = 600; // seconds, per device spec
exports.definitions = [
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_d0yu2xgi"]),
zigbeeModel: ["0yu2xgi"],
model: "NAS-AB02B0",
vendor: "NEO",
description: "Temperature & humidity sensor and alarm",
fromZigbee: [legacy.fz.neo_t_h_alarm, fz.ignore_tuya_set_time],
toZigbee: [legacy.tz.neo_t_h_alarm],
exposes: [
e.temperature(),
e.humidity(),
e.binary("humidity_alarm", ea.STATE_SET, true, false),
e.battery_low(),
e.binary("temperature_alarm", ea.STATE_SET, true, false),
e.binary("alarm", ea.STATE_SET, true, false),
e.enum("melody", ea.STATE_SET, Array.from(Array(18).keys()).map((x) => (x + 1).toString())),
e.numeric("duration", ea.STATE_SET).withUnit("s").withValueMin(0).withValueMax(1800),
e.numeric("temperature_min", ea.STATE_SET).withUnit("°C").withValueMin(-20).withValueMax(80),
e.numeric("temperature_max", ea.STATE_SET).withUnit("°C").withValueMin(-20).withValueMax(80),
e.numeric("humidity_min", ea.STATE_SET).withUnit("%").withValueMin(1).withValueMax(100),
e.numeric("humidity_max", ea.STATE_SET).withUnit("%").withValueMin(1).withValueMax(100),
e.enum("volume", ea.STATE_SET, ["low", "medium", "high"]),
e.enum("power_type", ea.STATE, ["battery_full", "battery_high", "battery_medium", "battery_low", "usb"]),
],
extend: [tuya.modernExtend.tuyaBase({ forceTimeUpdates: true, queryOnConfigure: true, mcuVersionRequestOnConfigure: true })],
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_t1blo2bj", "_TZE204_t1blo2bj", "_TZE204_q76rtoa9"]),
zigbeeModel: ["1blo2bj", "lrfgpny", "q76rtoa9"],
model: "NAS-AB02B2",
vendor: "NEO",
description: "Alarm",
fromZigbee: [legacy.fz.neo_alarm],
toZigbee: [legacy.tz.neo_alarm],
exposes: [
e.battery_low(),
e.binary("alarm", ea.STATE_SET, true, false),
e.enum("melody", ea.STATE_SET, Array.from(Array(18).keys()).map((x) => (x + 1).toString())),
e.numeric("duration", ea.STATE_SET).withUnit("s").withValueMin(0).withValueMax(1800),
e.enum("volume", ea.STATE_SET, ["low", "medium", "high"]),
e.numeric("battpercentage", ea.STATE).withUnit("%"),
],
extend: [tuya.modernExtend.tuyaBase({ forceTimeUpdates: true, queryOnConfigure: true, mcuVersionRequestOnConfigure: true })],
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_7hfcudw5"]),
model: "NAS-PD07",
vendor: "NEO",
description: "Motion, temperature & humidity sensor",
fromZigbee: [legacy.fz.neo_nas_pd07, fz.ignore_tuya_set_time],
toZigbee: [legacy.tz.neo_nas_pd07],
extend: [tuya.modernExtend.tuyaBase({ mcuVersionRequestOnConfigure: true })],
exposes: [
e.occupancy(),
e.humidity(),
e.temperature(),
e.tamper(),
e.battery_low(),
e.enum("power_type", ea.STATE, ["battery_full", "battery_high", "battery_medium", "battery_low", "usb"]),
e
.enum("alarm", ea.STATE, ["over_temperature", "over_humidity", "below_min_temperature", "below_min_humdity", "off"])
.withDescription("Temperature/humidity alarm status"),
e.numeric("temperature_min", ea.STATE_SET).withUnit("°C").withValueMin(-20).withValueMax(80),
e.numeric("temperature_max", ea.STATE_SET).withUnit("°C").withValueMin(-20).withValueMax(80),
e.binary("temperature_scale", ea.STATE_SET, "°C", "°F").withDescription("Temperature scale (°F/°C)"),
e.numeric("humidity_min", ea.STATE_SET).withUnit("%").withValueMin(1).withValueMax(100),
e.numeric("humidity_max", ea.STATE_SET).withUnit("%").withValueMin(1).withValueMax(100),
// e.binary('unknown_111', ea.STATE_SET, 'ON', 'OFF').withDescription('Unknown datapoint 111 (default: ON)'),
// e.binary('unknown_112', ea.STATE_SET, 'ON', 'OFF').withDescription('Unknown datapoint 112 (default: ON)')
],
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_nlrfgpny", "_TZE284_nlrfgpny", "_TZE204_nlrfgpny"]),
model: "NAS-AB06B2",
vendor: "NEO",
description: "Outdoor solar alarm",
extend: [tuya.modernExtend.tuyaBase({ dp: true })],
exposes: [
e.enum("alarm_state", ea.STATE, ["alarm_sound", "alarm_light", "alarm_sound_light", "normal"]).withDescription("Alarm status"),
e.binary("alarm_switch", ea.STATE_SET, "ON", "OFF").withDescription("Enable alarm"),
e.binary("tamper_alarm_switch", ea.STATE_SET, "ON", "OFF").withDescription("Enable tamper alarm"),
e.binary("tamper_alarm", ea.STATE, "ON", "OFF").withDescription("Indicates whether the device is tampered"),
e.enum("alarm_melody", ea.STATE_SET, ["melody_1", "melody_2", "melody_3"]).withDescription("Alarm sound effect"),
e.enum("alarm_mode", ea.STATE_SET, ["alarm_sound", "alarm_light", "alarm_sound_light"]).withDescription("Alarm mode"),
e
.numeric("alarm_time", ea.STATE_SET)
.withValueMin(1)
.withValueMax(60)
.withValueStep(1)
.withUnit("min")
.withDescription("Alarm duration in minutes"),
e.binary("charging", ea.STATE, true, false).withDescription("Charging status"),
e.battery(),
],
meta: {
tuyaDatapoints: [
[
1,
"alarm_state",
tuya.valueConverterBasic.lookup({
alarm_sound: tuya.enum(0),
alarm_light: tuya.enum(1),
alarm_sound_light: tuya.enum(2),
no_alarm: tuya.enum(3),
}),
],
[],
[],
[],
[],
[
102,
"alarm_mode",
tuya.valueConverterBasic.lookup({ alarm_sound: tuya.enum(0), alarm_light: tuya.enum(1), alarm_sound_light: tuya.enum(2) }),
],
[],
[],
[],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", [
"_TZE204_rzrrjkz2",
"_TZE284_rzrrjkz2",
"_TZE204_uab532m0",
"_TZE284_uab532m0",
"_TZE204_nnhwcvbk",
"_TZE284_nnhwcvbk",
"_TZE204_z7a2jmyy",
"_TZE284_z7a2jmyy",
"_TZE204_4fblxpma",
"_TZE284_4fblxpma",
]),
model: "NAS-WV03B",
vendor: "NEO",
extend: [tuya.modernExtend.tuyaBase({ dp: true, timeStart: "2000" })],
description: "Smart sprinkler timer with measurements",
whiteLabel: [
tuya.whitelabel("Nous", "L14", "Smart water valve", ["_TZE204_nnhwcvbk", "_TZE284_nnhwcvbk"]),
tuya.whitelabel("NEO", "NAS-WV05B2", "Smart sprinkler timer", ["_TZE284_rzrrjkz2", "_TZE284_uab532m0"]),
tuya.whitelabel("NEO", "NAS-WV05B2-L", "Smart sprinkler timer", ["_TZE284_z7a2jmyy"]),
],
exposes: (device, options) => [
te.switch(),
te.status_sprinkler(),
te.refresh(),
te.countdown_min(),
...(!device || !["_TZE204_4fblxpma", "_TZE284_4fblxpma"].includes(device.manufacturerName) ? [te.on_with_countdown()] : []), // missing dp
te.countdown_left(),
te.single_watering_duration(),
te.flow_switch(),
...(!device || ["_TZE204_z7a2jmyy", "_TZE284_z7a2jmyy"].includes(device.manufacturerName)
? [
te.quantitative_watering(), // liters
te.single_watering_amount(),
te.surplus_flow(),
te.water_current(),
te.water_total(),
]
: [
te.quantitative_watering().withUnit("gal"), // gallons by default
te.single_watering_amount().withUnit("gal"),
te.surplus_flow().withUnit("gal"),
te.water_current().withUnit("gal/min"),
te.water_total().withUnit("gal"),
]),
te.water_total_reset(),
// e.text("normal_timer", ea.STATE_SET).withDescription("Schedule the sprinkler: time and weekdays"),
// e.enum("weather_delay", ea.STATE_SET, ["24h", "48h", "72h", "cancel"]).withDescription("Unknown"),
// e.binary("weather_switch", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
// e.binary("smart_irrigation", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
// e.binary("quantitative_water_linkage", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
te.fault(),
e.child_lock(),
e.battery(),
],
meta: {
tuyaDatapoints: [
[],
[
3,
"status",
tuya.valueConverterBasic.lookup({
off: tuya.enum(0),
on_auto: tuya.enum(1),
button_locked: tuya.enum(2),
on_manual_app: tuya.enum(3),
on_manual_button: tuya.enum(4),
}),
],
[], // (time)
[],
[],
[], // (battery_percentage)
[],
[],
[
37,
"weather_delay",
tuya.valueConverterBasic.lookup({
"24h": tuya.enum(0),
"48h": tuya.enum(1),
"72h": tuya.enum(2),
cancel: tuya.enum(3),
}),
],
[], // string needs reverse-engineering
[], // (switch)
[], // (switch_enabled)
[], // (total_flow_reset_switch)
[],
[], // (current_switch)
[],
[],
[], // (single_watering_time)
[], // (ui_refresh)
[],
[], // (valve_opening_time)
[],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_a9ojznj8", "_TZE284_a9ojznj8"]),
model: "NAS-WV03B2",
vendor: "NEO",
description: "Smart sprinkler timer",
extend: [tuya.modernExtend.tuyaBase({ dp: true, timeStart: "2000" })],
exposes: [
te.switch(),
te.status_sprinkler(),
te.refresh(),
te.countdown_min(),
te.on_with_countdown(),
te.countdown_left(),
te.single_watering_duration(),
// e.text("normal_timer", ea.STATE_SET).withDescription("Schedule the sprinkler: time and weekdays"),
// e.enum("weather_delay", ea.STATE_SET, ["24h", "48h", "72h", "cancel"]).withDescription("Unknown"),
// e.binary("weather_switch", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
// e.binary("smart_irrigation", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
// e.binary("quantitative_water_linkage", ea.STATE_SET, "ON", "OFF").withDescription("Unknown"),
te.fault(),
e.child_lock(),
e.battery(),
],
meta: {
tuyaDatapoints: [
[],
[
3,
"status",
tuya.valueConverterBasic.lookup({
off: tuya.enum(0),
on_auto: tuya.enum(1),
button_locked: tuya.enum(2),
on_manual_app: tuya.enum(3),
on_manual_button: tuya.enum(4),
}),
],
[], // (time)
[],
[], // (battery_percentage)
[],
[
37,
"weather_delay",
tuya.valueConverterBasic.lookup({
"24h": tuya.enum(0),
"48h": tuya.enum(1),
"72h": tuya.enum(2),
cancel: tuya.enum(3),
}),
],
[], // string needs reverse-engineering
[], // (switch)
[], // (switch_enabled)
[], // (valve_opening_time)
[],
[], // (single_watering_time)
[], // (ui_refresh)
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE284_rqcuwlsa", "_TZE284_awepdiwi"]),
model: "NAS-STH02B2",
vendor: "NEO",
description: "Soil moisture, temperature, and ec",
extend: [tuya.modernExtend.tuyaBase({ dp: true })],
exposes: [
e.numeric("ec", ea.STATE).withUnit("µS/cm").withValueMin(0).withValueMax(20000).withDescription("Soil electrical conductivity"),
e.enum("fertility", ea.STATE, ["normal", "lower", "low", "middle", "high", "higher"]).withDescription("Soil fertility"),
e.numeric("humidity", ea.STATE).withUnit("%").withValueMin(0).withValueMax(100).withDescription("Soil humidity"),
e.numeric("temperature", ea.STATE).withUnit("°C").withValueMin(-10).withValueMax(60).withDescription("Soil temperature"),
e.numeric("temperature_f", ea.STATE).withUnit("°F").withValueMin(14).withValueMax(140).withDescription("Soil temperature"),
e
.numeric("temperature_sensitivity", ea.STATE_SET)
.withUnit("°C")
.withValueMin(0.3)
.withValueMax(1)
.withValueStep(0.1)
.withDescription("Upper temperature limit"),
e.numeric("humidity_sensitivity", ea.STATE_SET).withUnit("%").withValueMin(1).withValueMax(5).withDescription("Upper temperature limit"),
e.enum("temperature_alarm", ea.STATE, ["lower_alarm", "upper_alarm", "cancel"]).withDescription("Temperature alarm state"),
e.enum("humidity_alarm", ea.STATE, ["lower_alarm", "upper_alarm", "cancel"]).withDescription("Humidity alarm state"),
e
.numeric("max_temperature_alarm", ea.STATE_SET)
.withUnit("°C")
.withValueMin(0)
.withValueMax(60)
.withDescription("Upper temperature limit"),
e
.numeric("min_temperature_alarm", ea.STATE_SET)
.withUnit("°C")
.withValueMin(0)
.withValueMax(60)
.withDescription("Lower temperature limit"),
e.numeric("max_humidity_alarm", ea.STATE_SET).withUnit("%").withValueMin(0).withValueMax(100).withDescription("Upper humidity limit"),
e.numeric("min_humidity_alarm", ea.STATE_SET).withUnit("%").withValueMin(0).withValueMax(100).withDescription("Lower humidity limit"),
e.numeric("schedule_periodic", ea.STATE_SET).withUnit("min").withValueMin(5).withValueMax(60).withDescription("Report sensitivity"),
te.batteryState(),
e.battery(),
],
meta: {
tuyaDatapoints: [
[], // unit and scale need verification
[], // moisture
[],
[],
// [9, "temp_unit_convert", tuya.valueConverter.temperatureUnitEnum],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[], // detection_interval_time
[],
// [111, "temperature_sensitivity_f", tuya.valueConverter.divideBy10],
// [112, "max_temperature_alarm_f", tuya.valueConverter.divideBy10],
// [113, "min_temperature_alarm_f", tuya.valueConverter.divideBy10],
],
},
},
{
fingerprint: tuya.fingerprint("SNZB-02", ["_TZ3000_utwgoauk"]),
model: "NAS-TH07B2",
vendor: "NEO",
description: "Temperature & humidity sensor",
extend: [m.temperature(), m.humidity(), m.battery()],
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE204_1youk3hj", "_TZE284_1youk3hj"]),
model: "NAS-PS10B2",
vendor: "NEO",
description: "Human presence sensor",
extend: [tuya.modernExtend.tuyaBase({ dp: true, queryOnDeviceAnnounce: true })],
exposes: [
e.presence(),
e.enum("human_motion_state", ea.STATE, ["none", "small", "large"]).withDescription("Human Motion State"),
e
.numeric("dis_current", ea.STATE)
.withUnit("cm")
.withValueMin(0)
.withValueMax(600)
.withValueStep(1)
.withLabel("Current distance")
.withDescription("Current distance of detected motion"),
e
.numeric("presence_time", ea.STATE_SET)
.withUnit("s")
.withValueMin(NAS_PS10B2_PRESENCE_TIME_MIN)
.withValueMax(NAS_PS10B2_PRESENCE_TIME_MAX)
.withValueStep(1)
.withDescription("Presence Time"),
e
.numeric("motion_far_detection", ea.STATE_SET)
.withUnit("cm")
.withValueMin(150)
.withValueMax(600)
.withValueStep(75)
.withDescription("Motion Range Detection"),
e
.numeric("motion_sensitivity", ea.STATE_SET)
.withValueMin(0)
.withValueMax(7)
.withValueStep(1)
.withDescription("Motion Detection Sensitivity"),
e
.numeric("motionless_sensitivity", ea.STATE_SET)
.withValueMin(0)
.withValueMax(7)
.withValueStep(1)
.withDescription("Motionless Detection Sensitivity"),
e.enum("work_mode", ea.STATE_SET, ["manual", "auto"]).withDescription("Work Mode"),
e.binary("output_switch", ea.STATE_SET, "ON", "OFF").withDescription("Output Switch"),
e.numeric("output_time", ea.STATE_SET).withUnit("s").withValueMin(10).withValueMax(1800).withDescription("Output Times"),
e.binary("led_switch", ea.STATE_SET, "ON", "OFF").withDescription("Led Switch"),
e.enum("lux_value", ea.STATE_SET, ["10_lux", "20_lux", "50_lux", "24h"]).withDescription("Lux Value"),
],
meta: {
tuyaDatapoints: [
[],
[],
[],
[
12,
"presence_time",
{
// Device sends 0xFFFFFF08 as sentinel when presence_time has never been
// configured. Filter it out to prevent HA range errors.
// Device will re-report its stored value after reboot via queryOnDeviceAnnounce.
from: (v) => (v >= NAS_PS10B2_PRESENCE_TIME_MIN && v <= NAS_PS10B2_PRESENCE_TIME_MAX ? v : undefined),
to: (v) => v,
},
],
[],
[],
[],
[],
[],
[],
[],
[
102,
"lux_value",
tuya.valueConverterBasic.lookup({ "10_lux": tuya.enum(0), "20_lux": tuya.enum(1), "50_lux": tuya.enum(2), "24h": tuya.enum(3) }),
],
],
},
},
];
//# sourceMappingURL=neo.js.map