Chinese Human Presense Sensor - Device discovered but no entities for it

Hi.

I bought human presence sensors working via Zigbee from Aliexpress.com

[Tuya Wifi/zigbee Smart Human Presence Detector Millimeter Wave Radar Detection Sensor For Home Security And Energy Conservation - Pir Motion Sensor - AliExpress]

Home Assistant detects the device in pairing mode, I can give it a name and initially it looks like everything is OK. However, after adding the device, no entities related to it appeared.
What could be the problem? Do any of you use these types of sensors? How to configure it?

Greetings, Piotr

What is the device identified as by HA.

Hi.
Thank you for reply.

The device is discovered as:

# _TZE204_ztc6ggyl TS0601

TS0601

Manufacturer: _TZE204_ztc6ggyl

Here is screenshot:

Zrzut ekranu 2022-11-22 083616

In device info i see this:

# Device information

TS0601

manufacturer: _TZE204_ztc6ggyl

Connected by Zigbee Coordinator

Zigbee info

IEEE: dc:8e:95:ff:fe:55:98:de

Nwk: 0x8591

Device Type: Router

LQI: 87

RSSI: Unknown

Last seen: 2022-11-22T08:37:57

Power source: Mains

A search of zigpy quirks reveals it was added very recently. Much the same with z2m.

  1. Make a file in “zigbee2mqtt” folder, example; TS0601.js (See bottom for the code and make sure manufacture en vendor match yours.)
  2. add to config of zigbee2mqtt
external_converters:
  - TS0601.js

TS0601.js

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 e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE204_ztc6ggyl'
        },
    ],
    model: 'TS0601',
    vendor: '_TZE204_ztc6ggyl',
    description: 'Human Presence Sensor',
    fromZigbee: [fz.tuya_smart_human_presense_sensor],
    toZigbee: [tz.tuya_smart_human_presense_sensor],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [
            e.illuminance_lux(), e.presence(),
            exposes.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('m'),
            exposes.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(9).withValueStep(1)
                .withDescription('sensitivity of the radar'),
            exposes.numeric('minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
                .withDescription('Minimum range').withUnit('m'),
            exposes.numeric('maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
                .withDescription('Maximum range').withUnit('m'),
            exposes.numeric('detection_delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(0.1)
                .withDescription('Detection delay').withUnit('s'),
            exposes.numeric('fading_time', ea.STATE_SET).withValueMin(0).withValueMax(1500).withValueStep(1)
                .withDescription('Fading time').withUnit('s'),
            // exposes.text('cli', ea.STATE).withDescription('not recognize'),
            exposes.enum('self_test', ea.STATE, Object.values(tuya.tuyaHPSCheckingResult))
                .withDescription('Self_test, possible resuts: checking, check_success, check_failure, others, comm_fault, radar_fault.'),
    ],
};

module.exports = definition;

Will be added in zigbee2mqtt by Koen today so the work around will not be needed with the new release :wink: tomorrow.

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 ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: [
        { modelID: 'TS0601', manufacturerName: '_TZE204_sxm7l9xa' }
    ],
    model: 'TS0601_smart_human_presence_sensor',
    vendor: 'TuYa',
    description: 'Smart Human presence sensor',
    fromZigbee: [{
        cluster: 'manuSpecificTuya',
        type: ['commandDataResponse', 'commandDataReport'],
        convert: (model, msg, publish, options, meta) => {
            const dpValue = tuya.firstDpValue(msg, meta, 'tuya_smart_human_presense_sensor');
            const dp = dpValue.dp;
            const value = tuya.getDataValue(dpValue);
            let result = null;
            switch (dp) {
                case 105://tuya.dataPoints.tshpsPresenceState:
                    result = { presence: { 0: false, 1: true }[value] };
                    break;
                case 106://tuya.dataPoints.tshpscSensitivity:
                    result = { radar_sensitivity: value };
                    break;
                case 108://tuya.dataPoints.tshpsMinimumRange:
                    result = { minimum_range: value / 100 };
                    break;
                case 107://tuya.dataPoints.tshpsMaximumRange:
                    result = { maximum_range: value / 100 };
                    break;
                case 109://tuya.dataPoints.tshpsTargetDistance:
                    result = { target_distance: value / 100 };
                    break;
                case 110://tuya.dataPoints.tshpsDetectionDelay:
                    result = { detection_delay: value / 10 };
                    break;
                case 111://tuya.dataPoints.tshpsFadingTime:
                    result = { fading_time: value / 10 };
                    break;
                case 104://tuya.dataPoints.tshpsIlluminanceLux:
                    result = { illuminance_lux: value };
                    break;
                case tuya.dataPoints.tshpsCLI: // not recognize
                    result = { cli: value };
                    break;
                case tuya.dataPoints.tshpsSelfTest:
                    result = { self_test: tuya.tuyaHPSCheckingResult[value] };
                    break;
                default:
                    meta.logger
                        .warn(`fromZigbee.tuya_smart_human_presense_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
            }
            return result;
        },
    }],
    toZigbee: [{
        key: ['radar_sensitivity', 'minimum_range', 'maximum_range', 'detection_delay', 'fading_time'],
        convertSet: async (entity, key, value, meta) => {
            switch (key) {
                case 'radar_sensitivity':
                    //await tuya.sendDataPointValue(entity, tuya.dataPoints.tshpscSensitivity, value);
                    await tuya.sendDataPointValue(entity, 105, value);
                    break;
                case 'minimum_range':
                    //await tuya.sendDataPointValue(entity, tuya.dataPoints.tshpsMinimumRange, value * 100);
                    await tuya.sendDataPointValue(entity, 108, value * 100);
                    break;
                case 'maximum_range':
                    //await tuya.sendDataPointValue(entity, tuya.dataPoints.tshpsMaximumRange, value * 100);
                    await tuya.sendDataPointValue(entity, 107, value * 100);
                    break;
                case 'detection_delay':
                    //await tuya.sendDataPointValue(entity, tuya.dataPoints.tshpsDetectionDelay, value * 10);
                    await tuya.sendDataPointValue(entity, 110, value * 10);
                    break;
                case 'fading_time':
                    //await tuya.sendDataPointValue(entity, tuya.dataPoints.tshpsFadingTime, value * 10);
                    await tuya.sendDataPointValue(entity, 111, value * 10);
                    break;
                default: // Unknown Key
                    meta.logger.warn(`toZigbee.tuya_smart_human_presense_sensor: Unhandled Key ${key}`);
            }
        },
    }],
    exposes: [
        e.illuminance(), e.presence(),
        exposes.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('m'),
        exposes.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(9).withValueStep(1)
            .withDescription('sensitivity of the radar'),
        exposes.numeric('minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
            .withDescription('Minimum range').withUnit('m'),
        exposes.numeric('maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
            .withDescription('Maximum range').withUnit('m'),
        exposes.numeric('detection_delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(0.1)
            .withDescription('Detection delay').withUnit('s'),
        exposes.numeric('fading_time', ea.STATE_SET).withValueMin(0).withValueMax(1500).withValueStep(1)
            .withDescription('Fading time').withUnit('s'),
        // exposes.text('cli', ea.STATE).withDescription('not recognize'),
        exposes.enum('self_test', ea.STATE, Object.values(tuya.tuyaHPSCheckingResult))
            .withDescription('Self_test, possible resuts: checking, check_success, check_failure, others, comm_fault, radar_fault.'),
    ],
    // meta: {
    //     tuyaDatapoints: [
    //         [104, 'illuminance', tuya.valueConverter.raw],
    //         [105, 'presence', tuya.valueConverter.trueFalse1],
    //         [106, 'radar_sensitivity', tuya.valueConverter.raw],
    //         [107, 'maximum_range', tuya.valueConverter.raw],
    //         [108, 'minimum_range', tuya.valueConverter.raw],
    //         [109, 'target_distance', tuya.valueConverter.raw],
    //         [110, 'detection_delay', tuya.valueConverter.raw],
    //         [111, 'fading_time', tuya.valueConverter.raw]
    //     ],
    // }
};

module.exports = definition;

I have a similar device manufacturer: _TZE204_sxm7l9xa and model: TS0601. I have a similar problem, that after adding the device no entities related to it appear.

Any tips on how I can get this to work?

Thank you.

ZHA or Z2M?

ZHA

thanks.

https://github.com/search?q=repo%3Azigpy%2Fzha-device-handlers+_TZE204_sxm7l9xa&type=issues