Zigbee Router and Environment Sensor

For anyone interested I have managed to get the older RES001 sensor mostly working with Z2M. Using the below external converter. It is not 100% - looks like some issues with the lux reporting. Maybe someone who knows more than me can get 100% complete.

const constants = require('zigbee-herdsman-converters/lib/constants');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const utils = require('zigbee-herdsman-converters/lib/utils')
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['RES001'],
    model: 'KMPCIL',
    vendor: 'KMPCIL',
    description: 'Environment Sensor',
    fromZigbee: [fz.temperature, fz.humidity, fz.pressure, fz.illuminance], // <-- added here all clusters reported from zigbee
    toZigbee: [], // <-- add here all clusters to send commands to zigbee
    exposes: [e.temperature(), e.humidity(), e.pressure(), e.illuminance().withAccess(ea.STATE_GET), e.illuminance_lux().withAccess(ea.STATE_GET)], // <-- this will de>

configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(8);
            const binds = ['genPowerCfg', 'msTemperatureMeasurement', 'msRelativeHumidity', 'msPressureMeasurement',
                'msIlluminanceMeasurement', 'genBinaryInput', 'genBinaryOutput'];
            await reporting.bind(endpoint, coordinatorEndpoint, binds);
            await reporting.temperature(endpoint);
            await reporting.humidity(endpoint);
            const payload = [{attribute: 'measuredValue', minimumReportInterval: 5, maximumReportInterval: constants.repInterval.HOUR,
                reportableChange: 200}];
            await endpoint.configureReporting('msIlluminanceMeasurement', payload);
            const payloadPressure = [{
                // 0 = measuredValue, override dataType from int16 to uint16
                // https://github.com/Koenkk/zigbee-herdsman/pull/191/files?file-filters%5B%5D=.ts#r456569398
                attribute: {ID: 0, type: 33}, minimumReportInterval: 2, maximumReportInterval: constants.repInterval.HOUR,
                reportableChange: 3}];
            await endpoint.configureReporting('msPressureMeasurement', payloadPressure);
            const options = {disableDefaultResponse: true};
            await endpoint.write('genBinaryInput', {0x0051: {value: 0x01, type: 0x10}}, options);
            await endpoint.write('genBinaryInput', {0x0101: {value: 25, type: 0x23}}, options);
            const payloadBinaryInput = [{
                attribute: 'presentValue', minimumReportInterval: 0, maximumReportInterval: 30, reportableChange: 1}];
            await endpoint.configureReporting('genBinaryInput', payloadBinaryInput);
            await endpoint.write('genBinaryOutput', {0x0051: {value: 0x01, type: 0x10}}, options);
            const payloadBinaryOutput = [{
                attribute: 'presentValue', minimumReportInterval: 0, maximumReportInterval: 30, reportableChange: 1}];
            await endpoint.configureReporting('genBinaryOutput', payloadBinaryOutput);
        },
    };


module.exports = definition;

Iā€™m very interested in thisā€¦
From what I read, I take your file and save it within my Z2M config folder with .js at the end (RES001.js) . I then edit my config on Z2M and add

external_converters:

  • RES001.js

It should then work when the service is restarted?

Thanks for your work on this @iharyadi ! I bought several of your sensors when I was still on ST and was happy to see that they ā€œjust workā€ on HA w/ ZHA.

How can I adjust the temp offset? All of my sensors are about 2 degrees F higher than actual so I need the adjustment for the sensors to be accurate.

ETA: Answered my own offset question! Reading the ST groovy file I realized the offset is a feature of the automation platform not the device itself. That led me to find the Compensation feature built into HA since 2021.

Hello iharyadi. Are you still working on this project? Or is it abandoned?

where i wanted to buy 20 if this are they available ?

I have not been working on the sensor for a while. I donā€™t have them anymore.