Skip to content

Instantly share code, notes, and snippets.

@9zigen
Last active April 22, 2024 12:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9zigen/34a27dd18dc4d4cd09c7b1a3efda8df4 to your computer and use it in GitHub Desktop.
Save 9zigen/34a27dd18dc4d4cd09c7b1a3efda8df4 to your computer and use it in GitHub Desktop.
const {binary, temperature, humidity, numeric} = require('zigbee-herdsman-converters/lib/modernExtend');
const definition = {
zigbeeModel: ['Alab-CO2-1.0', 'Alab-CO2-1.1'],
model: 'Alab-CO2-1.1',
vendor: 'Alab',
description: '[Zigbee CO2 Sensor](https://www.tindie.com/products/a_lab_technology/zigbee-co2-sensor-v2/)',
extend: [
temperature(),
humidity(),
numeric({
name: 'co2',
valueMin: 0,
valueMax: 65535,
valueStep: 1,
cluster: 'msCO2',
label: 'CO2',
attribute: 'measuredValue',
reporting: { min: '10_SECONDS', max: '1_HOUR', change: 50 },
description: 'Measured value',
unit: 'ppm',
scale: 1,
access: 'STATE_GET',
}),
binary({
name: "calibration_nitrogen",
valueOn: ['Start', 1],
valueOff: ['Not started', 0],
cluster: "msCO2",
attribute: { ID: 0x1000, type: 0x21 },
description: 'Perform nitrogen calibration. The device must be in a pure nitrogen atmosphere.',
}),
binary({
name: "calibration_background",
valueOn: ['Start', 1],
valueOff: ['Not started', 0],
cluster: "msCO2",
attribute: { ID: 0x1001, type: 0x21 },
description: 'Perform background calibration. For best results, the device should be placed in fresh air for 3-5 minutes.',
}),
binary({
name: "abc",
valueOn: ['Active', 1],
valueOff: ['Disabled', 0],
cluster: "msCO2",
attribute: { ID: 0x1002, type: 0x21 },
description: 'Perform background calibration. For best results, the device should be placed in fresh air for 3-5 minutes.',
}),
numeric({
name: "abc_period",
valueMin: 0,
valueMax: 65535,
valueStep: 1,
cluster: "msCO2",
attribute: { ID: 0x1003, type: 0x21 },
description: 'Perform background calibration. For best results, the device should be placed in fresh air for 3-5 minutes.',
}),
numeric({
name: "altitude",
valueMin: 0,
valueMax: 3000,
valueStep: 1,
cluster: "msCO2",
attribute: { ID: 0x1009, type: 0x21 },
description: 'SCD4X height above sea level. Valid input values are between 0–3000m.',
}),
numeric({
name: "pressure",
valueMin: 70000,
valueMax: 120000,
valueStep: 1,
cluster: "msCO2",
attribute: { ID: 0x1010, type: 0x23 },
description: 'SCD4X sensor only! The default value is 101300 Pa. Valid input values are between 70000 – 120000 Pa. Overrides any pressure compensation based on a previously set sensor altitude.',
}),
binary({
name: "factory_reset",
valueOn: ['Start', 1],
valueOff: ['Not started', 0],
cluster: "msCO2",
attribute: { ID: 0x1011, type: 0x10 },
description: 'Reset SCD4X sensor!',
}),
],
meta: {},
};
module.exports = definition;
@atoktoto
Copy link

atoktoto commented Mar 3, 2022

I just received a Zigbee CO2 Sensor and followed the link to this gist. It seems to be a converter for Alab-PhSensor-1.0 not the CO2 one.

@atoktoto
Copy link

atoktoto commented Mar 3, 2022

I've found that revision 1 seems to be the code I need... Is that right? Also, how to trigger the background calibraiton?

@9zigen
Copy link
Author

9zigen commented Mar 3, 2022

I've found that revision 1 seems to be the code I need... Is that right? Also, how to trigger the background calibraiton?

Hi, you right
use: https://gist.github.com/9zigen/5219085e6d06eb53bfffc3cd064e5308

Background calibration is relevant for the CO2 sensor only.
Please write your comments in the gist at the link. Thanks!

@frootblaster
Copy link

When using ZHA on HomeAssistant readout shows 435,000,000 ppm at normal CO2 levels. Highest recorded was 65,000,000,000 ppm. No way to modify or change in HA integration.

@9zigen
Copy link
Author

9zigen commented Sep 6, 2023

Hi,
What version of home assistant? The sensor provide data in the form of a ppm. that is, if the carbon dioxide content in the air is 600 ppm, then the same data is sent to the coordinator or other device with direct binding.

@frootblaster
Copy link

I have submitted a request at the ZHA quirk repository zigpy/zha-device-handlers#2889 @9zigen

@9zigen
Copy link
Author

9zigen commented Jan 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment