Skip to content

Commit

Permalink
feat(add): HO-C401N-z (#7507)
Browse files Browse the repository at this point in the history
* MHO-C401N-z

Requires firmware 0.1.2.1+

* Update custom_devices_diy.ts

* Update custom_devices_diy.ts

* Update custom_devices_diy.ts

* Update custom_devices_diy.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
TeHashX and Koenkk committed May 10, 2024
1 parent 03b3caa commit c385d3f
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions src/devices/custom_devices_diy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,129 @@ const definitions: Definition[] = [
],
ota: ota.zigbeeOTA,
},
{
zigbeeModel: ['MHO-C401N-z'],
model: 'MHO-C401N-z',
vendor: 'Xiaomi',
description: 'E-Ink temperature & humidity sensor with custom firmware (pvxx/ZigbeeTLc)',
extend: [
quirkAddEndpointCluster({
endpointID: 1,
outputClusters: [],
inputClusters: [
'genPowerCfg',
'msTemperatureMeasurement',
'msRelativeHumidity',
'hvacUserInterfaceCfg',
],
}),
battery({percentage: true}),
temperature({reporting: {min: 10, max: 300, change: 10}, access: 'STATE'}),
humidity({reporting: {min: 2, max: 300, change: 50}, access: 'STATE'}),
enumLookup({
name: 'temperature_display_mode',
lookup: {'celsius': 0, 'fahrenheit': 1},
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0000, type: Zcl.DataType.ENUM8},
description: 'The units of the temperature displayed on the device screen.',
}),
binary({
name: 'smiley',
valueOn: ['SHOW', 0],
valueOff: ['HIDE', 1],
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0002, type: Zcl.DataType.ENUM8},
description: 'Whether to show a smiley on the device screen.',
}),
numeric({
name: 'temperature_calibration',
unit: '°C',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0100, type: Zcl.DataType.INT16},
valueMin: -12.7,
valueMax: 12.7,
valueStep: 0.01,
scale: 10,
description: 'The temperature calibration, in 0.01° steps.',
}),
numeric({
name: 'humidity_calibration',
unit: '%',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0101, type: Zcl.DataType.INT16},
valueMin: -12.7,
valueMax: 12.7,
valueStep: 0.01,
scale: 10,
description: 'The humidity offset is set in 0.01 % steps.',
}),
numeric({
name: 'comfort_temperature_min',
unit: '°C',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0102, type: Zcl.DataType.INT16},
valueMin: -127.0,
valueMax: 127.0,
scale: 100,
description: 'Comfort parameters/Temperature minimum, in 1°C steps.',
}),
numeric({
name: 'comfort_temperature_max',
unit: '°C',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0103, type: Zcl.DataType.INT16},
valueMin: -127.0,
valueMax: 127.0,
scale: 100,
description: 'Comfort parameters/Temperature maximum, in 1°C steps.',
}),
numeric({
name: 'comfort_humidity_min',
unit: '%',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0104, type: Zcl.DataType.UINT16},
valueMin: 0.0,
valueMax: 100.0,
scale: 100,
description: 'Comfort parameters/Humidity minimum, in 1% steps.',
}),
numeric({
name: 'comfort_humidity_max',
unit: '%',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0105, type: Zcl.DataType.UINT16},
valueMin: 0.0,
valueMax: 100.0,
scale: 100,
description: 'Comfort parameters/Humidity maximum, in 1% steps.',
}),
numeric({
name: 'measurement_interval',
unit: 's',
cluster: 'hvacUserInterfaceCfg',
attribute: {ID: 0x0107, type: Zcl.DataType.UINT8},
valueMin: 3,
valueMax: 255,
description: 'Measurement interval, default 10 seconds.',
}),
],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
const bindClusters = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg'];
await reporting.bind(endpoint, coordinatorEndpoint, bindClusters);
await reporting.temperature(endpoint, {min: 10, max: 300, change: 10});
await reporting.humidity(endpoint, {min: 10, max: 300, change: 50});
await reporting.batteryPercentageRemaining(endpoint);
try {
await endpoint.read('hvacThermostat', [0x0010, 0x0011, 0x0102, 0x0103, 0x0104, 0x0105, 0x0107]);
await endpoint.read('msTemperatureMeasurement', [0x0010]);
await endpoint.read('msRelativeHumidity', [0x0010]);
} catch (e) {
/* backward compatibility */
}
},
},
{
zigbeeModel: ['QUAD-ZIG-SW'],
model: 'QUAD-ZIG-SW',
Expand Down

0 comments on commit c385d3f

Please sign in to comment.