zigbee-herdsman-converters 25.12.0 → 25.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,18 +41,21 @@ const m = __importStar(require("../lib/modernExtend"));
41
41
  const reporting = __importStar(require("../lib/reporting"));
42
42
  const globalStore = __importStar(require("../lib/store"));
43
43
  const utils = __importStar(require("../lib/utils"));
44
+ //import {logger} from "../lib/logger";
44
45
  const e = exposes.presets;
45
46
  const ea = exposes.access;
47
+ //const NS = "zhc:slacky_diy";
46
48
  const ppmReporting = { min: 10, max: 300, change: 0.000001 };
47
49
  const batteryReporting = { min: 3600, max: 0, change: 0 };
48
50
  const temperatureReporting = { min: 10, max: 3600, change: 10 };
49
51
  const humidityReporting = { min: 10, max: 3600, change: 10 };
50
- const model_r01 = "Tuya_Thermostat_r01";
51
- const model_r03 = "Tuya_Thermostat_r03";
52
- const model_r04 = "Tuya_Thermostat_r04";
53
- const model_r06 = "Tuya_Thermostat_r06";
54
- const model_r07 = "Tuya_Thermostat_r07";
55
- const model_r08 = "Tuya_Thermostat_r08";
52
+ const model_r01 = "THERM_SLACKY_DIY_R01";
53
+ const model_r03 = "THERM_SLACKY_DIY_R03";
54
+ const model_r04 = "THERM_SLACKY_DIY_R04";
55
+ const model_r06 = "THERM_SLACKY_DIY_R06";
56
+ const model_r07 = "THERM_SLACKY_DIY_R07";
57
+ const model_r08 = "THERM_SLACKY_DIY_R08";
58
+ const model_r09 = "THERM_SLACKY_DIY_R09";
56
59
  const attrThermSensorUser = 0xf000;
57
60
  const attrThermFrostProtect = 0xf001;
58
61
  const attrThermHeatProtect = 0xf002;
@@ -66,6 +69,7 @@ const attrThermLevel = 0xf009;
66
69
  const attrThermInversion = 0xf00a;
67
70
  const attrThermEcoModeCoolTemperature = 0xf00b;
68
71
  const attrThermExtTemperatureCalibration = 0xf00c;
72
+ const attrThermModeKeyLock = 0xf00d;
69
73
  const attrFanCtrlControl = 0xf000;
70
74
  const switchSensorUsed = ["Inner (IN)", "All (AL)", "Outer (OU)"];
71
75
  const attrElCityMeterModelPreset = 0xf000;
@@ -99,10 +103,11 @@ const fzLocal = {
99
103
  result.sensor = utils.getFromLookup(msg.data[attrThermSensorUser], lookup);
100
104
  }
101
105
  if (msg.data.minSetpointDeadBand !== undefined) {
106
+ //logger.info(`Model: ${model.model}`, NS);
102
107
  let data;
103
- if (model.model === model_r06) {
108
+ if (model.model === model_r06 || model.model === model_r09) {
104
109
  data = Number.parseFloat(msg.data.minSetpointDeadBand) / 10;
105
- result.histeresis_temperature = data;
110
+ result.hysteresis_temperature = data;
106
111
  }
107
112
  else {
108
113
  data = Number.parseInt(msg.data.minSetpointDeadBand, 10);
@@ -140,7 +145,10 @@ const fzLocal = {
140
145
  result.sound = msg.data[attrThermSound] === 1 ? "On" : "Off";
141
146
  }
142
147
  if (msg.data[attrThermInversion] !== undefined) {
143
- result.inversion = msg.data[attrThermInversion] === 1 ? "On" : "Off";
148
+ result.relay_type = msg.data[attrThermInversion] === 1 ? "NO" : "NC";
149
+ }
150
+ if (msg.data[attrThermModeKeyLock] !== undefined) {
151
+ result.mode_child_lock = msg.data[attrThermModeKeyLock] === 1 ? "all" : "partial";
144
152
  }
145
153
  if (msg.data[attrThermScheduleMode] !== undefined) {
146
154
  const lookup = { 0: "Off", 1: "5+2", 2: "6+1", 3: "7" };
@@ -229,12 +237,12 @@ const tzLocal = {
229
237
  },
230
238
  },
231
239
  thermostat_deadzone_10: {
232
- key: ["histeresis_temperature"],
240
+ key: ["hysteresis_temperature"],
233
241
  convertSet: async (entity, key, value, meta) => {
234
242
  utils.assertNumber(value);
235
243
  const minSetpointDeadBand = Number(value) * 10;
236
244
  await entity.write("hvacThermostat", { minSetpointDeadBand });
237
- return { readAfterWriteTime: 250, state: { histeresis_temperature: value } };
245
+ return { readAfterWriteTime: 250, state: { hysteresis_temperature: value } };
238
246
  },
239
247
  convertGet: async (entity, key, meta) => {
240
248
  await entity.read("hvacThermostat", ["minSetpointDeadBand"]);
@@ -364,16 +372,27 @@ const tzLocal = {
364
372
  },
365
373
  },
366
374
  thermostat_inversion: {
367
- key: ["inversion"],
375
+ key: ["relay_type"],
368
376
  convertSet: async (entity, key, value, meta) => {
369
- const inversion = Number(value === "On");
370
- await entity.write("hvacThermostat", { [attrThermInversion]: { value: inversion, type: 0x10 } });
371
- return { readAfterWriteTime: 250, state: { inversion: value } };
377
+ const relay_type = Number(value === "NO");
378
+ await entity.write("hvacThermostat", { [attrThermInversion]: { value: relay_type, type: 0x10 } });
379
+ return { readAfterWriteTime: 250, state: { relay_type: value } };
372
380
  },
373
381
  convertGet: async (entity, key, meta) => {
374
382
  await entity.read("hvacThermostat", [attrThermInversion]);
375
383
  },
376
384
  },
385
+ thermostat_mode_child_lock: {
386
+ key: ["mode_child_lock"],
387
+ convertSet: async (entity, key, value, meta) => {
388
+ const mode_child_lock = Number(value === "all");
389
+ await entity.write("hvacThermostat", { [attrThermModeKeyLock]: { value: mode_child_lock, type: 0x10 } });
390
+ return { readAfterWriteTime: 250, state: { mode_child_lock: value } };
391
+ },
392
+ convertGet: async (entity, key, meta) => {
393
+ await entity.read("hvacThermostat", [attrThermModeKeyLock]);
394
+ },
395
+ },
377
396
  thermostat_schedule_mode: {
378
397
  key: ["schedule_mode"],
379
398
  convertSet: async (entity, key, value, meta) => {
@@ -450,10 +469,11 @@ const localToZigbeeThermostat = [
450
469
  tzLocal.thermostat_schedule_mode,
451
470
  tzLocal.thermostat_settings_reset,
452
471
  tzLocal.thermostat_ext_temperature_calibration,
472
+ tzLocal.thermostat_mode_child_lock,
453
473
  tzLocal.fancontrol_control,
454
474
  ];
455
475
  async function configureCommon(device, coordinatorEndpoint, definition) {
456
- //logger.info(definition.model);
476
+ //logger.info(definition.model, NS);
457
477
  const endpoint1 = device.getEndpoint(1);
458
478
  const endpoint2 = device.getEndpoint(2);
459
479
  await endpoint1.read("hvacUserInterfaceCfg", ["keypadLockout"]);
@@ -483,16 +503,19 @@ async function configureCommon(device, coordinatorEndpoint, definition) {
483
503
  await endpoint1.read("hvacThermostat", [attrThermLevel]);
484
504
  await endpoint1.read("hvacThermostat", [attrThermInversion]);
485
505
  await endpoint1.read("hvacThermostat", [attrThermExtTemperatureCalibration]);
506
+ if (definition.model === model_r09) {
507
+ await endpoint1.read("hvacThermostat", [attrThermModeKeyLock]);
508
+ }
486
509
  await endpoint1.read("hvacFanCtrl", ["fanMode"]);
487
510
  await endpoint1.read("hvacFanCtrl", [attrFanCtrlControl]);
488
511
  await reporting.bind(endpoint1, coordinatorEndpoint, ["hvacThermostat", "hvacUserInterfaceCfg", "hvacFanCtrl"]);
489
- if (definition.model === model_r03 || definition.model === model_r04) {
512
+ if (definition.model === model_r03 || definition.model === model_r04 || definition.model === model_r09) {
490
513
  await reporting.bind(endpoint1, coordinatorEndpoint, ["genLevelCtrl"]);
491
514
  const payloadCurrentLevel = [
492
515
  { attribute: { ID: 0x0000, type: 0x20 }, minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 0 },
493
516
  ];
494
517
  await endpoint1.configureReporting("genLevelCtrl", payloadCurrentLevel);
495
- if (definition.model === model_r03) {
518
+ if (definition.model === model_r03 || definition.model === model_r09) {
496
519
  await reporting.bind(endpoint2, coordinatorEndpoint, ["genLevelCtrl"]);
497
520
  await endpoint2.configureReporting("genLevelCtrl", payloadCurrentLevel);
498
521
  }
@@ -587,7 +610,13 @@ async function configureCommon(device, coordinatorEndpoint, definition) {
587
610
  ];
588
611
  await endpoint1.configureReporting("hvacThermostat", payload_schedule_mode);
589
612
  }
590
- if (definition.model === model_r08) {
613
+ if (definition.model === model_r09) {
614
+ const payload_inversion = [
615
+ { attribute: { ID: attrThermInversion, type: 0x10 }, minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 0 },
616
+ ];
617
+ await endpoint1.configureReporting("hvacThermostat", payload_inversion);
618
+ }
619
+ if (definition.model === model_r08 || definition.model === model_r09) {
591
620
  const payload_eco_mode = [
592
621
  { attribute: { ID: attrThermEcoMode, type: 0x30 }, minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 0 },
593
622
  ];
@@ -1694,12 +1723,12 @@ exports.definitions = [
1694
1723
  exposes: [
1695
1724
  e.binary("child_lock", ea.ALL, "LOCK", "UNLOCK").withDescription("Enables/disables physical input on the device"),
1696
1725
  e.binary("sound", ea.ALL, "On", "Off").withDescription("Sound On/Off"),
1697
- e.binary("inversion", ea.ALL, "On", "Off").withDescription("Inversion of the output"),
1726
+ e.binary("relay_type", ea.ALL, "NC", "NO").withDescription("Relay type NC/NO"),
1698
1727
  e.enum("brightness_level", ea.ALL, ["Off", "Low", "Medium", "High"]).withDescription("Screen brightness"),
1699
1728
  e.programming_operation_mode(["setpoint", "schedule"]).withDescription("Setpoint or Schedule mode"),
1700
1729
  e.enum("sensor", ea.ALL, switchSensorUsed).withDescription("Select temperature sensor to use"),
1701
1730
  e
1702
- .numeric("histeresis_temperature", ea.ALL)
1731
+ .numeric("hysteresis_temperature", ea.ALL)
1703
1732
  .withDescription("The delta between local_temperature and current_heating_setpoint to trigger activity")
1704
1733
  .withUnit("°C")
1705
1734
  .withValueMin(0.5)
@@ -1859,6 +1888,97 @@ exports.definitions = [
1859
1888
  meta: {},
1860
1889
  ota: true,
1861
1890
  },
1891
+ {
1892
+ zigbeeModel: ["Tuya_Thermostat_r09"],
1893
+ model: "THERM_SLACKY_DIY_R09",
1894
+ vendor: "Slacky-DIY",
1895
+ description: "Tuya Thermostat for Floor Heating with custom Firmware",
1896
+ endpoint: (device) => {
1897
+ return { day: 1, night: 2 };
1898
+ },
1899
+ fromZigbee: localFromZigbeeThermostat,
1900
+ toZigbee: localToZigbeeThermostat,
1901
+ configure: configureCommon,
1902
+ // Should be empty, unless device can be controlled (e.g. lights, switches).
1903
+ exposes: [
1904
+ e.binary("child_lock", ea.ALL, "LOCK", "UNLOCK").withDescription("Enables/disables physical input on the device"),
1905
+ e.binary("mode_child_lock", ea.ALL, "partial", "all").withDescription("Child lock mode - all/partial"),
1906
+ e.binary("relay_type", ea.ALL, "NC", "NO").withDescription("Relay type NC/NO"),
1907
+ e.programming_operation_mode(["setpoint", "schedule"]).withDescription("Setpoint or Schedule mode"),
1908
+ e.enum("sensor", ea.ALL, switchSensorUsed).withDescription("Select temperature sensor to use"),
1909
+ e
1910
+ .numeric("hysteresis_temperature", ea.ALL)
1911
+ .withDescription("The delta between local_temperature and current_heating_setpoint to trigger activity")
1912
+ .withUnit("°C")
1913
+ .withValueMin(1)
1914
+ .withValueMax(5)
1915
+ .withValueStep(0.5),
1916
+ e
1917
+ .numeric("min_heat_setpoint_limit", ea.ALL)
1918
+ .withUnit("°C")
1919
+ .withDescription("Minimum Heating set point limit")
1920
+ .withValueMin(5)
1921
+ .withValueMax(15)
1922
+ .withValueStep(1),
1923
+ e
1924
+ .numeric("max_heat_setpoint_limit", ea.ALL)
1925
+ .withDescription("Maximum Heating set point limit")
1926
+ .withUnit("°C")
1927
+ .withValueMin(15)
1928
+ .withValueMax(45)
1929
+ .withValueStep(1),
1930
+ e
1931
+ .numeric("frost_protect", ea.ALL)
1932
+ .withUnit("°C")
1933
+ .withDescription("Protection against minimum freezing temperature")
1934
+ .withValueMin(0)
1935
+ .withValueMax(10)
1936
+ .withValueStep(1),
1937
+ e
1938
+ .numeric("heat_protect", ea.ALL)
1939
+ .withUnit("°C")
1940
+ .withDescription("Protection against maximum heating temperature")
1941
+ .withValueMin(25)
1942
+ .withValueMax(70)
1943
+ .withValueStep(1),
1944
+ e.numeric("brightness", ea.ALL).withValueMin(0).withValueMax(8).withDescription("Screen brightness 06:00 - 22:00").withEndpoint("day"),
1945
+ e.numeric("brightness", ea.ALL).withValueMin(0).withValueMax(8).withDescription("Screen brightness 22:00 - 06:00").withEndpoint("night"),
1946
+ e.binary("eco_mode", ea.ALL, "On", "Off").withDescription("On/Off Sleep Mode"),
1947
+ e
1948
+ .numeric("eco_mode_heat_temperature", ea.ALL)
1949
+ .withUnit("°C")
1950
+ .withDescription("Set heat temperature in eco mode")
1951
+ .withValueMin(5)
1952
+ .withValueMax(45)
1953
+ .withValueStep(1),
1954
+ e
1955
+ .numeric("external_temperature_calibration", ea.ALL)
1956
+ .withDescription("External temperature calibration")
1957
+ .withUnit("°C")
1958
+ .withValueMin(-9)
1959
+ .withValueMax(9)
1960
+ .withValueStep(1),
1961
+ e.numeric("outdoor_temperature", ea.STATE_GET).withUnit("°C").withDescription("Current temperature measured from the floor outer sensor"),
1962
+ e
1963
+ .climate()
1964
+ .withLocalTemperature()
1965
+ .withSetpoint("occupied_heating_setpoint", 5, 45, 0.5)
1966
+ .withLocalTemperatureCalibration(-9, 9, 1)
1967
+ .withSystemMode(["off", "heat"])
1968
+ .withRunningState(["idle", "heat"], ea.STATE)
1969
+ .withWeeklySchedule(["heat"], ea.ALL),
1970
+ e.text("schedule_monday", ea.STATE).withDescription("Monday's schedule"),
1971
+ e.text("schedule_tuesday", ea.STATE).withDescription("Tuesday's schedule"),
1972
+ e.text("schedule_wednesday", ea.STATE).withDescription("Wednesday's schedule"),
1973
+ e.text("schedule_thursday", ea.STATE).withDescription("Thursday's schedule"),
1974
+ e.text("schedule_friday", ea.STATE).withDescription("Friday's schedule"),
1975
+ e.text("schedule_saturday", ea.STATE).withDescription("Saturday's schedule"),
1976
+ e.text("schedule_sunday", ea.STATE).withDescription("Sunday's schedule"),
1977
+ e.enum("settings_reset", ea.SET, ["Default"]).withDescription("Default settings"),
1978
+ ],
1979
+ meta: {},
1980
+ ota: true,
1981
+ },
1862
1982
  {
1863
1983
  zigbeeModel: ["TS0201-z-SlD"],
1864
1984
  model: "TS0201-z-SlD",