Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add converter for modern moes bht-006 thermostat #8005

Merged
merged 10 commits into from
Sep 24, 2024
50 changes: 32 additions & 18 deletions src/devices/moes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ const definitions: DefinitionWithExtend[] = [
},
{
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_aoclfnxz'},
{modelID: 'TS0601', manufacturerName: '_TZE200_ye5jkfsb'},
{modelID: 'TS0601', manufacturerName: '_TZE200_ztvwu4nk'},
{modelID: 'TS0601', manufacturerName: '_TZE204_5toc8efa'},
{modelID: 'TS0601', manufacturerName: '_TZE200_5toc8efa'},
{modelID: 'TS0601', manufacturerName: '_TZE200_ye5jkfsb'},
{modelID: 'TS0601', manufacturerName: '_TZE204_5toc8efa'},
{modelID: 'TS0601', manufacturerName: '_TZE200_aoclfnxz'},
{modelID: 'TS0601', manufacturerName: '_TZE204_aoclfnxz'},
{modelID: 'TS0601', manufacturerName: '_TZE200_u9bfwha0'},
{modelID: 'TS0601', manufacturerName: '_TZE204_u9bfwha0'},
Expand All @@ -113,35 +113,43 @@ const definitions: DefinitionWithExtend[] = [
description: 'Moes BHT series Thermostat',
fromZigbee: [legacy.fz.moes_thermostat],
toZigbee: [
legacy.tz.moes_thermostat_child_lock,
legacy.tz.moes_thermostat_current_heating_setpoint,
legacy.tz.moes_thermostat_mode,
legacy.tz.moes_thermostat_standby,
legacy.tz.moes_thermostat_sensor,
legacy.tz.moes_thermostat_calibration,
legacy.tz.moes_thermostat_deadzone_temperature,
legacy.tz.moes_thermostat_max_temperature_limit,
legacy.tz.moes_thermostat_min_temperature_limit,
legacy.tz.moes_thermostat_program_schedule,
legacy.tz.moes_thermostat_child_lock, //40 //child lock
legacy.tz.moes_thermostat_current_heating_setpoint, //16 //current set temp
legacy.tz.moes_thermostat_mode, //2 (hold/heat) also sets 3 - schedule enabled //hold/program
legacy.tz.moes_thermostat_standby, //1 //on/off
legacy.tz.moes_thermostat_sensor, //43 //sensor selection
legacy.tz.moes_thermostat_calibration, //27 //temperature correction
legacy.tz.moes_thermostat_deadzone_temperature, //20 //not used in this model
legacy.tz.moes_thermostat_max_temperature_limit, //18/19 for different models
legacy.tz.moes_thermostat_min_temperature_limit, //26 //DeadZone temp
legacy.tz.moes_thermostat_program_schedule, //101 //week program
],
whiteLabel: [tuya.whitelabel('Moes', 'BHT-002/BHT-006', 'Smart heating thermostat', ['_TZE204_aoclfnxz'])],
exposes: (device, options) => {
const heatingStepSize = device?.manufacturerName === '_TZE204_5toc8efa' ? 0.5 : 1;
return [
const calibrationLimit = device?.manufacturerName === '_TZE204_aoclfnxz' ? 9 : 30;
const calibrationStep = device?.manufacturerName === '_TZE204_aoclfnxz' ? 1 : 0.1;
const arr = [
e.linkquality(),
e.child_lock(),
e.deadzone_temperature(),
e.max_temperature_limit().withValueMax(45),
e.min_temperature_limit(),

device?.manufacturerName === '_TZE204_aoclfnxz' ? e.deadzone_temperature().withValueMin(1) : e.deadzone_temperature(),

device?.manufacturerName === '_TZE204_aoclfnxz'
? e.max_temperature_limit().withValueMin(45).withValueMax(70)
: e.max_temperature_limit().withValueMax(45),

e
.climate()
.withSetpoint('current_heating_setpoint', 5, 45, heatingStepSize, ea.STATE_SET)
.withLocalTemperature(ea.STATE)
.withLocalTemperatureCalibration(-30, 30, 0.1, ea.STATE_SET)
.withLocalTemperatureCalibration(-calibrationLimit, calibrationLimit, calibrationStep, ea.STATE_SET)
.withSystemMode(['off', 'heat'], ea.STATE_SET)
.withRunningState(['idle', 'heat', 'cool'], ea.STATE)
.withPreset(['hold', 'program']),

e.temperature_sensor_select(['IN', 'AL', 'OU']),

e
.composite('program', 'program', ea.STATE_SET)
.withDescription('Time of day and setpoint to use when in program mode')
Expand Down Expand Up @@ -182,6 +190,12 @@ const definitions: DefinitionWithExtend[] = [
.withFeature(exposesLocal.minute('sunday_p4_minute'))
.withFeature(exposesLocal.program_temperature('sunday_p4_temperature')),
];

if (device?.manufacturerName === '_TZE204_aoclfnxz') {
arr.splice(3, 0, e.min_temperature_limit());
}

return arr;
},
onEvent: tuya.onEventSetLocalTime,
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/exposes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ export const presets = {
new Enum('sensor', access.STATE_SET, sensor_names).withDescription('Select temperature sensor to use').withCategory('config'),
test: () => new Binary('test', access.STATE, true, false).withDescription('Indicates whether the device is being tested'),
trigger_count: (sinceScheduledReport = true) =>
new Numeric('trigger_count', exports.access.STATE)
new Numeric('trigger_count', access.STATE)
.withDescription('Indicates how many times the sensor was triggered' + (sinceScheduledReport ? ' (since last scheduled report)' : ''))
.withCategory('diagnostic'),
trigger_indicator: () =>
Expand Down
4 changes: 4 additions & 0 deletions src/lib/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6401,6 +6401,8 @@ const toZigbee2 = {
convertSet: async (entity, key, value: any, meta) => {
if (['_TZE200_5toc8efa', '_TZE204_5toc8efa'].includes(meta.device.manufacturerName)) {
await sendDataPointValue(entity, dataPoints.moesDeadZoneTemp, value * 10);
} else if (meta.device.manufacturerName === '_TZE204_aoclfnxz') {
await sendDataPointValue(entity, dataPoints.moesMinTempLimit, value);
} else {
await sendDataPointValue(entity, dataPoints.moesDeadZoneTemp, value);
}
Expand Down Expand Up @@ -6428,6 +6430,8 @@ const toZigbee2 = {
convertSet: async (entity, key, value: any, meta) => {
if (['_TZE200_5toc8efa', '_TZE204_5toc8efa'].includes(meta.device.manufacturerName)) {
await sendDataPointValue(entity, dataPoints.moesMaxTempLimit, value * 10);
} else if (meta.device.manufacturerName === '_TZE204_aoclfnxz') {
await sendDataPointValue(entity, dataPoints.moesMaxTemp, value);
} else {
await sendDataPointValue(entity, dataPoints.moesMaxTempLimit, value);
}
Expand Down
Loading