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
86 changes: 85 additions & 1 deletion src/devices/moes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const definitions: DefinitionWithExtend[] = [
},
{
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_aoclfnxz'},
{modelID: 'TS0601', manufacturerName: '_TZE200_ztvwu4nk'},
{modelID: 'TS0601', manufacturerName: '_TZE204_5toc8efa'},
{modelID: 'TS0601', manufacturerName: '_TZE200_5toc8efa'},
Expand Down Expand Up @@ -185,6 +184,91 @@ const definitions: DefinitionWithExtend[] = [
},
onEvent: tuya.onEventSetLocalTime,
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_aoclfnxz'}],
model: 'BHT-006-GB-ZB',
vendor: 'Moes',
description: 'Moes BHT-006 series Thermostat, electric floor heating',
fromZigbee: [legacy.fz.moes_thermostat],
toZigbee: [
legacy.tz.moes_thermostat_current_heating_setpoint, //16 //current set temp

legacy.tz.moes_thermostat_standby, //1 //on/off
legacy.tz.moes_thermostat_mode, //2 (hold/heat) also sets 3 - schedule enabled //hold/program

legacy.tz.moes_thermostat_program_schedule, //101 //week program

legacy.tz.moes_thermostat_child_lock, //40 //child lock
legacy.tz.moes_thermostat_calibration, //27 //temperature correction
legacy.tz.moes_thermostat_max_temp, //19 //high limit temperature ceiling
legacy.tz.moes_thermostat_min_temperature_limit, //26 //DeadZone temp

legacy.tz.moes_thermostat_sensor, //43 //sensor selection

//24 //device temp
//36 //state of the valve

//legacy.tz.moes_thermostat_max_temperature_limit, //18 //not used in this model
//legacy.tz.moes_thermostat_deadzone_temperature, //20 //not used in this model
],
exposes: (device, options) => {
return [
e.linkquality(),
e.child_lock(),
e.min_temperature_limit_deadzone(),
e.max_temperature_limit().withValueMin(45).withValueMax(70),
e
.climate()
.withSetpoint('current_heating_setpoint', 0, 45, 1, ea.STATE_SET)
.withLocalTemperature(ea.STATE)
.withLocalTemperatureCalibration(-9, 9, 1, ea.STATE_SET)
.withSystemMode(['off', 'heat'], ea.STATE_SET)
.withRunningState(['idle', 'heat'], 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')
.withFeature(exposesLocal.hour('weekdays_p1_hour'))
.withFeature(exposesLocal.minute('weekdays_p1_minute'))
.withFeature(exposesLocal.program_temperature('weekdays_p1_temperature'))
.withFeature(exposesLocal.hour('weekdays_p2_hour'))
.withFeature(exposesLocal.minute('weekdays_p2_minute'))
.withFeature(exposesLocal.program_temperature('weekdays_p2_temperature'))
.withFeature(exposesLocal.hour('weekdays_p3_hour'))
.withFeature(exposesLocal.minute('weekdays_p3_minute'))
.withFeature(exposesLocal.program_temperature('weekdays_p3_temperature'))
.withFeature(exposesLocal.hour('weekdays_p4_hour'))
.withFeature(exposesLocal.minute('weekdays_p4_minute'))
.withFeature(exposesLocal.program_temperature('weekdays_p4_temperature'))
.withFeature(exposesLocal.hour('saturday_p1_hour'))
.withFeature(exposesLocal.minute('saturday_p1_minute'))
.withFeature(exposesLocal.program_temperature('saturday_p1_temperature'))
.withFeature(exposesLocal.hour('saturday_p2_hour'))
.withFeature(exposesLocal.minute('saturday_p2_minute'))
.withFeature(exposesLocal.program_temperature('saturday_p2_temperature'))
.withFeature(exposesLocal.hour('saturday_p3_hour'))
.withFeature(exposesLocal.minute('saturday_p3_minute'))
.withFeature(exposesLocal.program_temperature('saturday_p3_temperature'))
.withFeature(exposesLocal.hour('saturday_p4_hour'))
.withFeature(exposesLocal.minute('saturday_p4_minute'))
.withFeature(exposesLocal.program_temperature('saturday_p4_temperature'))
.withFeature(exposesLocal.hour('sunday_p1_hour'))
.withFeature(exposesLocal.minute('sunday_p1_minute'))
.withFeature(exposesLocal.program_temperature('sunday_p1_temperature'))
.withFeature(exposesLocal.hour('sunday_p2_hour'))
.withFeature(exposesLocal.minute('sunday_p2_minute'))
.withFeature(exposesLocal.program_temperature('sunday_p2_temperature'))
.withFeature(exposesLocal.hour('sunday_p3_hour'))
.withFeature(exposesLocal.minute('sunday_p3_minute'))
.withFeature(exposesLocal.program_temperature('sunday_p3_temperature'))
.withFeature(exposesLocal.hour('sunday_p4_hour'))
.withFeature(exposesLocal.minute('sunday_p4_minute'))
.withFeature(exposesLocal.program_temperature('sunday_p4_temperature')),
];
},
onEvent: tuya.onEventSetLocalTime,
},
{
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_amp6tsvy'},
Expand Down
8 changes: 7 additions & 1 deletion src/lib/exposes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,12 @@ export const presets = {
)
.withValueMin(1)
.withValueMax(5),
min_temperature_limit_deadzone: () =>
new Numeric('min_temperature_limit', access.STATE_SET)
.withUnit('°C')
.withDescription('The delta between local_temperature and current_heating_setpoint to trigger Heat')
.withValueMin(1)
.withValueMax(5),
min_temperature: () =>
new Numeric('min_temperature', access.STATE_SET).withUnit('°C').withDescription('Minimum temperature').withValueMin(1).withValueMax(15),
mode_switch_select: (mode_switch_names: string[]) =>
Expand Down Expand Up @@ -1257,7 +1263,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
10 changes: 10 additions & 0 deletions src/lib/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6433,6 +6433,16 @@ const toZigbee2 = {
}
},
} satisfies Tz.Converter,
moes_thermostat_max_temp: {
key: ['max_temperature_limit'],
convertSet: async (entity, key, value: any, meta) => {
if (['_TZE200_5toc8efa', '_TZE204_5toc8efa'].includes(meta.device.manufacturerName)) {
await sendDataPointValue(entity, dataPoints.moesMaxTemp, value * 10);
} else {
await sendDataPointValue(entity, dataPoints.moesMaxTemp, value);
}
},
} satisfies Tz.Converter,
moes_thermostat_mode: {
key: ['preset'],
convertSet: async (entity, key, value, meta) => {
Expand Down
Loading