Skip to content

Commit

Permalink
Add TS0601_smart_CO_air_box (Koenkk#3864)
Browse files Browse the repository at this point in the history
* Add Tuya CO smart air box

* Add Tuya CO smart air box

* Add Tuya CO smart air box

* Add Tuya CO smart air box

* Update tuya.js
  • Loading branch information
DJTerentjev authored Feb 13, 2022
1 parent bbb56eb commit 60a715e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -4141,6 +4141,25 @@ const converters = {
}
},
},
tuya_CO: {
cluster: 'manuSpecificTuya',
type: ['commandDataReport', 'commandDataResponse'],
options: [exposes.options.precision('co'), exposes.options.calibration('co')],
convert: (model, msg, publish, options, meta) => {
const dpValue = tuya.firstDpValue(msg, meta, 'tuya_CO');
const dp = dpValue.dp;
const value = tuya.getDataValue(dpValue);
switch (dp) {
case tuya.dataPoints.tuyaSabCO:
return {co: calibrateAndPrecisionRoundOptions(value / 100, options, 'co')};
case tuya.dataPoints.tuyaSabCOalarm:
return {carbon_monoxide: value ? 'OFF' : 'ON'};
default:
meta.logger.warn(`zigbee-herdsman-converters:TuyaSmartAirBox: Unrecognized DP #${
dp} with data ${JSON.stringify(dpValue)}`);
}
},
},
saswell_thermostat: {
cluster: 'manuSpecificTuya',
type: ['commandDataResponse', 'commandDataReport'],
Expand Down
9 changes: 9 additions & 0 deletions devices/tuya.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ module.exports = [
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.co2(), e.voc(), e.formaldehyd(), e.pm25()],
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_7bztmfm1'}],
model: 'TS0601_smart_CO_air_box',
vendor: 'TuYa',
description: 'Smart air box (carbon monoxide)',
fromZigbee: [fz.tuya_CO],
toZigbee: [],
exposes: [e.carbon_monoxide(), e.co()],
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_ggev5fsl'}],
model: 'TS0601_gas_sensor',
Expand Down
1 change: 1 addition & 0 deletions lib/exposes.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ module.exports = {
carbon_monoxide: () => new Binary('carbon_monoxide', access.STATE, true, false).withDescription('Indicates if CO (carbon monoxide) is detected'),
child_lock: () => new Lock().withState('child_lock', 'LOCK', 'UNLOCK', 'Enables/disables physical input on the device', access.STATE_SET),
co2: () => new Numeric('co2', access.STATE).withUnit('ppm').withDescription('The measured CO2 (carbon dioxide) value'),
co: () => new Numeric('co', access.STATE).withUnit('ppm').withDescription('The measured CO (carbon monoxide) value'),
comfort_temperature: () => new Numeric('comfort_temperature', access.STATE_SET).withUnit('°C').withDescription('Comfort temperature').withValueMin(0).withValueMax(30),
consumer_connected: () => new Binary('consumer_connected', access.STATE, true, false).withDescription('Indicates whether a plug is physically attached. Device does not have to pull power or even be connected electrically (state of this binary switch can be ON even if main power switch is OFF)'),
contact: () => new Binary('contact', access.STATE, false, true).withDescription('Indicates if the contact is closed (= true) or open (= false)'),
Expand Down
3 changes: 3 additions & 0 deletions lib/tuya.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ const dataPoints = {
// tuya Smart Air House Keeper, Multifunctionale air quality detector.
// CO2, Temp, Humidity, VOC and Formaldehyd same as Smart Air Box
tuyaSahkMP25: 20,
// Tuya CO (carbon monoxide) smart air box
tuyaSabCOalarm: 1,
tuyaSabCO: 2,
lidlTimer: 5,
// Moes MS-105 Dimmer
moes105DimmerState1: 1,
Expand Down

0 comments on commit 60a715e

Please sign in to comment.