Skip to content

Instantly share code, notes, and snippets.

@9zigen
Last active March 10, 2025 12:19
Show Gist options
  • Select an option

  • Save 9zigen/5219085e6d06eb53bfffc3cd064e5308 to your computer and use it in GitHub Desktop.

Select an option

Save 9zigen/5219085e6d06eb53bfffc3cd064e5308 to your computer and use it in GitHub Desktop.
const {binary, temperature, humidity, numeric, battery} = require('zigbee-herdsman-converters/lib/modernExtend');
const definition = {
zigbeeModel: ['Alab-PhSensor-1.0'],
model: 'Alab-PhSensor-1.0',
vendor: 'Alab',
description: '[DiY Wireless PH Sensor](https://github.com/9zigen/zigbee-ph-sensor)',
extend: [
temperature(),
humidity(),
battery(),
/* Sensor ISE */
numeric({
name: 'ph_measurement',
valueMin: 0,
valueMax: 65535,
valueStep: 1,
cluster: 'pHMeasurement',
label: 'PH',
attribute: 'measuredValue',
reporting: { min: '10_SECONDS', max: '1_HOUR', change: 5 },
description: 'Measured value',
unit: 'pH',
scale: 100,
access: 'STATE_GET',
}),
/* Sensor ISE RAW */
numeric({
name: 'probe_raw',
valueMin: 0,
valueMax: 65535,
valueStep: 1,
cluster: 'pHMeasurement',
label: 'PH RAW',
attribute: { ID: 0x1010, type: 0x21 },
reporting: { min: '10_SECONDS', max: '1_HOUR', change: 2 },
description: 'RAW value from pH electrode',
unit: 'mV',
scale: 1,
access: 'STATE_GET',
}),
/* Sensor NTC */
numeric({
name: 'probe_ntc',
valueMin: 0,
valueMax: 65535,
valueStep: 1,
cluster: 'pHMeasurement',
label: 'NTC',
attribute: { ID: 0x1011, type: 0x21 },
reporting: { min: '10_SECONDS', max: '1_HOUR', change: 5 },
description: 'Temperature measured by Probe',
unit: '°C',
scale: 100,
access: 'STATE_GET',
}),
/* Settings */
numeric({
name: "scan_interval",
valueMin: 1,
valueMax: 65535,
valueStep: 1,
unit: 'Seconds',
cluster: "pHMeasurement",
attribute: { ID: 0x1000, type: 0x21 },
description: 'The period between measurements. May affect battery life. Valid value from 30 to 65535 Seconds',
}),
numeric({
name: "calibration_low",
valueMin: 1,
valueMax: 65535,
valueStep: 1,
unit: 'pH (x100)',
cluster: "pHMeasurement",
attribute: { ID: 0x1001, type: 0x21 },
description: 'The pH of the calibration solution is multiplied by 100. 4.01 is 401.',
}),
numeric({
name: "calibration_mid",
valueMin: 1,
valueMax: 65535,
valueStep: 1,
unit: 'pH (x100)',
cluster: "pHMeasurement",
attribute: { ID: 0x1002, type: 0x21 },
description: 'The pH of the calibration solution is multiplied by 100. 6.86 is 686.',
}),
numeric({
name: "calibration_high",
valueMin: 1,
valueMax: 65535,
valueStep: 1,
unit: 'pH (x100)',
cluster: "pHMeasurement",
attribute: { ID: 0x1003, type: 0x21 },
description: 'The pH of the calibration solution is multiplied by 100. 9.01 is 901.',
}),
],
meta: {},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment