"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 zigbee_herdsman_1 = require("zigbee-herdsman");
const m = __importStar(require("../lib/modernExtend"));
const extend = {
    comfortDisplay: m.binary({
        name: "comfort_display",
        valueOn: ["show", 0],
        valueOff: ["hide", 1],
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0002, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 },
        description: "Whether to show a comfort indicator on the device screen.",
    }),
    comfortHumidityMax: m.numeric({
        name: "comfort_humidity_max",
        unit: "%",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0105, type: zigbee_herdsman_1.Zcl.DataType.UINT16 },
        valueMin: 0,
        valueMax: 100,
        scale: 100,
        description: "Comfort parameters/Humidity maximum, in 1% steps, default 60.00%.",
    }),
    comfortHumidityMin: m.numeric({
        name: "comfort_humidity_min",
        unit: "%",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0104, type: zigbee_herdsman_1.Zcl.DataType.UINT16 },
        valueMin: 0,
        valueMax: 100,
        scale: 100,
        description: "Comfort parameters/Humidity minimum, in 1% steps, default 40.00%",
    }),
    comfortTemperatureMin: m.numeric({
        name: "comfort_temperature_min",
        unit: "°C",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0102, type: zigbee_herdsman_1.Zcl.DataType.INT16 },
        valueMin: -50.0,
        valueMax: 120.0,
        valueStep: 0.01,
        scale: 100,
        description: "Comfort parameters/Temperature minimum, in 0.01°C steps, default 20.00°C.",
    }),
    comfortTemperatureMax: m.numeric({
        name: "comfort_temperature_max",
        unit: "°C",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0103, type: zigbee_herdsman_1.Zcl.DataType.INT16 },
        valueMin: -50.0,
        valueMax: 120.0,
        valueStep: 0.01,
        scale: 100,
        description: "Comfort parameters/Temperature maximum, in 0.01°C steps, default 25.00°C.",
    }),
    display: m.binary({
        name: "display",
        valueOn: ["on", 0],
        valueOff: ["off", 1],
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0106, type: zigbee_herdsman_1.Zcl.DataType.ENUM8 },
        description: "Whether to enable the device display.",
    }),
    humidityCalibration: m.numeric({
        name: "humidity_calibration",
        unit: "%",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0101, type: zigbee_herdsman_1.Zcl.DataType.INT16 },
        valueMin: -50.0,
        valueMax: 50.0,
        valueStep: 0.01,
        scale: 100,
        description: "Humidity calibration, in 0.01% steps, default 0%.",
    }),
    measurementInterval: m.numeric({
        name: "measurement_interval",
        unit: "s",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0107, type: zigbee_herdsman_1.Zcl.DataType.UINT8 },
        valueMin: 3,
        valueMax: 255,
        description: "Measurement interval, default 10 seconds.",
    }),
    tempCalibration: m.numeric({
        name: "temperature_calibration",
        unit: "°C",
        cluster: "hvacUserInterfaceCfg",
        attribute: { ID: 0x0100, type: zigbee_herdsman_1.Zcl.DataType.INT16 },
        valueMin: -50.0,
        valueMax: 50.0,
        valueStep: 0.01,
        scale: 100,
        description: "Temperature calibration, in 0.01° steps, default 0 °C.",
    }),
    tempDisplayMode: m.enumLookup({
        name: "temperature_display_mode",
        lookup: { celsius: 0, fahrenheit: 1 },
        cluster: "hvacUserInterfaceCfg",
        attribute: "tempDisplayMode",
        description: "The unit of the temperature displayed on the device screen.",
    }),
};
/*
    ZigbeeTLc devices with the full supported option set:
    - Temperature (+calibration)
    - Humidity (+calibration)
    - Display
    - Comfort (Temperature / Humidity)
*/
exports.definitions = [
    {
        fingerprint: [
            { modelID: "LYWSD03MMC-z", manufacturerName: "Xiaomi" },
            { modelID: "LYWSD03MMC-bz", manufacturerName: "Xiaomi" },
            { modelID: "MHO-C122-z", manufacturerName: "MiaoMiaoCe" },
            { modelID: "MHO-C122-bz", manufacturerName: "MiaoMiaoCe" },
            { modelID: "MHO-C401-z", manufacturerName: "MiaoMiaoCe" },
            { modelID: "MHO-C401-bz", manufacturerName: "MiaoMiaoCe" },
            { modelID: "MHO-C401N-z", manufacturerName: "MiaoMiaoCe" },
            { modelID: "MHO-C401N-bz", manufacturerName: "MiaoMiaoCe" },
        ],
        // LYWSD03MMC or similar with ZigbeeTLc firmware (alternative is devbis firmware)
        model: "LYWSD03MMC-z",
        vendor: "Xiaomi",
        description: "Temp & RH Monitor Lite (pvxx/ZigbeeTLc)",
        extend: [
            m.temperature({ reporting: { min: 10, max: 300, change: 10 } }),
            m.humidity({ reporting: { min: 10, max: 300, change: 50 } }),
            extend.display,
            extend.tempDisplayMode,
            extend.comfortDisplay,
            extend.comfortTemperatureMin,
            extend.comfortTemperatureMax,
            extend.comfortHumidityMin,
            extend.comfortHumidityMax,
            extend.tempCalibration,
            extend.humidityCalibration,
            extend.measurementInterval,
            m.battery(),
        ],
        ota: true,
    },
    /*
        ZigbeeTLc devices supporting:
        - Temperature (+calibration)
        - Humidity (+calibration)
        - Display
    */
    {
        fingerprint: [
            { modelID: "CGDK2-z", manufacturerName: "Qingping" },
            { modelID: "CGDK2-bz", manufacturerName: "Qingping" },
        ],
        // CGDK2 with ZigbeeTLc firmware, normal device is Bluetooth only
        model: "CGDK2",
        vendor: "Qingping",
        description: "Temp & RH Monitor Lite (pvxx/ZigbeeTLc)",
        extend: [
            m.temperature({ reporting: { min: 10, max: 300, change: 10 } }),
            m.humidity({ reporting: { min: 10, max: 300, change: 50 } }),
            extend.display,
            extend.tempDisplayMode,
            extend.tempCalibration,
            extend.humidityCalibration,
            extend.measurementInterval,
            m.battery(),
        ],
        ota: true,
    },
    /*
        ZigbeeTLc devices supporting:
        - Temperature (+calibration)
        - Humidity (+calibration)
    */
    {
        fingerprint: [
            { modelID: "TS0201-z", manufacturerName: "Tuya" },
            { modelID: "TS0201-bz", manufacturerName: "Tuya" },
            { modelID: "TH03Z-z", manufacturerName: "Tuya" },
            { modelID: "TH03Z-bz", manufacturerName: "Tuya" },
            { modelID: "ZTH01-z", manufacturerName: "Tuya" },
            { modelID: "ZTH01-bz", manufacturerName: "Tuya" },
            { modelID: "ZTH02-z", manufacturerName: "Tuya" },
            { modelID: "ZTH02-bz", manufacturerName: "Tuya" },
        ],
        // TS0201 with ZigbeeTLc firmware
        model: "TS0201-z",
        vendor: "Tuya",
        description: "Temperature & Humidity Sensor (pvxx/ZigbeeTLc)",
        extend: [
            m.temperature({ reporting: { min: 10, max: 300, change: 10 } }),
            m.humidity({ reporting: { min: 10, max: 300, change: 50 } }),
            extend.tempCalibration,
            extend.humidityCalibration,
            extend.measurementInterval,
            m.battery(),
        ],
        ota: true,
    },
];
//# sourceMappingURL=zigbeetlc.js.map